mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 04:29:28 +02:00
TAChart: Sort TChartListbox items according to Legend.Order
git-svn-id: trunk@31655 -
This commit is contained in:
parent
af52bce126
commit
56bfdb8e1a
@ -252,7 +252,6 @@ function TChartListbox.CreateLegendItems: TChartLegendItems;
|
||||
a single legend item is used }
|
||||
var
|
||||
i: Integer;
|
||||
j: Integer = MaxInt;
|
||||
begin
|
||||
Result := TChartLegendItems.Create;
|
||||
try
|
||||
@ -260,11 +259,6 @@ begin
|
||||
for i := 0 to FChart.SeriesCount - 1 do
|
||||
if FChart.Series[i] is TCustomChartSeries then
|
||||
TCustomChartSeries(FChart.Series[i]).GetSingleLegendItem(Result);
|
||||
for i := Result.Count - 1 downto 0 do
|
||||
if Result[i].Order = LEGEND_ITEM_ORDER_AS_ADDED then begin
|
||||
Result[i].Order := j;
|
||||
j -= 1;
|
||||
end;
|
||||
except
|
||||
FreeAndNil(Result);
|
||||
raise;
|
||||
@ -458,10 +452,10 @@ begin
|
||||
if FChart = nil then exit;
|
||||
FreeAndNil(FLegendItems);
|
||||
FLegendItems := CreateLegendItems;
|
||||
Chart.Legend.SortItemsByOrder(FLegendItems);
|
||||
for i := 0 to FLegendItems.Count - 1 do
|
||||
// The caption is owner-drawn, but add it anyway for user convenience.
|
||||
Items.AddObject(FLegendItems[i].Text, FLegendItems[i]);
|
||||
|
||||
if Assigned(OnPopulate) then
|
||||
OnPopulate(Self);
|
||||
finally
|
||||
|
Loading…
Reference in New Issue
Block a user