esnet / react-timeseries-charts

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

Warning: Received NaN for the `height` attribute #399

Closed peterbe closed 5 years ago

peterbe commented 5 years ago

🐛Bug report

Describe the bug Trying to make a simple bar chart with two columns and I keep getting this warning:

Warning: Received NaN for the `height` attribute. If this is expected, cast the value to a string.

But it appears to be working.

To Reproduce

https://codesandbox.io/s/goofy-napier-rx6v7

Expected behavior No warnings.

Screenshots

Screen Shot 2019-05-31 at 8 07 20 AM

Desktop (please complete the following information):

Smartphone (please complete the following information): n/a

Additional context It works but the warning is annoying.

peterbe commented 5 years ago

Hm. Perhaps I just don't know how to use <BarChart> stacked or side-by-side. If I change it to:

columns={["created"]}

instead of

columns={["created", "processed"]}

Then it doesn't throw the warning

pbatleyGH commented 5 years ago

Try changing it to this?

points: data.map(([d, ...value]) => [
  Index.getIndexString("1h", new Date(d)),
    ...value
  ])

Using the spread operator means you'll pass two data columns in to match the number of columns you're declaring that the TimeSeries has.

peterbe commented 5 years ago

Thank you!