Spread Windows Forms 7.0 Product Documentation
SeriesDataField Constructor(FpSpread,String,String)
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.Chart Namespace > SeriesDataField Class > SeriesDataField Constructor : SeriesDataField Constructor(FpSpread,String,String)


spread
The spread.
name
The name.
formula
The formula.

Glossary Item Box

Initializes a new instance of the SeriesDataField class.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal spread As FpSpread, _
   ByVal name As String, _
   ByVal formula As String _
)
Visual Basic (Usage)Copy Code
Dim spread As FpSpread
Dim name As String
Dim formula As String
 
Dim instance As New SeriesDataField(spread, name, formula)
C# 
public SeriesDataField( 
   FpSpread spread,
   string name,
   string formula
)

Parameters

spread
The spread.
name
The name.
formula
The formula.

Example

This example sets the DataSource property for a chart.
C#Copy Code
private void Form1_Load(object sender, EventArgs e)
{
    fpSpread1.ActiveSheet.SetArray(0, 0, new Object[,] { { null, "A", "B", "C", "D", "E" } });
    fpSpread1.ActiveSheet.SetArray(1, 0, new Object[,] { { "S-1", 50, 25, 55, 30, 26 } });
    // datasource
    FarPoint.Win.Spread.Chart.SeriesDataField df1 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    FarPoint.Win.Spread.Chart.SeriesDataField df2 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    FarPoint.Win.Spread.Chart.SeriesDataField df3 = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2");
    // LineSeries
    FarPoint.Win.Chart.LineSeries series = new FarPoint.Win.Chart.LineSeries();
    series.SeriesNameDataSource = df1;
    series.CategoryNames.DataSource = df2;
    series.Values.DataSource = df3;
    // BarSeries
    FarPoint.Win.Chart.BarSeries bseries = new FarPoint.Win.Chart.BarSeries();
   
    // Set datasource again after resetting.
    FarPoint.Win.Spread.Chart.SeriesDataField df1b = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    FarPoint.Win.Spread.Chart.SeriesDataField df2b = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text);
    FarPoint.Win.Spread.Chart.SeriesDataField df3b = new FarPoint.Win.Spread.Chart.SeriesDataField(fpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2");
    bseries.SeriesNameDataSource = df1b;
    bseries.CategoryNames.DataSource = df2b;
    bseries.Values.DataSource = df3b;

    // PlotArea
    FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea();
    plotArea.Location = new PointF(0.2f, 0.2f);
    plotArea.Size = new SizeF(0.6f, 0.6f);
    plotArea.Series.Add(series);
    plotArea.Series.Add(bseries);

    // ChartModel
    FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
    model.PlotAreas.Add(plotArea);

    // SpreadChart
    FarPoint.Win.Spread.Chart.SpreadChart chart1 = new FarPoint.Win.Spread.Chart.SpreadChart();
    chart1.ChartName = "chart1";
    chart1.Size = new Size(200, 180);
    chart1.Location = new Point(0, 60);
    chart1.Model = model;

    fpSpread1.ActiveSheet.Charts.Clear();
    fpSpread1.ActiveSheet.Charts.Add(chart1);
}
VB.NETCopy Code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load       
FpSpread1.ActiveSheet.SetArray(0, 0, New [Object](,) {{Nothing, "A", "B", "C", "D", "E"}})
FpSpread1.ActiveSheet.SetArray(1, 0, New [Object](,) {{"S-1", 50, 25, 55, 30, 26}})
' datasource
Dim df1 As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
Dim df2 As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
Dim df3 As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2")
' LineSeries
Dim series As New FarPoint.Win.Chart.LineSeries()
series.SeriesNameDataSource = df1
series.CategoryNames.DataSource = df2
series.Values.DataSource = df3
' BarSeries
Dim bseries As New FarPoint.Win.Chart.BarSeries()

' Set datasource again after resetting.
Dim df1b As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldSeriesName", "Sheet1!$A$2:$A$2", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
Dim df2b As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldCategoryName", "Sheet1!$B$1:$F$1", FarPoint.Win.Spread.Chart.SegmentDataType.Text)
Dim df3b As New FarPoint.Win.Spread.Chart.SeriesDataField(FpSpread1, "DataFieldValue", "Sheet1!$B$2:$F$2")
bseries.SeriesNameDataSource = df1b
bseries.CategoryNames.DataSource = df2b
bseries.Values.DataSource = df3b

' PlotArea
Dim plotArea As New FarPoint.Win.Chart.YPlotArea()
plotArea.Location = New PointF(0.2F, 0.2F)
plotArea.Size = New SizeF(0.6F, 0.6F)
plotArea.Series.Add(series)
plotArea.Series.Add(bseries)

' ChartModel
Dim model As New FarPoint.Win.Chart.ChartModel()
model.PlotAreas.Add(plotArea)

' SpreadChart
Dim chart1 As New FarPoint.Win.Spread.Chart.SpreadChart()
chart1.ChartName = "chart1"
chart1.Size = New Size(200, 180)
chart1.Location = New Point(0, 60)
chart1.Model = model

FpSpread1.ActiveSheet.Charts.Clear()
FpSpread1.ActiveSheet.Charts.Add(chart1)
End Sub

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.