esnet / react-timeseries-charts

Declarative and modular timeseries charting components for React
http://software.es.net/react-timeseries-charts
Other
859 stars 283 forks source link

ValueList ignores its style property and uses hard-coded colors anyway #430

Open jtiscione opened 4 years ago

jtiscione commented 4 years ago

🐛Bug report

ValueList ignores the style parameters provided by its parent component (LabelAxis).

I'm setting the property "style" in LabelAxis to this, as specified in the LabelAxis docs:

            style={{
              axis: {
                fill: 'black',
                stroke: 'black',
                background: 'black',
                color: 'black',
                opacity: '0.0',
              },
              label: {
                fontSize: 12,
                fill: 'black',
                stroke: 'black',
                background: 'black',
                color: 'black',
                opacity: '0.0',
              },
              values: {
                fill: 'black',
                stroke: 'black',
                background: 'black',
                color: 'black',
                opacity: '0.0',
              }
            }}

The style.values object is making it into ValueList as prop "style":

style={{
    fill: 'black',
    stroke: 'black',
    background: 'black',
    color: 'black',
    opacity: '0.0',
 }}

And then ValueList just ignores it and applies its default styles and colors.

jtiscione commented 4 years ago

This is also a problem with LabelAxis. It sends styles to ValueList that get ignored too.

Looking at this, it turns out that the reason the styles are ignored is that someone decided to shift around the format for the style object without updating the documentation. So the sample code for any component that uses ValueList is broken.