Spread for ASP.NET 7.0 Product Documentation
DataField Property
See Also  Example Support Options
FarPoint.Web.Chart Assembly > FarPoint.Web.Chart Namespace > DoubleCollection Class : DataField Property


Glossary Item Box

Gets or sets the field in the data source that supplies the double values.

Syntax

Visual Basic (Declaration) 
Public Property DataField As String
Visual Basic (Usage)Copy Code
Dim instance As DoubleCollection
Dim value As String
 
instance.DataField = value
 
value = instance.DataField
C# 
public string DataField {get; set;}

Exceptions

ExceptionDescription
System.ArgumentNullException value is a null reference (Nothing in VB).

Example

This example sets the DataField property.
C#Copy Code
System.Data.DataTable dt = new System.Data.DataTable("Test");
System.Data.DataRow dr = default(System.Data.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.Web.Chart.BarSeries series = new FarPoint.Web.Chart.BarSeries();
series.Values.DataSource = dt;
series.Values.DataField = dt.Columns[0].ColumnName;
FarPoint.Web.Chart.YPlotArea plotArea = new FarPoint.Web.Chart.YPlotArea();
FarPoint.Web.Chart.ChartModel model = new FarPoint.Web.Chart.ChartModel();
plotArea.Location = new System.Drawing.PointF(0.2F, 0.2F);
plotArea.Size = new System.Drawing.SizeF(0.6F, 0.6F);
plotArea.Series.Add(series);
model.PlotAreas.Add(plotArea);
FarPoint.Web.Spread.Chart.SpreadChart chart = new FarPoint.Web.Spread.Chart.SpreadChart();
chart.Model = model;
FpSpread1.Sheets[0].Charts.Add(chart);
Visual BasicCopy Code
Dim dt As New System.Data.DataTable("Test")
Dim dr As System.Data.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.Web.Chart.BarSeries
series.Values.DataSource = dt
series.Values.DataField = dt.Columns(0).ColumnName
Dim model As New FarPoint.Web.Chart.ChartModel()
Dim plotArea As New FarPoint.Web.Chart.YPlotArea()
plotArea.Location = New System.Drawing.PointF(0.2F, 0.2F)
plotArea.Size = New System.Drawing.SizeF(0.6F, 0.6F)
plotArea.Series.Add(series)
model.PlotAreas.Add(plotArea)
Dim chart As New FarPoint.Web.Spread.Chart.SpreadChart()
chart.Model = model
FpSpread1.Sheets(0).Charts.Add(chart)

Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

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