How do I make Google Charts scale an extended encoding line graph properly?
For the life of me, I can't get this graph to display properly with extended encoding.
If I change the axis range from 0 to 15, it looks correct, but if I change the axis from 9 to 15, the data is plotted incorrectly.
This turns out correct:
<img src="http://chart.apis.google.com/chart?cht=lc&chco=125292&chm=B,cee1f5,0,0,0&chls=2&chs=408x237&chxt=x,y&chxl=0:|Jan|Feb|Mar|Apr|May|Jun|Jul&chxr=1,0,15&chd='+extendedEncode(Array(10,15,9,11,12,10,11),15)+'" />
But this scales incorrectly:
<img src="http://chart.apis.google.com/chart?cht=lc&chco=125292&chm=B,cee1f5,0,0,0&chls=2&chs=408x237&chxt=x,y&chxl=0:|Jan|Feb|Mar|Apr|May|Jun|Jul&chxr=1,9,15&chd='+extendedEncode(Array(10,1开发者_C百科5,9,11,12,10,11),15)+'" />
I have spent hours and hours trying to figure this out, and I feel like I'm missing something incredibly simple. I have to use extended encoding because of the range of numbers my program will ultimately be handling, so changing to "Text Format with Custom Scaling" is not an option.
Read this: http://code.google.com/apis/chart/image/docs/gallery/line_charts.html#axis_range
and this: http://code.google.com/apis/chart/image/docs/data_formats.html#axis_scale
When using simple or extended encoding data is brought to 0-100 scale no matter what you use. This let Google Chart reduce url length and fit more dat into the GET HTTP Request.
As a side effect you have to scale the data instead of the axis. Since the axis data is not used when plotting these charts.
精彩评论