Back to Devexpress

Sorting Data

windowsforms-6173-controls-and-libraries-chart-control-data-representation-sorting-data.md

latest5.1 KB
Original Source

Sorting Data

  • Jul 14, 2025
  • 2 minutes to read

You can sort automatically generated series by name in ascending or descending order. If you use qualitative series, you can choose whether to sort points by arguments or values.

Sort Series

The Chart Control sorts series by name. The names of automatically generated series are obtained from a data source’s field specified via the ChartControl.SeriesDataMember property.

The ChartControl.SeriesSorting property allows you to toggle between ascending and descending order, and affects the order of series in the chart’s diagram and legend.

The property’s valueResulting image
SeriesSorting = None
SeriesSorting = Ascending
SeriesSorting = Descending

The following code sorts series in ascending order:

csharp
chartControl1.SeriesSorting = SortingMode.Ascending;
vb
chartControl1.SeriesSorting = SortingMode.Ascending

To sort manually created series, change their order in the ChartControl.Series collection.

Sort Series Points

The Chart Control can sort series with qualitative arguments (SeriesBase.ArgumentScaleType is set to Qualitative ) only. Use the SeriesBase.SeriesPointsSorting property to sort series points.

The SeriesBase.SeriesPointsSortingKey property specifies whether to sort series points by their arguments or values.

The following images show modes that are available for the SeriesBase.SeriesPointsSorting property when series points are sorted by values:

|

Property values

|

Resulting image

| | --- | --- | |

SeriesPointsSorting = None

SeriesPointsSortingKey = Value

|

| |

SeriesPointsSorting = Ascending

SeriesPointsSortingKey = Value

|

| |

SeriesPointsSorting = Descending

SeriesPointsSortingKey = Value

|

|

The following code sorts points by values in ascending order:

csharp
SeriesBase seriesTemplate = chartControl1.SeriesTemplate;
seriesTemplate.SeriesPointsSorting = SortingMode.Ascending;
seriesTemplate.SeriesPointsSortingKey = SeriesPointKey.Value_1;
vb
Dim seriesTemplate As SeriesBase = chartControl1.SeriesTemplate
seriesTemplate.SeriesPointsSorting = SortingMode.Ascending
seriesTemplate.SeriesPointsSortingKey = SeriesPointKey.Value_1

You can enable the SeriesBase.DataSorted property to notify the chart series that its data source is already sorted to prevent the chart’s internal sorting procedures and improve chart performance.

Custom Sorting

You can also implement a comparer that specifies a custom order for qualitative x-axis arguments. See the following help topic for more information: Reorder Qualitative Axis Values.

How to: Display Qualitative Scale Values Sorted in a Custom Sort Order

See Also

Filter Series Data

Calculate Summaries

Empty Points

Axis Scale Types