Google Charts – Line Chart with Markers

In previous post we have seen –

  • How to create in setup chart object
  • How to add data sets
  • How to set axis
  • How to render the final chart

If you are not familier with the post you can read it here. Here we will see how to add the data set and different markers for data points. I have created simple class data structure that hold information about data set.

From above class its straight forward that, it stores data points, legend and color to use for this chart. On similar line, I have another data structure for data point markers and labels.

Here text for marker will be considered only when market type is set to text(t). You can get more info on marker type from google official site. Lets see the code that will generate us some cool chart.

After you add all data points and give a call to show, it will give you the chart as –

Line Chart with Marker

Line Chart with Marker

You can also have options to create bar charts, pie charts. Also you can extend/update the class to support all chart types and styels.

Add a Comment

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