Spread Windows Forms 12.0 Product Documentation
DataField Property (DoubleCollection)
Example 


FarPoint.Win.Chart Assembly > FarPoint.Win.Chart Namespace > DoubleCollection Class : DataField Property
Gets or sets the field in the data source that supplies the double values.
Syntax
'Declaration
 
Public Property DataField As String
'Usage
 
Dim instance As DoubleCollection
Dim value As String
 
instance.DataField = value
 
value = instance.DataField
public string DataField {get; set;}
Exceptions
ExceptionDescription
value is a null reference (Nothing in VB).
Example
This example sets the DataField property.
DataTable dt = new DataTable("Test");
DataRow dr = default(DataRow);
dt.Columns.Add("Series0");
dt.Columns.Add("Series1");
dr = dt.NewRow();
dr[0] = 2;
dr[1] = 1;
dt.Rows.Add(dr);    
dr = dt.NewRow();
dr[0] = 4;
dr[1] = 2;
dt.Rows.Add(dr);    
dr = dt.NewRow();
dr[0] = 3;
dr[1] = 4;

FarPoint.Win.Chart.BarSeries series = new FarPoint.Win.Chart.BarSeries();
series.Values.DataSource = dt;
series.Values.DataField = dt.Columns[0].ColumnName;
FarPoint.Win.Chart.YPlotArea plotArea = new FarPoint.Win.Chart.YPlotArea();
FarPoint.Win.Chart.ChartModel model = new FarPoint.Win.Chart.ChartModel();
plotArea.Location = new PointF(0.2F, 0.2F);
plotArea.Size = new SizeF(0.6F, 0.6F);
plotArea.Series.Add(series);
model.PlotAreas.Add(plotArea);

fpChart1.Model = model;
Dim dt As New DataTable("Test")
Dim dr As DataRow
dt.Columns.Add("Series0")
dt.Columns.Add("Series1")
dr = dt.NewRow()
dr(0) = 2
dr(1) = 1
dt.Rows.Add(dr)

dr = dt.NewRow()
dr(0) = 4
dr(1) = 2
dt.Rows.Add(dr)

dr = dt.NewRow()
dr(0) = 3
dr(1) = 4
dt.Rows.Add(dr)

Dim series As New FarPoint.Win.Chart.BarSeries
series.Values.DataSource = dt
series.Values.DataField = dt.Columns(0).ColumnName
Dim model As New FarPoint.Win.Chart.ChartModel()
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)
model.PlotAreas.Add(plotArea)
FpChart1.Model = model
See Also

Reference

DoubleCollection Class
DoubleCollection Members