开发者

How do you get a y-axis that starts at zero in graphael, if none of your values are zero?

开发者 https://www.devze.com 2023-03-28 04:01 出处:网络
I wish to create a graph whose y-axis starts at 0. None of my values are 0 though. How do i go about doing that in graphael ?

I wish to create a graph whose y-axis starts at 0. None of my values are 0 though. How do i go about doing that in graphael ?

As an extension, how can I create开发者_运维技巧 a graph with a y-axis whose maximum value is, lets say, twice the maximum value in the provided data ?


I don't know if this is too late but I've been struggling with gRaphael myself and came across a solution that might work for you. There's no obvious or clean way to do this but I've found a decent hack for it.

You can add in another array of y values (the first being 0 and last being 2x your max value) and specify the color for this line to be transparent using the colors option.

I've created a fiddle so you can see what I mean: jsFiddle example

The first chart is what you currently have and the second shows the addition of the second set of y values.

0

精彩评论

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

关注公众号