Charts are no longer constrained to start their y axis at an absolute value of zero.
This idea wasn't obviously bad due to the example data I chose, but its viability
became pretty limited as I played with different data sets.
Instead, it is possible to start at zero, or to start at the minimum value. You can
switch between the two easily. If you want to scale from min to max, you would do:
At the moment scaling from zero to max is still the default, because scaling bar charts from min to max does a horrifying job of making the data comprehensible. However, I intend to make line sparklines scale from min to max by default in the near future (bar sparklines will retain their current zero to max behavior).
In addition, I plan on making it possible to set arbitrary values for the top and bottom of the scaling window, which will allow further adaptation of the sparkline to the specific dataset being displayed.
There probably won't be too many more updates on this blog about Sparklines.js, unless there are any particularly interesting updates, so be sure to keep an eye on the repository if you're interested in the project.
Okay, the behavior here has been repaired and now is sufficiently flexible for any use case that I can imagine.
By default, line sparklines are scaled from min to max, and bar sparklines are scaled from zero to max. However, you can set arbitrary top and minimums (as well as reverting bar sparklines to the min to max behavior if desired).
Scaling a line sparkline from zero to max looks like this:
It ought to be working in Internet Explorer now, but I don't have a machine to test it on at the moment.
Requires the excanvas.js library, which is now in the repository (and at the project page). I'd be obliged
if someone verified it is working in IE.