FPSpreadsheet: Fix duplicate legend items (after tabcontrol support)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9476 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz 2024-10-01 18:09:58 +00:00
parent 6599aeba51
commit d3516c739b

View File

@ -19,7 +19,9 @@ interface
{$ifdef FPS_CHARTS} {$ifdef FPS_CHARTS}
uses lazloggerbase, uses
lazloggerbase,
// RTL/FCL // RTL/FCL
Classes, Contnrs, SysUtils, Types, FPCanvas, Classes, Contnrs, SysUtils, Types, FPCanvas,
// LCL // LCL
@ -1976,10 +1978,7 @@ begin
// Workbook has been successfully loaded, all sheets are ready // Workbook has been successfully loaded, all sheets are ready
if (lniWorkbook in AChangedItems) then if (lniWorkbook in AChangedItems) then
begin
ClearChart;
UpdateChart; UpdateChart;
end;
// Another worksheet is selected --> Select the first chart of the worksheet // Another worksheet is selected --> Select the first chart of the worksheet
if (lniWorksheet in AChangedItems) and (WorkbookSource <> nil) then if (lniWorksheet in AChangedItems) and (WorkbookSource <> nil) then
@ -1989,8 +1988,6 @@ begin
WorkbookChartIndex := WorkbookSource.Workbook.GetChartIndex(charts[0]) WorkbookChartIndex := WorkbookSource.Workbook.GetChartIndex(charts[0])
else else
WorkbookChartIndex := -1; WorkbookChartIndex := -1;
ClearChart;
UpdateChart;
FChart.Visible := WorkbookChartIndex > -1; FChart.Visible := WorkbookChartIndex > -1;
end; end;
end; end;
@ -2128,13 +2125,11 @@ var
ch: TsChart; ch: TsChart;
i: Integer; i: Integer;
begin begin
if (FChart = nil) then ClearChart;
if (FChart = nil) or (FWorkbookSource = nil) or (FWorkbookChartIndex < 0) then
exit; exit;
if (FWorkbookSource = nil) or (FWorkbookChartIndex < 0) then
begin
ClearChart;
exit;
end;
FChart.Proportional := false; FChart.Proportional := false;
FChart.ExpandPercentage := 0; FChart.ExpandPercentage := 0;