Google chart API is a free tool to create the charts online very easily. If you want to create and add the chart or graph to your webpage, then the Google Chart Tool is very useful. You just need to choose the type of the chart you want, enter the data values and choose the labels, colors etc, and the wizard will generate the image, copy and paste the generated HTML in your page where you want to add the chart.
See the below pie chart example which i have created using Chart tool.
See the below settings for data to create above pie chart.
You can create a 10 different types of charts using this tool (line chart, bar chart, pie chart etc). It has lot of options to customize the graphs very easily.
If you want to create the charts without using the above chart tool, you just need to add the parameters to the Google Chart URL. see the whole list of features here.
Here is the Google Chart URL:
To add the options, append the parameters to the above URL
-“cht” is a chart type parameter, we have to pass “cht=p” for pie chart.
-“chs” is a chart size parameter, we have to pass “chs=500×225” for 500 width and 200 height.
-“chco” is a color parameter, pass the color hexadecimal like “chco=3D7930”.
-“chd” is a data parameter, pass the data values as “chd=t:30,40,30”
-“chdl” is for data value legends (chdl=Category1|Category2|Category3)
You can see a full list of parameters and values here.
Once you created the URL, you can paste that into the browser address bar to verify the chart is working as expected.
Create a image tag and give the “src” attribute as above created URL to display the chart.
<img src="http://chart.apis.google.com/chart?chs=500x225&cht=p&chco=3D7930&chd=t:30,40,30&chtt=Category+Chart&chdl=Category1|Category2|Category3&chl=C1(30%25)|C2(40%25)|C3(30%25)" width="500" height="225" alt="" />