IValueList.Sort
IValueList
procedure Sort;
Type Library
TeeChartx
Description
The Sort method re-orders Series points interchanging their position in the Series values lists so they will be displayed in different coordinates. By default, Series are set to sort points in ascending order using their X coordinates. This is accomplished with this code:
TChart1.Series( 0 ).XValues.Order = loAscending
TChart1.Series( 0 ).YValues.Order = loNone
By default, Series draw points using the point ValueIndex, except in some non common situations like having the horizontal axis inverted.
Important Note: Re-Ordering Series points do NOT change point X coordinates. Series points which have no X coordinates are assigned a unique incremental number to determine the point horizontal positions. Automatic Point indexes start at zero. You will need to change every point X coordinate when sorting Series points with automatic X values.
Example [Visual Basic]
The following code re-orders a Series by it's Y values in descending order:
Note: XValues.FillSequence should not be called when sorting XY points.
With TChart1.Series(0)
.FillSampleValues 8
.XValues.Order = loNone
.YValues.Order = loDescending
.YValues.Sort
.XValues.FillSequence
End With
Example [Delphi]:
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
With TChart1.Series[ 1 ] do { <-- use a BarSeries for example }
begin
FillSampleValues(8);
XValues.Order:=loNone ;
YValues.Order:=loDescending ;
YValues.Sort ;
XValues.FillSequence ;
TChart1.Repaint ;
end;
end;