gwatts / jquery.sparkline

A plugin for the jQuery javascript library to generate small sparkline charts directly in the browser
http://omnipotent.net/jquery.sparkline/
1.24k stars 278 forks source link

sparkline line chart highlightSpot and highlightLine wrong if first value is null #96

Open olaf64 opened 10 years ago

olaf64 commented 10 years ago

i found a problem concerning jQuery Sparkline 2.1.2 linie charts: if the first value is null, then highlightSpot and highlightLine mark the wrong line.

maybe its easy fixed by inserting the following lines at line 1599 (sparkline 2.1.2): } else { // OC 23.10.2013: Fix wrong highlightSpot and highlightLine if first value is null vertices.push(null);

around this area (starting at line 1592: if (y === null) { if (i) { if (yvalues[i - 1] !== null) { path = []; paths.push(path); } vertices.push(null); } else { // OC 23.10.2013: Fix wrong highlightSpot and highlightLine if first value is null vertices.push(null); } } else {

see the following example sparkline_highlite-error.html: https://gist.github.com/olaf64/7133322

zallek commented 9 years ago

+1

zallek commented 9 years ago

@olaf64 fixed in https://github.com/botify-labs/jquery.sparkline.git#2.1.5 using your advice. Fell free to use it, even if you might dont need it anymore :)