From 813db1140ef37876068c6be0037702f32911cae6 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 11 Sep 2024 21:40:25 +0000 Subject: [PATCH] FPSpreadsheet: Fix positioning of y axis when axis.Position is cuGraph and the chart is a barchart. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9433 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../fpspreadsheet/source/visual/fpspreadsheetchart.pas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas index 04ee74320..03c0d1dc5 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetchart.pas @@ -2281,6 +2281,12 @@ begin else axis.Position := AWorkbookAxis.PositionValue; axis.PositionUnits := cuGraph; // To do: cuAxis not yet implemented in TAChart... + + // Workaround for barseries issue: When Position = 0 and PositionUnits = cuGraph + // the axis would be moved to the center of the 1st bar which looks + // ugly --> revert to cuPercent + if (axis.Position = 0) and (AWorkbookAxis.Chart.GetChartType = ctBar) then + axis.PositionUnits := cuPercent; end; end; end;