I was experimenting with basics to understand how reactiveness works, and how to use
viewof in some other thread here. And then sidetracked into moving
sparkline from the HTML intro into its own notebook.
I wanted the
width of sparkline to be dependent on amount of elements in passed array.
Then I got bored and made a sparkline that reacts to Observable
now timestamp. This required a
ringbuffer array to store previuos data. This is what I’ve got.
There are two bugs. Maybe it is only on Firefox though.
When the buffer is reduced to zero, the number generator stops and never recovers again.(fixed thank to @mootari hint)
buffersizeis reduced rapidly, then the
sparklinestill leaves some static flickering in the right part of the screen.
And the last thing I’d like to fix is the visible size of the defined
controlled array, which doesn’t change after
controlled.length is changed by slider.
The full notebook: Long Sparkline and Ring Buffer / Anatoli Babenia / Observable
EDIT: Non-recovering zero buffer is fixed.