Dundas Chart for SharePoint Send comments on this topic.
Sorting Data
See Also

Glossary Item Box

Overview

A sort changes the order of a series' data points, and is based on a data point value (by default this is the first Y value). Ascending, descending or custom sort orders can be used.

If more than one series is sorted using one method call then it is always sorted using values from the first listed series, and all series MUST be aligned, otherwise an exception will be thrown. For details concerning alignment see the Aligning Series topic.

Performing Ascending or Descending Sorts

Use the DataManipulator object's Sort method to sort data. An ascending or descending sort order can be used.

 

By default the first Y value of the data points is used for sorting. However, you can sort data points using their X value, or any of their other Y values (Y2, Y3, ...) and also by their AxisLabel property.

Performing Custom Sorts

If more complex sorting logic is required use the IComparer interface. The Compare method of this interface receives two objects as parameters and when overridden should return a value less than zero if the first object is less than the second, zero if they are equal and a value greater than zero if the first object is greater than the second.

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

Sorting Multiple Series

The Sort method of the DataManipulator class allows for multiple aligned series to be sorted simultaneously by specifying a comma-separated list of series names. All points in all series will be sorted using the values from the first series listed. In other words, changes in the order of data points will be duplicated in all series, and are based on changes made to the first series.

If two series must be sorted independently, call the Sort method twice using one series as a parameter.

See Also