Edit

Share via


DataManipulator.Sort Method

Definition

Performs a custom sort on the data points in one or more series.

Overloads

Sort(PointSortOrder, String, String)

Performs a sort on the data points in one or more series, using the specified order. The sort can be based on any available data point value.

Sort(IComparer<DataPoint>, String)

Performs a custom sort on the data points in one or more series.

Sort(IComparer<DataPoint>, Series)

Performs a custom sort on the data points in a series.

Sort(PointSortOrder, String)

Performs a sort on the data points in one or more series, using the specified order. The sort is based on the first Y-value of each of the data points.

Sort(PointSortOrder, Series)

Performs a sort on the data points in a series using the specified order. The sort is based on the first Y-value of each of the data points.

Sort(PointSortOrder, String, Series)

Performs a sort on the data points in a series using the specified order. The sort can be based on any available data point value.

Sort(PointSortOrder, String, String)

Performs a sort on the data points in one or more series, using the specified order. The sort can be based on any available data point value.

public:
 void Sort(System::Windows::Forms::DataVisualization::Charting::PointSortOrder pointSortOrder, System::String ^ sortBy, System::String ^ seriesName);
public void Sort (System.Windows.Forms.DataVisualization.Charting.PointSortOrder pointSortOrder, string sortBy, string seriesName);
member this.Sort : System.Windows.Forms.DataVisualization.Charting.PointSortOrder * string * string -> unit
Public Sub Sort (pointSortOrder As PointSortOrder, sortBy As String, seriesName As String)

Parameters

pointSortOrder
PointSortOrder

A PointSortOrder enumeration value that determines if the sort is ascending or descending.

sortBy
String

A string value that represents the data point values to be sorted. Possible values are: "X", "Y", "Y2", "Y3", "AxisLabel", and so forth.

seriesName
String

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

Remarks

This method performs an ascending or descending sort on data points in a series, and is based on the value that is set in the sortBy parameter such as "X", "AxisLabel", "Y", "Y1", and so forth.

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

Important

All series will be sorted using the specified Y-value from the FIRST listed series; that is, all data points, regardless of the series they belong to, are sorted based on the first series.

To sort points using a custom sort routine, use a different definition of this overloaded method.

Applies to

Sort(IComparer<DataPoint>, String)

Performs a custom sort on the data points in one or more series.

public:
 void Sort(System::Collections::Generic::IComparer<System::Windows::Forms::DataVisualization::Charting::DataPoint ^> ^ comparer, System::String ^ seriesName);
public void Sort (System.Collections.Generic.IComparer<System.Windows.Forms.DataVisualization.Charting.DataPoint> comparer, string seriesName);
member this.Sort : System.Collections.Generic.IComparer<System.Windows.Forms.DataVisualization.Charting.DataPoint> * string -> unit
Public Sub Sort (comparer As IComparer(Of DataPoint), seriesName As String)

Parameters

comparer
IComparer<DataPoint>

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

seriesName
String

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

Remarks

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.

Important

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.

Applies to

Sort(IComparer<DataPoint>, Series)

Performs a custom sort on the data points in a series.

public:
 void Sort(System::Collections::Generic::IComparer<System::Windows::Forms::DataVisualization::Charting::DataPoint ^> ^ comparer, System::Windows::Forms::DataVisualization::Charting::Series ^ series);
public void Sort (System.Collections.Generic.IComparer<System.Windows.Forms.DataVisualization.Charting.DataPoint> comparer, System.Windows.Forms.DataVisualization.Charting.Series series);
member this.Sort : System.Collections.Generic.IComparer<System.Windows.Forms.DataVisualization.Charting.DataPoint> * System.Windows.Forms.DataVisualization.Charting.Series -> unit
Public Sub Sort (comparer As IComparer(Of DataPoint), series As Series)

Parameters

comparer
IComparer<DataPoint>

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

series
Series

The Series object to be sorted.

Remarks

This method performs a custom sort on the data points in a 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.

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

To perform a custom sort for more than one series per function call, use the Sort method.

Applies to

Sort(PointSortOrder, String)

Performs a sort on the data points in one or more series, using the specified order. The sort is based on the first Y-value of each of the data points.

public:
 void Sort(System::Windows::Forms::DataVisualization::Charting::PointSortOrder pointSortOrder, System::String ^ seriesName);
public void Sort (System.Windows.Forms.DataVisualization.Charting.PointSortOrder pointSortOrder, string seriesName);
member this.Sort : System.Windows.Forms.DataVisualization.Charting.PointSortOrder * string -> unit
Public Sub Sort (pointSortOrder As PointSortOrder, seriesName As String)

Parameters

pointSortOrder
PointSortOrder

A PointSortOrder enumeration value that determines if the sort is ascending or descending.

seriesName
String

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

Applies to

Sort(PointSortOrder, Series)

Performs a sort on the data points in a series using the specified order. The sort is based on the first Y-value of each of the data points.

public:
 void Sort(System::Windows::Forms::DataVisualization::Charting::PointSortOrder pointSortOrder, System::Windows::Forms::DataVisualization::Charting::Series ^ series);
public void Sort (System.Windows.Forms.DataVisualization.Charting.PointSortOrder pointSortOrder, System.Windows.Forms.DataVisualization.Charting.Series series);
member this.Sort : System.Windows.Forms.DataVisualization.Charting.PointSortOrder * System.Windows.Forms.DataVisualization.Charting.Series -> unit
Public Sub Sort (pointSortOrder As PointSortOrder, series As Series)

Parameters

pointSortOrder
PointSortOrder

A PointSortOrder enumeration value that determines if the sort is ascending or descending.

series
Series

The Series object to be sorted.

Applies to

Sort(PointSortOrder, String, Series)

Performs a sort on the data points in a series using the specified order. The sort can be based on any available data point value.

public:
 void Sort(System::Windows::Forms::DataVisualization::Charting::PointSortOrder pointSortOrder, System::String ^ sortBy, System::Windows::Forms::DataVisualization::Charting::Series ^ series);
public void Sort (System.Windows.Forms.DataVisualization.Charting.PointSortOrder pointSortOrder, string sortBy, System.Windows.Forms.DataVisualization.Charting.Series series);
member this.Sort : System.Windows.Forms.DataVisualization.Charting.PointSortOrder * string * System.Windows.Forms.DataVisualization.Charting.Series -> unit
Public Sub Sort (pointSortOrder As PointSortOrder, sortBy As String, series As Series)

Parameters

pointSortOrder
PointSortOrder

A PointSortOrder enumeration value that determines if the sort is ascending or descending.

sortBy
String

A string value that represents the data point values to be sorted. Possible values are: "X", "Y", "Y2", "Y3", "AxisLabel", and so forth.

series
Series

The Series object to be sorted.

Applies to