Column height not matching x-axis values

163 views
Skip to first unread message

Peter

unread,
May 3, 2010, 10:47:40 AM5/3/10
to Google Chart API
I'm trying to create a chart where I can show the amount of people in
a certain age.

So there are 5 people in age of 25, 10 in age of 30 etc.
Check out this image:
http://chart.apis.google.com/chart?cht=bvo&chbh=20,10,0&chs=400x200&chxt=x,y&chd=t:5,10,23,2&chxl=0:|25|30|35|40&chxr=1,6,30

However, the column height does not match with the values on the x-
axis....what am I doing wrong?

--
You received this message because you are subscribed to the Google Groups "Google Chart API" group.
To post to this group, send email to google-c...@googlegroups.com.
To unsubscribe from this group, send email to google-chart-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-chart-api?hl=en.

Peter

unread,
May 3, 2010, 3:57:17 PM5/3/10
to Google Chart API
Fixed it: had to add &chxr=1,0,80,10
Total: /chart?cht=bvo&chbh=20,10,0&chs=400x200&chxt=x,y&chd=t:
5,10,23,2&chxl=0:|25|30|35|40&chxr=1,0,80,10

On May 3, 4:47 pm, Peter <floranfe...@gmail.com> wrote:
> I'm trying to create a chart where I can show the amount of people in
> a certain age.
>
> So there are 5 people in age of 25, 10 in age of 30 etc.
> Check out this image:http://chart.apis.google.com/chart?cht=bvo&chbh=20,10,0&chs=400x200&c...25|30|35|40&chxr=1,6,30

KeithB

unread,
May 4, 2010, 8:19:44 AM5/4/10
to Google Chart API
Peter,

Your second chart is better, but still not correct. Read the entire
"Data Scaling and Axis Scaling" section of the documentation @
http://code.google.com/apis/chart/docs/data_formats.html#scaled_values

Key points:
- Data is scaled to fit the format range: you're using the basic text
format -- Format range: 0—100
- Axis label range is calculated independently: you modified the y-
axis label range to fit your data -- this is not ideal

The fix is to use use text format with scaling:
http://code.google.com/apis/chart/docs/data_formats.html#data_scaling

Here's a chart with the y-axis ranging from 0 to 30 (chxr=1,0,30) and
text scaling specified to match (chds=0,30):
http://chart.apis.google.com/chart?cht=bvo&chbh=20,10,0&chs=400x200&chxt=x,y&chd=t:5,10,23,2&chxl=0:|25|30|35|40&chxr=1,0,30&chds=0,30

Hope that helps,
Keith
Reply all
Reply to author
Forward
0 new messages