DataPointCollection.DataBindXY Method (IEnumerable, String, IEnumerable, String)

.NET Framework (current version)
 

Data binds the X-value and Y-values of the data points in the collection to the specified columns of the specified data sources.

Namespace:   System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)

public void DataBindXY(
	IEnumerable xValue,
	string xField,
	IEnumerable yValue,
	string yFields
)

Parameters

xValue
Type: System.Collections.IEnumerable

The data source that will supply the X-values for the data points.

xField
Type: System.String

The name of the column that will supply the X-values for the data points.

yValue
Type: System.Collections.IEnumerable

A comma-separated list of the Y-value(s) of the DataPoint object added to the collection.

yFields
Type: System.String

A comma-separated list of column name(s) that will supply the Y-values for the data points. Note that a comma can be embedded as part of a column name, by using a double comma.

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

You can bind to several Y-values by setting the yFields parameter to multiple column names. Separate the column names with commas.

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

If you do not want to display scatter-type plots, in which both X and Y-values are used, use one of the DataBindY methods instead.

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

  • DataView

  • Data readers (SQL, OleDB)

  • Arrays

  • Lists

  • All other objects that use the IEnumerable<T> interface.

.NET Framework
Available since 4.0
Return to top
Show: