DataPointCollection.DataBindY Method (IEnumerable, String)

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Data binds the Y-value(s) of the data points to the specified column(s) of the specified data source.

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

public void DataBindY(
	IEnumerable yValue,
	string yFields
)

Parameters

yValue
Type: System.Collections.IEnumerable

An IEnumerable<T> data source object that provides the Y-value(s).

yFields
Type: System.String

The data source field(s) to which to bind data point(s). Note that a comma can be embedded as part of a column name, by using a double comma.

This method binds the Y-values of the data points in the collection to the specified fields(s) of the data source.

To bind only to the first field in a data source, use the DataBindY method.

You can bind to several fields by setting the yFields parameter to multiple field names that are comma-separated. Note that the first field will be used for the data point's first Y-value, the second named field will be used for the data point's second Y-value, and so forth.

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 data source:

  • 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: