Site icon David Yin's Blog

Google Chart API

Google introduced it Chart API last December.
For reference, I noted here my tips.
I need a 3D Pie chart. The code should looks like below:

<img src=”https://chart.apis.google.com/chart?cht=p3&chd=t:50,10,40&chs=500×200&chl=PR|HTTP Status|Whois”/>


The code can break down as shown here:
“cht=p3” is the chart type, in this case, a 3D pie chart.
“chd=t:50,10,40” are the chart values, text-encoded, and separated by a comma.
The number should be ranged from 0 to 100.
“chs=500×200” is the custom chart size, 500 by 200 pixels.
“chl=PR|HTTP Status|Whois” are the different labels for the pie chart sections, separated via the pipe character. Chinese is not supported by Chart API.
chart types include: line charts, bar charts, pie charts, Venn diagrams & scatterplots.

Exit mobile version