My favorites | Sign in
Project Logo
                
Search
for
Updated Jul 20, 2008 by erymski
Labels: Featured, Samples
NGChartSamples  
Samples of the library usage.

NG Chart usage samples

In addition, you can use unit tests as a guide.

Line charts

View example of line chart with chart title

Code to generate the chart (LineChart type intoduced in v0.5):

LineChart chart = new LineChart(new ChartSize(200, 125),
                        new ChartData(new int[] { 0, 1, 25, 26, 51, 52, 61, 1 }));
chart.Colors = new ChartColors(Color.DodgerBlue);
chart.Title = new ChartTitle("Line chart\nsimple one", Color.Olive, 10);
chart.LineStyles = new LineStyles(new LineStyle(3, 7, 1));

Pie charts

2D pie chart

View example of 2D Pie chart

Code to generate the chart:

PieChart chart = new PieChart(PieChartType.Pie2D, 
             new ChartSize(300, 200),
             new ChartData(new int[] { 25, 28, 12 })
             );

3D pie chart

View example of 3D Pie chart

Code to generate the chart:

PieChart chart = new PieChart(PieChartType.Pie3D,
             new ChartSize(400, 150),
             new ChartData(new int[] { 25, 28, 53 })
             );

// set colors
Color[] colors = new Color[] { Color.DodgerBlue, Color.Orchid, Color.DarkSalmon };
chart.Colors = new ChartColors(colors);

// generate labels from color names
string[] colorNames = Array.ConvertAll<Color, string>(colors,
                            delegate(Color color)
                            {
                                return color.ToKnownColor().ToString();
                            });

Bar charts

Vertical grouped bar chart with legend

View example of bar chart

Code to generate the chart:

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"});

Horizontal stacked bar chart with legend and custom bar sizes

View example of bar chart

Code to generate the chart:

BarChart chart = new BarChart(BarsType.Stacked, BarsDirection.Horizontal,
                         new ChartSize(350, 140),
                         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.BarChartSize = new BarChartSize(18, 1);

QR codes

View QR codes example

Code to generate the QR codes:

QRCodes chart = new QRCodes(new ChartSize(150, 150), "Hello world");

Comment by pa1gupta, Sep 18, 2008

I tried to add the reference dll in VS.Net 2003 /1.1 Frameworks. I get an error. Can anyone tell me if it is possible to add 2.0 compiled dll's to 1.1. Thank you in advance.


Sign in to add a comment
Hosted by Google Code