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

Scrolling Sparkline needs unnecessary values

Open michaelryancaputo opened this issue 8 years ago • 1 comments

Cool component! I noticed today that a sparkline that i'm creating requires to have data that is not actually visible on the graph. For example, my limit was set to 20. So naturally I was .pop()ing off of my array to save memory (hoping my sparkilne can work for weeks without refreshing browser, so I was attempting to reduce memory leaks). However, I noticed that the line stopped scrolling when this was done.

Just wondering why we need to keep the old data.

michaelryancaputo avatar Aug 25 '16 16:08 michaelryancaputo

I think the issue you are having is that .pop() does not create a new array, and thus the component is not initialized. You can create a new array with `.slice()' instead.

borisyankov avatar Jan 20 '17 03:01 borisyankov