react-sparklines
react-sparklines copied to clipboard
<rect> attribute height: Expected length, "NaN".
Hi I met an error described as "<Sparklines data={this.props.data} width={180} height={120} margin={5}> <SparklinesLine color={this.props.color} /> </Sparklines>
react-sparklines version 1.7.0
Can someone help me ?
I experience the same error. The exact error message in Firefox is:
Unexpected value NaN parsing height attribute.
I haven't yet been able to track down the root cause of the issue.
For me at least it only seems to manifest itself when using the SparklinesNormalBand.
My component looks like this:
<Sparklines data={readings} svgHeight={25} svgWidth={190} min={0} max={100}>
<SparklinesLine />
<SparklinesNormalBand />
</Sparklines>
If I remove the <SparklinesNormalBand /> the error vanishes.
The issue with SparklinesNormalBand is due to a typo on this line:
https://github.com/borisyankov/react-sparklines/blob/master/src/SparklinesNormalBand.js#L26
height={stdev * 2}
Should be:
height={dataStdev * 2}
See: https://github.com/borisyankov/react-sparklines/issues/91 & https://github.com/borisyankov/react-sparklines/pull/114