开发者

jQuery Sparklines: Automatic zero-centering for bar charts

I am using jQuery sparklines to display a bar chart, e.g.:

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

The problem is that jQuery is using the lowest value, i.e. 10, as a reference and is only displaying a very small bar for it (as if it was 0), while the other bars differ significantly in size (although the values are almost equal).

What I am looking for is an option that tells jQuery to use 0 as a reference, i.e., automatically zero-center the bars. The option

zeroAxis: true

is not doing the trick.

A workaround would be to add a 0 manually to each bar chart, 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.开发者_StackOverflow中文版 Any help is appreciated! Thank you very much!

Felix


In case you haven't found an answer yet: you can use "chartRangeMin: 0" to do what you want, see http://www.omnipotent.net/jquery.sparkline/#common

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