mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:11:59 +02:00
TAChart: Implement sorting of TListChartsource by y value when XCount is 0. Issue #35188, patch by Marcin Wiazowski.
git-svn-id: trunk@60740 -
This commit is contained in:
parent
29c8cde0df
commit
b2a4a7868b
@ -863,9 +863,28 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function CompareDataItemY(AItem1, AItem2: Pointer): Integer;
|
||||
var
|
||||
i: Integer;
|
||||
item1: PChartDataItem absolute AItem1;
|
||||
item2: PChartDataItem absolute AItem2;
|
||||
begin
|
||||
Result := CompareFloat(item1^.Y, item2^.Y);
|
||||
if Result = 0 then
|
||||
for i := 0 to Min(High(item1^.YList), High(item2^.YList)) do begin
|
||||
Result := CompareFloat(item1^.YList[i], item2^.YList[i]);
|
||||
if Result <> 0 then
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TListChartSource.Sort;
|
||||
begin
|
||||
FData.Sort(@CompareDataItemX);
|
||||
if XCount > 0 then
|
||||
FData.Sort(@CompareDataItemX)
|
||||
else
|
||||
if YCount > 0 then
|
||||
FData.Sort(@CompareDataItemY);
|
||||
end;
|
||||
|
||||
procedure TListChartSource.UpdateCachesAfterAdd(AX, AY: Double);
|
||||
|
Loading…
Reference in New Issue
Block a user