JQuery Sparklines: automatic zero-centering for histograms

I use jQuery spark lines to display a histogram, for example:

<p><span class="inlinebar">11,13,14,15,13,12,15,11,10,13</span></p>

The problem is that jQuery uses the lowest value, i.e. 10, as a reference and displays only a very small strip for it (as if it were 0), while other columns vary greatly in size (although the values ​​are almost equal).

What I'm looking for is an option that tells jQuery to use 0 as a reference, i.e. automatically align zero centers. Option

zeroAxis: true

doesn't do the trick.

A workaround would be to add 0 manually to each histogram, i.e.

<p><span class="inlinebar">0,11,13,14,15,13,12,15,11,10,13</span></p>

But maybe there is a more elegant way. Any help is appreciated! Many thanks!

Felix

+3
source share
1
+6

Source: https://habr.com/ru/post/1785713/


All Articles