The Google Chart API provides an easy way to generate a chart dynamically by sending a simple URL to Google Chart service as follows:
And Google Chart returns you an image of the chart. As shown the above you just need to pass the Google Chart with three parameters, which are cht (Chart Type), chd (The percentage distribution of your data on Chart), chs (Chart size), and the chl (Chart Label)
1. The web form The web form presents three rows for letting the user key in the label and the value for each row. You just simply key in the value for each row, and it’ll take the sum of the row values and work out the percentage for each row, and when you click the Show Chart button, the PIE chart will be presented in the DIV with DOM ID “chart_div”.
out of the total values, this function is called when the user has input the value column of each row and the sum of value is calculated
value and sends it to the Google Chart API and displays the chart in the DIV with ID “chart_div”
And finally the result as follows: the DIV with DOM ID “chart_div” which displays the PIE chart and an anchor “chartshow” for moving the focus to the chart when the user clicks the above “Show Chart” button.