My friend Ben Scheirman blogged about Google Chart API. You can read his post here. The chart API is a URL based API which means you will pass the data in the URL and Google will create a chart for you. This is truly awesome since creating the chart is a pretty hard performance kill operation specially when your chart is very very complex. Delegating this work to Google will save us from the trouble.
Anyway, there are many kinds of graphs that you can plot using the Google Chart API. In the example below I am plotting the vertical bar graph.
Here is the code to create the graph:
private void CreateChart()
{
List<Grade> grades = new List<Grade>();
grades.Add(new Grade() { Title = "Exam 1", Score = 10 });
grades.Add(new Grade() { Title = "Exam 2", Score = 30 });
grades.Add(new Grade() { Title = "Exam 3", Score = 90 });
grades.Add(new Grade() { Title = "Exam 4", Score = 45 });
string chartValue = String.Empty;
string chartScale = String.Empty;
foreach (Grade grade in grades)
{
chartValue += grade.Score + ",";
chartScale += grade.Title + "|";
}
Image img = new Image();
img.ImageUrl = String.Format("http://chart.apis.google.com/chart?chs=400x400&chbh=50,100&chd=t:{0}&cht=bvg&chxt=x,y&chxl=0:|{1}|9:|0|10|20|30|50",chartValue.TrimEnd(','),chartScale.TrimEnd('|'));
panelChart.Controls.Add(img);
panelChart.DataBind();
}
The most important line is the URL that is being populated with the graph scale and values. Check out the graph that is created below:

Pretty awesome right!