Skip to content


NGChart : .net class to generate google charts

NGChart is .NET class library to work with Google Chart API. Which provides simple classes and methods to generate google charts.

Example

BarChart chart = new BarChart(BarsType.Grouped, BarsDirection.Vertical,
         new ChartSize(420, 125),
         new ChartData(new int[][]
           {
              new int[] { 20, 1, 25, 26, 51 },
              new int[] { 7, 12, 60, 57, 4 }
            }) );

chart.Colors = new ChartColors(new Color[] { Color.DodgerBlue, Color.YellowGreen });
chart.Legend = new ChartLegend(new string[] {"Winter", "Summer"});

//chart.ToString() is return google chart image URL
 imgChart.ImageUrl = chart.ToString();

NGChart will generate an URL (Google API) for above code like this:

http://chart.apis.google.com/chart?cht=bvg&chs=420×125&chd=s:UBZaz,HM85E&chco=1E90FF,9ACD32&chdl=Winter|Summer

And above API i.e. URL will display following chart,

bar

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • StumbleUpon
  • Twitter
  • Yahoo! Buzz

Posted in Asp.net, C#, Tools.

Tagged with .


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.