Anil Singhal <[email protected]> wrote on 12/03/2009 03:29:23 PM: > I have created two Line charts. First one, shows as straight line (I > dont know why??). Second one shows properly. > > Can you guys test my code (just copy and paste in notepad and save as > htm file) and let me know what I am doing wrong.. I am using same code > but different values... > > Thank you greatly in advance!! > > > <html><head></head> > <body> > <img src="http://chart.apis.google.com/chart?cht=lc&chd=t: > 157,163,178,269,245,305,187,206,345,271,156,267,197,285,208,234,189, > 211,253,296,180,203,292,269,256,243,190,240,284,314&chs=1000x300&chl=79| > 80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|00|01|02| > 03|04|05|06|07|08&chdl=Mean&chco=0000FF&chxt=y&chxr=0,173,346" > id="ctl00_ContentPlaceHolder1_model1" /> > > <img src="http://chart.apis.google.com/chart?cht=lc&chd=t: > 0,5,7,6,4,6,8,0,9,0,3,5,11,3,4,2,4,10,5,10,7,9,10,8,7,13,5,5,11, > 5&chs=1000x300&chl=79| > 80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|00|01|02| > 03|04|05|06|07|08&chdl=Mean&chm=D&chco=0000FF&chxt=y&chxr=-1,6,14" > id="ctl00_ContentPlaceHolder1_model2" /> > > </body></html>
Hi, You are scaling your axis with chxr=0,173,346 (which scales the first axis specified in chxt= to those low and high values) but you are not scaling your data with chds. You need to scale your data to the same values that you are scaling your Y-axis so the values line up. The following URL may be what you want. http://chart.apis.google.com/chart?cht=lc&chd=t:157,163,178,269,245,305,187,206,345,271,156,267,197,285,208,234,189,211,253,296,180,203,292,269,256,243,190,240,284,314&chs=1000x300&chl=79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|00|01|02|03|04|05|06|07|08&chdl=Mean&chco=0000FF&chxt=y&chxr=0,173,346&chds=173,346 Also notice that you have some values outside the data scale, which will cause them be "missing" and you will have a non-continuous line. I also notice that you are scaling your axis in the second graph with chxr=-1,6,14 -- I do not think this will do what you want, the first parameter is a zero-based index of your axis specified in chxt= (in this case, the axis for 'Y' is '0'). Consequently, the API is ignoring this parameter, and keeping the axis scale as zero to 100 which is the default. Since all of your values are below 100, the graph shows correctly, albeit with all the values at the low end of the chart. See this link: http://code.google.com/apis/chart/formats.html#data_scaling for information about data scaling See this link: http://code.google.com/apis/chart/labels.html#axis_range for information about the axis range Hope this helps, Tristan -- 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.
