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


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
System.ArgumentNullException 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
Requirements

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

See Also

Reference

DoubleCollection Class
DoubleCollection Members

 

 


Copyright © GrapeCity, inc. All rights reserved.