react-sparklines icon indicating copy to clipboard operation
react-sparklines copied to clipboard

<rect> attribute height: Expected length, "NaN".

Open neil0118 opened this issue 7 years ago • 3 comments

Hi I met an error described as " attribute height: Expected length, "NaN"." I implemented my Component like this: <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 ?

neil0118 avatar Oct 30 '18 14:10 neil0118

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.

sebastian avatar Nov 14 '18 08:11 sebastian

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.

sebastian avatar Nov 14 '18 08:11 sebastian

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

yngndrw avatar Nov 09 '20 04:11 yngndrw