I was generating a bar graph based on data supplied by user. In php, I found the maximum of the values and used this to mark the max value for y - axis
http://chart.apis.google.com/chart?chs=400x300&chds=0,300&chxr=1,0,300&chd=t:125,250,275&cht=bvs&chco=4D89F9&chxt=x,y&chxl=0:|First|Second|Third&chm=N*c2z*$,000000,0,-1,9&chbh=a&chts=7B68EE,10&chf=bg,s,EFEFEF&chtt=TestGraph This is how it looks when I view the graph Here is the code in php for <img> tag <img src="http://chart.apis.google.com/chart?chs=400x300&chds=0,<?php echo $max; ?>&chxr=1,0,<?php echo $max; ?>&chd=<?php echo $data; ?>&cht=bvs&chco=4D89F9&chxt=x,y&chxl=0:|<?php echo $pub; ?>&chm=N*c2z*$,000000,0,-1,9&chbh=a&chts=7B68EE,10&chf=bg,s,EFEFEF&chtt=<?php echo $title; ?>" alt="Comparison Chart" /> To find the max value, you could store the individual values in an array , use a for loop to find max $max = $data[0]; for ($i=0;$i<n;$i++) if $data[$i] > $max $max = $data[$i]; On Tue, Feb 24, 2009 at 5:37 PM, Marc-Andre Menard <[email protected]>wrote: > > Anaybody know a formula of an option to get the value axis calculate base > on > passed value... Let said a have value of : 1,2,3,4,5 I will lite the axis > to be 1 to 6 (max value +1) of 1 to 5 AUTOMATICLY > > SO WHEN THE VALUE WILL CHANGE THE AXIS WILL ACCORDINILY > > - > > > On 22/02/09 7:27 PM, "mickaxl" <[email protected]> wrote: > > > > > Here's the path with my suggestions though I did not have to use axis > > label position after all. > > > > It still needs &chds=0,6 to specify the scaling range > > > > then &chxr=1,0,6,1 to specify the axis range > > > > and finally &chm=t1,000000,0,0,20,1|t2,000000,0,1,20,1| > > t3,000000,0,2,20,1|t4,000000,0,3,20,1|t5,000000,0,4,20,1 to pop in all > > the text labels > > > > > http://chart.apis.google.com/chart?chs=600x200&cht=bhg&chd=t:1,2,3,4,5&chxl=0 > : > > > |a|b|b|d|e&chxt=y,x&chds=0,6&chxr=1,0,6,1&chm=t1,000000,0,0,20,1|t2,000000,0,1 > > ,20,1|t3,000000,0,2,20,1|t4,000000,0,3,20,1|t5,000000,0,4,20,1 > > > > On Feb 21, 4:08 pm, menardmam <[email protected]> wrote: > >> here is the whole path :http://chart.apis.google.com/chart?chs=600x200 > >> &cht=bhg&chd=t:1,2,3,4,5&chxl=0:|a|b|b|d|e&chxt=y,x&chxr=0,10 > > > > > -- > Ciao > > Marc-André Ménard, StudioTeknik.com > Portable a Genève, Suisse : +41 079 573 48 99 > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Chart API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-chart-api?hl=en -~----------~----~----~----~------~----~------~--~---
