Showing posts with label Components. Show all posts
Showing posts with label Components. Show all posts

Saturday, December 08, 2007

Google Chart


Google released Chart API which lets your web page to generate the Chart dynamically. Several types of image can be generated: line, bar, and pie charts for example. For each image type you can specify attributes such as size, colors, and labels.

How it works
- Request the url with chart parameters in query string, Google will response the “png” image chart.
E.g. http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Hello-YWorld-X
- Use with <img> tag
E.g. <img src="http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Hello-Y|World-X" /></IMG<>


Usage Policy
The Use of the Google Chart API is free but it is subject to a query limit of 50,000 queries per user per day. If you go over this 24-hour limit, the Chart API may stop working for you temporarily. If you continue to exceed this limit, your access to the Chart API may be blocked.

URL format
Google Chart API URLs must be in the following format:
http://chart.apis.google.com/chart?
chs=200x125
&chd=s:helloWorld
&cht=lc
&chxt=x,y
&chxl=0:|Mar|Apr|May|June|July|1:||50+Kb


Where:
· http://chart.apis.google.com/chart? is the Chart API's location.
· & separates parameters.
· chs=200x125 is the chart's size in pixels.
· chd=s:helloWorld is the chart's data.
· cht=lc is the chart's type.
· chxt=x,y indicates both x-axis and y-axis labels are required.
· chxl=0:|Mar|Apr|May|June|July|1:||50+Kb are the x-axis and y-axis labels.

Sample chart

Reference:
http://code.google.com/apis/chart/
Other Resources:
.Net server controls for google chart - http://pietschsoft.com/Blog/Post.aspx?PostID=1429

Have a nice day!