开发者

Make Google Charts adapt the vertical axis to the data

开发者 https://www.devze.com 2023-04-09 22:06 出处:网络
I want Google chart to make better use of the vertical space available for this graph: https://chart.google开发者_StackOverflow中文版apis.com/chart?chs=300x150&cht=bvs&chxt=x%2Cy&chd=t:7,

I want Google chart to make better use of the vertical space available for this graph:

https://chart.google开发者_StackOverflow中文版apis.com/chart?chs=300x150&cht=bvs&chxt=x%2Cy&chd=t:7,8,5,6

Make Google Charts adapt the vertical axis to the data

QUESTION: How to make the vertical axis adapt to the range of values automatically?

For instance, 0→max value would be great.

Note: I could write a server-side algorithm to find the max value and use it as a parameter, but there is probably a better way to do this with Google Charts, right?


I ended up writing a server-side loop to check what is the maximum value, and then use it:

&chxr=1%2C0%2C" + max + "&chds=0," + max

Any better solution is welcome!

0

精彩评论

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

关注公众号