Spread Silverlight Documentation
AddChart(String,SpreadChartType,String,String,String,Int32,Double,Int32,Double,Double,Double) Method
Example 


GrapeCity.Windows.SpreadSheet.Data Namespace > Worksheet Class > AddChart Method : AddChart(String,SpreadChartType,String,String,String,Int32,Double,Int32,Double,Double,Double) Method
The name of the chart.
Type of the chart.
The items label formula.
The name formula.
The data formula.
The row.
The row offset.
The column.
The column offset.
The width.
The height.
Adds the chart.
Syntax
'Declaration
 
Public Overloads Function AddChart( _
   ByVal name As System.String, _
   ByVal chartType As SpreadChartType, _
   ByVal itemsFormula As System.String, _
   ByVal nameFormula As System.String, _
   ByVal dataFormula As System.String, _
   ByVal row As System.Integer, _
   ByVal rowOffset As System.Double, _
   ByVal column As System.Integer, _
   ByVal columnOffset As System.Double, _
   ByVal width As System.Double, _
   ByVal height As System.Double _
) As SpreadChart
'Usage
 
Dim instance As Worksheet
Dim name As System.String
Dim chartType As SpreadChartType
Dim itemsFormula As System.String
Dim nameFormula As System.String
Dim dataFormula As System.String
Dim row As System.Integer
Dim rowOffset As System.Double
Dim column As System.Integer
Dim columnOffset As System.Double
Dim width As System.Double
Dim height As System.Double
Dim value As SpreadChart
 
value = instance.AddChart(name, chartType, itemsFormula, nameFormula, dataFormula, row, rowOffset, column, columnOffset, width, height)
public SpreadChart AddChart( 
   System.string name,
   SpreadChartType chartType,
   System.string itemsFormula,
   System.string nameFormula,
   System.string dataFormula,
   System.int row,
   System.double rowOffset,
   System.int column,
   System.double columnOffset,
   System.double width,
   System.double height
)

Parameters

