Hide Comments
Hide Comments

TRSChartValues.CustomSort(TValuesSortCompare) Method

Comments (0)

Sorts the current values collection using the supplied comparison function. Use CustomSort when you want to perform a special type of sorting on the values collection. You need to define a function based on the RSChartPanel.TValuesSortCompare signature.

If you want to do normal sorting, just call the    Sort method.
 

Namespace: RSChartPanel

expandingSyntax

Delphi

public
  procedure CustomSort(SCompare: TValuesSortCompare); virtual;
 

Parameters

SCompare

Type: TValuesSortCompare

expandingExamples

The following code sorts a shape chart from shapes with the smallest (width * height) area to largest area:
 

Delphi

begin
   RSShapeChart1.Values.CustomSort(CompareShapeValues);
 end;
 
 function CompareShapeValues(List: TRSChartValues; Index1, Index2: Integer): Integer;
 begin
   with List as TRSShapeChartValues do
      if (Items[Index1].Width * Items[Index1].Height) < (Items[Index2].Width * Items[Index2].Height) then
         result := -1
      else if (Items[Index1].Width * Items[Index1].Height) > (Items[Index2].Width * Items[Index2].Height) then
           result := 1
      else
          result := 0;
 end;
  

expandingSee Also

Comments (0)

RiverSoftAVG Charting Component Suite (RCCS) © 2005-2015, Thomas G. Grubb