DataManipulator.Sort 方法

定义

对一个或多个序列中的数据点执行自定义排序。Performs a custom sort on the data points in one or more series.

重载

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. 基于每个数据点的第一个 Y 值进行排序。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. 基于每个数据点的第一个 Y 值进行排序。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)

参数

pointSortOrder
PointSortOrder

一个 PointSortOrder 枚举值,确定排序是升序还是降序。A PointSortOrder enumeration value that determines if the sort is ascending or descending.

sortBy
String

一个 string 值,该值表示要排序的数据点值。A string value that represents the data point values to be sorted. 可能的值为“X”、“Y”、“Y2”、“Y3”、“AxisLabel”等。Possible values are: "X", "Y", "Y2", "Y3", "AxisLabel", and so forth.

seriesName
String

要排序的 Series 的名称的逗号分隔列表。A comma-separated list of names of the Series to be sorted.

注解

此方法对序列中的数据点执行升序或降序排序,基于在参数中设置的值, sortBy 例如 "X"、"AxisLabel"、"Y"、"Y1" 等。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.

重要

所有序列都将使用第一个列出的系列中的指定 Y 值进行排序;也就是说,将根据第一个序列对所有数据点进行排序,而不考虑它们所属的序列。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.

适用于

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)

参数

comparer
IComparer<DataPoint>

一个对象,该对象实现 IComparer 接口并提供自定义排序逻辑。An object that implements the IComparer interface and provides the custom sorting logic.

seriesName
String

要排序的 Series 的名称的逗号分隔列表。A comma-separated list of names of the Series to be sorted.

注解

此方法对一个或多个序列中的数据点执行自定义排序;排序逻辑由 comparer 参数定义。This method performs a custom sort on the data points in one or more series; the sort logic is defined by the comparer parameter. 重写并实现 Compare 接口的方法 IComparer ,执行) (比较,然后返回 truefalseOverride 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.

此方法的两个对象参数 Compare 必须始终为类型 DataPointThe 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.

适用于

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)

参数

comparer
IComparer<DataPoint>

一个对象,该对象实现 IComparer 接口并提供自定义排序逻辑。An object that implements the IComparer interface and provides the custom sorting logic.

series
Series

要排序的 Series 对象。The Series object to be sorted.

注解

此方法对序列中的数据点执行自定义排序。排序逻辑由 comparer 参数定义。This method performs a custom sort on the data points in a series; the sort logic is defined by the comparer parameter. 重写并实现 Compare 接口的方法 IComparer ,执行) (比较,然后返回 truefalseOverride 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.

此方法的两个对象参数 Compare 必须始终为类型 DataPointThe two object parameters of the Compare method must always be of type DataPoint.

若要对每个函数调用的多个序列执行自定义排序,请使用 Sort 方法。To perform a custom sort for more than one series per function call, use the Sort method.

适用于

Sort(PointSortOrder, String)

使用指定顺序对一个或多个序列中的数据点进行排序。Performs a sort on the data points in one or more series, using the specified order. 基于每个数据点的第一个 Y 值进行排序。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)

参数

pointSortOrder
PointSortOrder

一个 PointSortOrder 枚举值,确定排序是升序还是降序。A PointSortOrder enumeration value that determines if the sort is ascending or descending.

seriesName
String

要排序的 Series 的名称的逗号分隔列表。A comma-separated list of names of the Series to be sorted.

适用于

Sort(PointSortOrder, Series)

使用指定顺序对序列中的数据点进行排序。Performs a sort on the data points in a series using the specified order. 基于每个数据点的第一个 Y 值进行排序。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)

参数

pointSortOrder
PointSortOrder

一个 PointSortOrder 枚举值,确定排序是升序还是降序。A PointSortOrder enumeration value that determines if the sort is ascending or descending.

series
Series

要排序的 Series 对象。The Series object to be sorted.

适用于

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)

参数

pointSortOrder
PointSortOrder

一个 PointSortOrder 枚举值,确定排序是升序还是降序。A PointSortOrder enumeration value that determines if the sort is ascending or descending

sortBy
String

一个 string 值,该值表示要排序的数据点值。A string value that represents the data point values to be sorted. 可能的值为“X”、“Y”、“Y2”、“Y3”、“AxisLabel”等。Possible values are: "X", "Y", "Y2", "Y3", "AxisLabel", and so forth.

series
Series

要排序的 Series 对象。The Series object to be sorted.

适用于