name
The name of the chart.
chartType
Type of the chart.
itemsFormula
The items label formula.
nameFormula
The name formula.
dataFormula
The data formula.
row
The row.
rowOffset
The row offset.
column
The column.
columnOffset
The column offset.
width
The width.
height
The height.
Remarks
The row parameter represents the start row index and column represents the start column index. This method will auto detect a cell range based on these two indexes. The chartType parameter indicates which type of chart will be added. The width and height parameters specify the size of the chart.
Example
This example creates a chart.
gcSpreadSheet1.Sheets[0].Cells[0, 1].Value = "c1";
gcSpreadSheet1.Sheets[0].Cells[0, 2].Value = "c2";
gcSpreadSheet1.Sheets[0].Cells[0, 3].Value = "c3";
gcSpreadSheet1.Sheets[0].Cells[1, 0].Value = "s1";
gcSpreadSheet1.Sheets[0].Cells[2, 0].Value = "s2";
gcSpreadSheet1.Sheets[0].Cells[3, 0].Value = "s3";
gcSpreadSheet1.Sheets[0].Cells[4, 0].Value = "s4";
gcSpreadSheet1.Sheets[0].Cells[5, 0].Value = "s5";
gcSpreadSheet1.Sheets[0].Cells[6, 0].Value = "s6";
gcSpreadSheet1.Sheets[0].Cells[1, 1].Value = 1;
gcSpreadSheet1.Sheets[0].Cells[2, 1].Value = 2;
gcSpreadSheet1.Sheets[0].Cells[3, 1].Value = 3;
gcSpreadSheet1.Sheets[0].Cells[4, 1].Value = 4;
gcSpreadSheet1.Sheets[0].Cells[5, 1].Value = 5;
gcSpreadSheet1.Sheets[0].Cells[6, 1].Value = 6;
gcSpreadSheet1.Sheets[0].Cells[1, 2].Value = 7;
gcSpreadSheet1.Sheets[0].Cells[2, 2].Value = 8;
gcSpreadSheet1.Sheets[0].Cells[3, 2].Value = 9;
gcSpreadSheet1.Sheets[0].Cells[4, 2].Value = 10;
gcSpreadSheet1.Sheets[0].Cells[5, 2].Value = 11;
gcSpreadSheet1.Sheets[0].Cells[6, 2].Value = 12;
gcSpreadSheet1.Sheets[0].Cells[1, 3].Value = 13;
gcSpreadSheet1.Sheets[0].Cells[2, 3].Value = 14;
gcSpreadSheet1.Sheets[0].Cells[3, 3].Value = 15;
gcSpreadSheet1.Sheets[0].Cells[4, 3].Value = 16;
gcSpreadSheet1.Sheets[0].Cells[5, 3].Value = 17;
gcSpreadSheet1.Sheets[0].Cells[6, 3].Value = 18;
//gcSpreadSheet1.Sheets[0].AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Bubble, "Sheet1!$A$1:$D$7", 0, 0, 400, 300);
//gcSpreadSheet1.Sheets[0].AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.BarStacked, 0, 0, 350, 250);
gcSpreadSheet1.Sheets[0].AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.ColumnStacked, "Sheet1!$A$2:$A$7", "Sheet1!$B$1:$D$1", "Sheet1!$A$1:$D$7", 0, 0, 400, 300);
//gcSpreadSheet1.Sheets[0].AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Area, "Sheet1!$A$1:$D$7", 1, 1, 1, 1, 5, 5, 5, 5);
//gcSpreadSheet1.Sheets[0].AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Area, "Sheet1!$A$1:$D$7", 1, 1, 1, 1, 400, 350);
//gcSpreadSheet1.Sheets[0].AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Area, "Sheet1!$A$2:$A$7", "Sheet1!$B$1:$D$1", "Sheet1!$A$1:$D$7", 1, 1, 1, 1, 400, 350);
GcSpreadSheet1.Sheets(0).Cells(0, 1).Value = "c1"
GcSpreadSheet1.Sheets(0).Cells(0, 2).Value = "c2"
GcSpreadSheet1.Sheets(0).Cells(0, 3).Value = "c3"
GcSpreadSheet1.Sheets(0).Cells(1, 0).Value = "s1"
GcSpreadSheet1.Sheets(0).Cells(2, 0).Value = "s2"
GcSpreadSheet1.Sheets(0).Cells(3, 0).Value = "s3"
GcSpreadSheet1.Sheets(0).Cells(4, 0).Value = "s4"
GcSpreadSheet1.Sheets(0).Cells(5, 0).Value = "s5"
GcSpreadSheet1.Sheets(0).Cells(6, 0).Value = "s6"
GcSpreadSheet1.Sheets(0).Cells(1, 1).Value = 1
GcSpreadSheet1.Sheets(0).Cells(2, 1).Value = 2
GcSpreadSheet1.Sheets(0).Cells(3, 1).Value = 3
GcSpreadSheet1.Sheets(0).Cells(4, 1).Value = 4
GcSpreadSheet1.Sheets(0).Cells(5, 1).Value = 5
GcSpreadSheet1.Sheets(0).Cells(6, 1).Value = 6
GcSpreadSheet1.Sheets(0).Cells(1, 2).Value = 7
GcSpreadSheet1.Sheets(0).Cells(2, 2).Value = 8
GcSpreadSheet1.Sheets(0).Cells(3, 2).Value = 9
GcSpreadSheet1.Sheets(0).Cells(4, 2).Value = 10
GcSpreadSheet1.Sheets(0).Cells(5, 2).Value = 11
GcSpreadSheet1.Sheets(0).Cells(6, 2).Value = 12
GcSpreadSheet1.Sheets(0).Cells(1, 3).Value = 13
GcSpreadSheet1.Sheets(0).Cells(2, 3).Value = 14
GcSpreadSheet1.Sheets(0).Cells(3, 3).Value = 15
GcSpreadSheet1.Sheets(0).Cells(4, 3).Value = 16
GcSpreadSheet1.Sheets(0).Cells(5, 3).Value = 17
GcSpreadSheet1.Sheets(0).Cells(6, 3).Value = 18
'GcSpreadSheet1.Sheets(0).AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Bubble, "Sheet1!$A$1:$D$7", 0, 0, 400, 300)
'GcSpreadSheet1.Sheets(0).AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.BarStacked, 0, 0, 400, 300)
GcSpreadSheet1.Sheets(0).AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.ColumnStacked, "Sheet1!$A$2:$A$7", "Sheet1!$B$1:$D$1", "Sheet1!$A$1:$D$7", 0, 0, 400, 300)
'GcSpreadSheet1.Sheets(0).AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Area, "Sheet1!$A$1:$D$7", 1, 1, 1, 1, 400, 350)
'GcSpreadSheet1.Sheets(0).AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Area, "Sheet1!$A$2:$A$7", "Sheet1!$B$1:$D$1", "Sheet1!$A$1:$D$7", 1, 1, 1, 1, 400, 350)
'GcSpreadSheet1.Sheets(0).AddChart("Chart", GrapeCity.Windows.SpreadSheet.Data.SpreadChartType.Area, "Sheet1!$A$1:$D$7", 1, 1, 1, 1, 5, 5, 5, 5)
See Also

Reference

Worksheet Class
Worksheet Members
Overload List