From d3516c739b8e7cdb73f6318813581d1d0a1d085c Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Tue, 1 Oct 2024 18:09:58 +0000 Subject: [PATCH] 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 --- .../source/visual/fpspreadsheetchart.pas | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas index 8ac97fba4..bd3e68c60 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas @@ -19,7 +19,9 @@ interface {$ifdef FPS_CHARTS} -uses lazloggerbase, +uses + lazloggerbase, + // RTL/FCL Classes, Contnrs, SysUtils, Types, FPCanvas, // LCL @@ -1976,10 +1978,7 @@ begin // Workbook has been successfully loaded, all sheets are ready if (lniWorkbook in AChangedItems) then - begin - ClearChart; UpdateChart; - end; // Another worksheet is selected --> Select the first chart of the worksheet if (lniWorksheet in AChangedItems) and (WorkbookSource <> nil) then @@ -1989,8 +1988,6 @@ begin WorkbookChartIndex := WorkbookSource.Workbook.GetChartIndex(charts[0]) else WorkbookChartIndex := -1; - ClearChart; - UpdateChart; FChart.Visible := WorkbookChartIndex > -1; end; end; @@ -2128,13 +2125,11 @@ var ch: TsChart; i: Integer; begin - if (FChart = nil) then + ClearChart; + + if (FChart = nil) or (FWorkbookSource = nil) or (FWorkbookChartIndex < 0) then exit; - if (FWorkbookSource = nil) or (FWorkbookChartIndex < 0) then - begin - ClearChart; - exit; - end; + FChart.Proportional := false; FChart.ExpandPercentage := 0;