DataManipulator.Sort Method (IComparer<DataPoint>, String)

.NET Framework (current version)

Performs a custom sort on one or more series.

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

public void Sort(
	IComparer<DataPoint> comparer,
	string seriesName


Type: System.Collections.Generic.IComparer<DataPoint>

An object that implements the IComparer interface and provides the custom sorting logic.

Type: System.String

A comma-separated list of names of the Series to be sorted.

This method performs a custom sort on the data points in one or more series; the sort logic is defined by the comparer parameter. Override and implement the Compare method of the IComparer interface, perform the comparison(s) and then return true or false. The sort order is determined by the return value.

Note that if multiple series are sorted, the series must be aligned, otherwise an exception will be thrown.

The two object parameters of the Compare method must always be of type DataPoint.


All data points, regardless of the series they belong to, are sorted based on the first series; if the position of a data point in the first series changes, all corresponding points in the other series change as well.

.NET Framework
Available since 4.0
Return to top