Google Charts – Simple Line Charts

In previous post, we had some basic background learning about Google Charts. Now here I will start posting some code samples to that I have generated using the wrapper class for Google charts. Lets go through the sample code.

This is basic, we need to include the class we are goin to use.

Here we are initializing the chart object and setting its type, size, encoding format, title. These functions are pretty simple and its easy to guess what it might be doing.
Now, we will generate some random data for our chart and add that to our chart object as data sets.


Function AddDataSet, also has option to accept the data point labels. We will see snippet of that very soon.
As we have added data to our chart object, its time to set some lines that will serve as out x and y axis.

We have chart object, data sets and we have setup our axes too. Its just matter of time now, you just need to render the chart. The rendering is done as

The end result will be like –

Simple Line Chart

Simple Line Chart

Isn’t it simple!! I will try to provide some more code snippets for charts.

Add a Comment

Your email address will not be published. Required fields are marked *