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

a bug about composite #59

Closed Gcaufy closed 11 years ago

Gcaufy commented 11 years ago

try this code in firebug console in your home page, you will see the bug, the red line should never higher than the blue line $('#compositeline').sparkline([1.078848, 1.241441, 1.308693, 1.333736, 1.254798, 1.300275, 1.301664, 1.375254, 1.309989, 1.317100, 1.403047, 1.242620, 1.541820, 1.393999, 1.553420, 1.472777, 1.353848, 1.388872, 1.264356, 1.522010, 1.466242, 1.456761, 1.296150, 1.235543], { fillColor: false }); $('#compositeline').sparkline([1.049862, 1.107218, 1.136244, 1.110050, 1.068434, 1.083617, 1.127363, 1.120001, 1.088645, 1.105921, 1.123032, 1.091422, 1.199707, 1.108032, 1.142687, 1.145122, 1.143045, 1.157749, 1.064208, 1.134536, 1.135931, 1.162465, 1.130432, 1.046818], { composite: true, fillColor: false, lineColor: 'red' });

katowulf commented 11 years ago

I think your second (the composite) line needs to specify chartRangeMin and chartRangeMax values, which should match the min/max values in your first line?

gwatts commented 11 years ago

Yes, if you're using composite you almost always want to use chartRangeMin/Max - Doesn't matter much for the example on that page, but I've added it anyway for clairty and updated the docs for the composite option

josephbona commented 7 years ago

Is there any way to dynamically get the max from the first instance of the sparkline (assuming data comes from an outside source)? @gwatts