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

风流意气都作罢 提交于 2019-12-24 01:26:09

问题


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 ?


回答1:


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.



来源:https://stackoverflow.com/questions/7075013/how-do-you-get-a-y-axis-that-starts-at-zero-in-graphael-if-none-of-your-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!