Spread for ASP.NET 9.0 Product Documentation
Binding the Chart Control with Spread

You can bind the Chart control to data in the Spread control with the formula parameters in the SpreadChart constructor. The constructor uses formula syntax to specify the cell range.

You can also bind the Chart control in Spread with the CategoryFormula, DataFormula, Formula, or SeriesNameFormula properties.

Using Code

Add values to the cells and then use the formula parameters in the SpreadChart constructor to create the Chart control.

Example

The following example uses the SpreadChart constructor to create a Chart control.

C#
Copy Code
FpSpread1.Sheets[0].RowCount = 10;
FpSpread1.Sheets[0].ColumnCount = 10;
FpSpread1.Sheets[0].Cells[0, 0].Value = 3;
FpSpread1.Sheets[0].Cells[1, 1].Value = 7;
FpSpread1.Sheets[0].Cells[2, 2].Value = 7;
FpSpread1.Sheets[0].Cells[3, 3].Value = 5;
FarPoint.Web.Spread.Chart.SpreadChart chart = new FarPoint.Web.Spread.Chart.SpreadChart("Sheet1!$A$2:$A$7", "Sheet1!$B$1:$D$1", "Sheet1!$B$2:$D$7", typeof(FarPoint.Web.Chart.BarSeries));
FpSpread1.Sheets[0].Charts.Add(chart);
VB
Copy Code
FpSpread1.Sheets(0).RowCount = 10
FpSpread1.Sheets(0).ColumnCount = 10
FpSpread1.Sheets(0).Cells(0, 0).Value = 3
FpSpread1.Sheets(0).Cells(1, 1).Value = 7
FpSpread1.Sheets(0).Cells(2, 2).Value = 7
FpSpread1.Sheets(0).Cells(3, 3).Value = 5
Dim chart As New FarPoint.Web.Spread.Chart.SpreadChart("Sheet1!$A$2:$A$7", "Sheet1!$B$1:$D$1", "Sheet1!$B$2:$D$7", GetType(FarPoint.Web.Chart.BarSeries))
FpSpread1.Sheets(0).Charts.Add(chart)
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback