Spread Silverlight Documentation
Adding a Surface Chart
Spread Silverlight Documentation > Developer's Guide > Working with Charts > Creating Charts > Creating Chart Types > Adding a Surface Chart

You can create different types of surface charts such as Surface, SurfaceContour, SurfaceWireFrameContour, and SurfaceWireFrame.

Using Code

The following code creates a surface chart.

  1. Create values with the SpreadDataSeries class.
  2. Use the SpreadSurfaceChart class to create a chart and set the type.
  3. Add the series.
  4. Add the chart to the sheet.
CS
Copy Code
GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries ds1 = new GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries();
ds1.Values = new GrapeCity.Windows.SpreadSheet.Data.DoubleSeriesCollection();
ds1.Values.Add(2);
ds1.Values.Add(3);
ds1.Values.Add(5);
GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries ds2 = new GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries();
ds2.Values = new GrapeCity.Windows.SpreadSheet.Data.DoubleSeriesCollection();
ds2.Values.Add(3);
ds2.Values.Add(6);
ds2.Values.Add(4);
GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries ds3 = new GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries();
ds3.Values = new GrapeCity.Windows.SpreadSheet.Data.DoubleSeriesCollection();
ds3.Values.Add(5);
ds3.Values.Add(1);
ds3.Values.Add(3);
GrapeCity.Windows.SpreadSheet.Data.SpreadSurfaceChart schart = new GrapeCity.Windows.SpreadSheet.Data.SpreadSurfaceChart("SChart", GrapeCity.Windows.SpreadSheet.Data.SpreadSurfaceChartType.Surface, 0, 0, 300, 300);
schart.DataSeries.Add(ds1);
schart.DataSeries.Add(ds2);
schart.DataSeries.Add(ds3);
this.gcSpreadSheet1.ActiveSheet.SurfaceCharts.Add(schart);
VB.NET
Copy Code
Dim ds1 As New GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries()
ds1.Values = New GrapeCity.Windows.SpreadSheet.Data.DoubleSeriesCollection()
ds1.Values.Add(2)
ds1.Values.Add(3)
ds1.Values.Add(5)
Dim ds2 As New GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries()
ds2.Values = New GrapeCity.Windows.SpreadSheet.Data.DoubleSeriesCollection()
ds2.Values.Add(3)
ds2.Values.Add(6)
ds2.Values.Add(4)
Dim ds3 As New GrapeCity.Windows.SpreadSheet.Data.SpreadDataSeries()
ds3.Values = New GrapeCity.Windows.SpreadSheet.Data.DoubleSeriesCollection()
ds3.Values.Add(5)
ds3.Values.Add(1)
ds3.Values.Add(3)
Dim schart As New GrapeCity.Windows.SpreadSheet.Data.SpreadSurfaceChart("SChart", GrapeCity.Windows.SpreadSheet.Data.SpreadSurfaceChartType.Surface, 0, 0, 300, 300)
schart.DataSeries.Add(ds1)
schart.DataSeries.Add(ds2)
schart.DataSeries.Add(ds3)
GcSpreadSheet1.ActiveSheet.SurfaceCharts.Add(schart)
See Also