I just tried to do this as well. Prepending 0-9 to the URL, like http://1.chart.apis.google.com/chart?... does not work when using img tags from inside a web page (perhaps due to a 301 HTTP header being sent out with the image; see emails quoted below for notes from others who have also had this problem), but it does work when loading a single image directly in the browser's location bar. It appears to have been this way for quite some time, even though the docs at http://code.google.com/apis/chart/docs/making_charts.html#enhancements say it can be done.
-Chris 2010/4/6 Bernardo de Pádua <[email protected]>: > I am experiencing something similar. When I use the number prefix, I > get "400 Bad Request" errors when I try to embeed the url in img tags > the first time the imgs are loaded by the browser. I get no error when > I input the url directly in the address bar, and also won't get the > error anymore in the img tag for a given URL when I input it in the > address bar. > > Here is an example HTML: > > <html> > <head></head> > <body> > > <img src = "http://1.chart.apis.google.com/chart? > chd=t4:53.83,115.037,115.037,115.037,44.858|-14.289165944627,-26.781641996333,-16.609297224792,0.842115526332975,40.037768163243| > 251.034091889254,202.061102174484,289.377094449584,298.280968947334,313.292509650526| > 195.706074055373,195.964539821849,98.476202775208,72.120915526333,88.092722186231| > 44.858&chxl=1:|Total|Area4|Area2|Area1|Administra%C3%A7%C3%A3o|2:| > Sua+Renda&chf=b1,lg,90,FFFFFF,1,C6D9FD,0|b2,lg,90,98B6EB, > 0,406AB3,0.5,98B6EB,1|b3,lg,90,FFFFFF,0,C6D9FD, > 1&chds=0,450.0&chco=FFFFFF&chm=H,D4842F, > 4,0,2&chxr=0,0,450.0,80&chxt=x,y,t&chxs=0N*cBRL*+mil| > 2,D4842F&chs=450x270&cht=bhs&chxp=2,9.96844444444444&chbh=a, > 15,30" > > > > <img src = "http://2.chart.apis.google.com/chart?chd=t: > 0.0230,0.460,0.172,0.0690,0.276&chxl=2:|Renda+Bruta+%28R%24+mil%29| > 3:|Membros|0:|0%2C0+a+78|78+a+160|160+a+230|230+a+470|470+ > %2B&chds=0,0.51&chco=406AB3&chm=tVoc%C3%AA,D4842F, > 0,0,10,,e:0:5&chxr=1,0,0.51&chxt=x,y,x,y&chxs=1N*p*| > 0,,9&chs=550x330&cht=bvg&chbh=a,0,15&chxp=2,50|3,50" > > > <img src = "http://3.chart.apis.google.com/chart?chd=t: > 12.5,12.5,12.5,8.33333333333333,8.33333333333333,45.8333333333333&chco=406AB3&chl=Educa > %C3%A7%C3%A3o+%2813%25%29|Tecnologia+da+Informa%C3%A7%C3%A3o+ > %2813%25%29|Medicina+e+Hospitais+%2813%25%29|Minera%C3%A7%C3%A3o+ > %288%2C3%25%29|Com%C3%A9rcio+Atacadista+%288%2C3%25%29|Outras+ > %2846%25%29&chs=800x300&cht=p3" > > > <img src = "http://4.chart.apis.google.com/chart?chd=t: > 33.695652173913,13.0434782608696,11.9565217391304,10.8695652173913,30.4347826086957&chco=406AB3&chl=Administra > %C3%A7%C3%A3o+%2834%25%29|Area2+%2813%25%29|Area1+%2812%25%29|Area4+ > %2811%25%29|Outras+%2830%25%29&chs=800x300&cht=p3" > > > </body> > </html> > > > Save this to a .html file, load it (all images will be broken), then > copy/paste one of the URLs in the address bar, than open the > same .html again. You will see what I mean. > > For the mean time I am no using the prefixes, I get not errors then. I > hope Google fixes this or deprecates the URL prefix. > > Cheers, > Bernardo > > On Mar 31, 1:09 pm, Rowan B <[email protected]> wrote: >> Hi all, >> >> The "Improving Performance on Pages with Many Charts" section >> onhttp://code.google.com/apis/chart/docs/making_charts.html#enhancements >> provides a tip on how to improve load performance on pages with many >> charts, namely: >> >> "you can add a number 0-9 and a dot just before >> chart.apis.google.com", eghttp://0.chart.apis.google.com/chart?cht=… >> >> I've tried using this, and when prepending server numbers, Safari 4, >> FF 3.5 and IE 8 all refuse to load the charts. >> >> An example URL using this performance trick is: >> >> http://2.chart.apis.google.com/chart?chs=150x30&chma=0,0,0,0&cht=ls&c... >> >> When this is loaded directly, it works in all browsers. However, a >> header inspection shows it is served with a 301 redirect header, and >> is attempting to redirect to /apis/charttools/index.html ; loading >> this image inline to a page just shows a broken image. >> >> Are the docs out of date (is the behaviour no longer supported?), or >> am I doing something wrong? >> >> Many thanks, >> Rowan > > -- > 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. > > -- 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.
