Spread Silverlight Documentation
Adding a Bar Chart

You can create many different types of bar charts such as BarClustered, BarStacked, BarStacked100pc, BarStacked100pc3D, and BarStacked3D. The following image displays a stacked bar chart.

Using Code

The following sample creates a stacked bar chart.

  1. Create values and add the values to the control with the SetArray method.
  2. Create a chart and specify the chart type with the SpreadChart class. 
  3. Add the chart using the Charts property.
CS
Copy Code
GrapeCity.Windows.SpreadSheet.Data.SpreadChart chart = new GrapeCity.Windows.SpreadSheet.Data.SpreadChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.BarStacked, "Sheet1!$A$1:$A$7", 0, 0, 200, 200);
gcSpreadSheet1.ActiveSheet.SetArray(0, 0, new object[,] { { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 }, { 8 }, { 9 }, { 10 } });
gcSpreadSheet1.ActiveSheet.Charts.Add(chart);
VB.NET
Copy Code
Dim chart As New GrapeCity.Windows.SpreadSheet.Data.SpreadChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.BarStacked, "Sheet1!$A$1:$A$7", 0, 0, 200, 200)
GcSpreadSheet1.ActiveSheet.SetArray(0, 0, New Object(,) {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}})
GcSpreadSheet1.ActiveSheet.Charts.Add(chart)

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback