Sunday, December 09, 2007

Updated NGChart library (.NET wrapper for Google Chart API)

NGChart was updated with the new features:

Bar charts

Pie charts with labels

Chart title

And the project wiki now has Samples page.

Labels: , , , , , , , , ,

Friday, December 07, 2007

.NET wrapper for Google Chart API

As you may know, Google created a simple and easy way to dynamically generate charts to use in web projects with the new Google Chart API.

I started a project to wrap the library to simplify usage of it in .NET projects.

As example - say, you need to visually compare two line charts:

Chart chart = new Chart(ChartType.Line,
                          new ChartSize(200, 125),
                          new ChartData(new int[][]
                                            {
                                                new int[] { 0, 1, 25, 26, 51, 52, 61, 1 },
                                                new int[] {7, 12, 60, 57, 4}
                                         }),
                          new Color[] { Color.DodgerBlue, Color.Gainsboro });
return chart.ToString();

It will generate the following url:

http://chart.apis.google.com/chart?cht=lc&chs=200x125&chd=s:ABZaz09B,HM85E&chco=1E90FFFF,DCDCDCFF

And the generated url shows the following chart:

Generated chart

Labels: , , , , , , , ,