Dundas Chart for Windows Forms
DataBindXY(IEnumerable,IEnumerable[]) Method
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > DataPointCollection Class > DataBindXY Method : DataBindXY(IEnumerable,IEnumerable[]) Method


xValue

The data source that will supply the X-values for the data points. The first available column will be used.


The datasource that will supply the X-values for the data points. The first available column will be used.


Enumerable objects with X values.
yValues
The Y-value(s) of the DataPoint object added to the collection (one or more comma-separated values).
One or more enumerable objects with Y values.

Data binds the X-value and Y-values of the collection's data points to the specified data source's first columns.


The Y-value(s) of the DataPoint object added to the collection (one or more comma-separated values).


The Y-value(s) of the DataPoint object added to the collection (one or more comma-separated values).


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

Syntax

Visual Basic (Declaration)  
Public Overloads Sub DataBindXY( _
   ByVal xValue As IEnumerable, _
   ByVal ParamArray yValues() As IEnumerable _
) 
Visual Basic (Usage) Copy Code
Dim instance As DataPointCollection
Dim xValue As IEnumerable
Dim yValues() As IEnumerable
 
instance.DataBindXY(xValue, yValues)
C#  
public void DataBindXY( 
   IEnumerable xValue,
   params IEnumerable[] yValues
)

Parameters

xValue

The data source that will supply the X-values for the data points. The first available column will be used.


The datasource that will supply the X-values for the data points. The first available column will be used.


Enumerable objects with X values.
yValues
The Y-value(s) of the DataPoint object added to the collection (one or more comma-separated values).
One or more enumerable objects with Y values.

Example

C# Copy Code
using Dundas.Charting.WinControl;
...

// Initialize an array of doubles
double [] yval = { 2,6,4,5,3};

// Initialize an array of string
string [] xval = { "Peter", "Andrew", "Julie", "Mary", "Dave"};

// Bind the double array to the Y axis points of the Default data series
chart1.Series["Series 1"].Points.DataBindXY(xval,yval);

...  
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

' Initialize an array of doubles
Dim yval As Double() = {2, 6, 4, 5, 3}

' Initialize an array of string
Dim xval As String() = {"Peter", "Andrew", "Julie", "Mary", "Dave"}

' Bind the double array to the Y axis points of the Default data series
Chart1.Series("Series 1").Points.DataBindXY(xval, yval)

...

Remarks

This method binds all DataPoint objects in a Series, and uses separate data sources for the X and Y-value(s).

Note that the first available column in the data source will be used if data-binding to a table. To bind to a column that is not the first use the DataBindXY (IEnumerable,string,IEnumerable,string) method.

You can bind to multiple Y-values by providing a comma-separated list of IEnumerable objects for the yValue[] parameter.

If Y-values are not provided by the data source, or the wrong number of values are provided an exception will be thrown.

The following is a list of objects that you can use as the datasource parameter:

  • DataView

  • Data readers (SQL, OleDB)

  • Arrays

  • Lists

  • All other objects that use the IEnumerable interface

If you do not want to display scatter-type plots (both X and Y-values used) then use one of the DataBindY methods instead.

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

IMPORTANT: With the Professional version of the chart there will not be data points for any missing records (i.e. a missing record is just skipped). However, with the Enterprise version of the chart missing records will have corresponding data points that have a value of DBNULL.

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.