Dundas Chart for Windows Forms
DataBind Method
See Also  Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > DataPointCollection Class : DataBind Method


dataSource
The data source to bind the Chart to. Can be one of the following: Ole(SQL)DataReader, or DataView.
Data source.
xField
Name of the field used for X-values.
Name of the field for X values.
yFields
Comma separated name(s) of the field(s) used for Y-value(s).
Comma separated name(s) of the field(s) for Y value(s).
otherFields
Extended chart properties to bind to datasource (see below for further details).
Other point properties binding rule in format: PointProperty=Field[{Format}] [,PointProperty=Field[{Format}]]. For example: "Tooltip=Price{C1},Href=WebSiteName".

Data binds X-value, Y-value(s) and other extended chart properties such as Tooltip, Label, etc. . to the specified data source.


Data bind X, Y and other values (like Tooltip, Label,...) of the data points to the data source. Data source can be the Ole(SQL)DataReader, DataView, DataSet, DataTable or DataRow.

Syntax

Visual Basic (Declaration)  
Public Sub DataBind( _
   ByVal dataSource As IEnumerable, _
   ByVal xField As String, _
   ByVal yFields As String, _
   ByVal otherFields As String _
) 
Visual Basic (Usage) Copy Code
Dim instance As DataPointCollection
Dim dataSource As IEnumerable
Dim xField As String
Dim yFields As String
Dim otherFields As String
 
instance.DataBind(dataSource, xField, yFields, otherFields)
C#  
public void DataBind( 
   IEnumerable dataSource,
   string xField,
   string yFields,
   string otherFields
)

Parameters

dataSource
The data source to bind the Chart to. Can be one of the following: Ole(SQL)DataReader, or DataView.
Data source.
xField
Name of the field used for X-values.
Name of the field for X values.
yFields
Comma separated name(s) of the field(s) used for Y-value(s).
Comma separated name(s) of the field(s) for Y value(s).
otherFields
Extended chart properties to bind to datasource (see below for further details).
Other point properties binding rule in format: PointProperty=Field[{Format}] [,PointProperty=Field[{Format}]]. For example: "Tooltip=Price{C1},Href=WebSiteName".

Remarks

This method can be used to bind multiple Y-values and X-values to a datasource, as well as extended chart properties.

The datasource is iterated once per created series, which might result in a performance hit. If performance is critical use the DataBindXY method instead (note, however, that the DataBindXY method cannot bind to extended chart properties) or the DataBindCrossTab method.

Other data point properties besides X and Y-values can be bound using the otherFields parameter. The format is: PointProperty=Field[{Format}] [,PointProperty= Field[{Format}]]. For example:"Tooltip=Price{C1},Href=WebSiteName". A list of these properties are as follows: AxisLabelTooltipHrefLabelLegendText LegendTooltip and CustomAttributeName (the name of a custom attribute).

Note: We highly recommend reading the Data Binding topic for help in determining how to bind your data.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.