From 84a9df69ff8d114a3b651a9055c3a7d686c66fa1 Mon Sep 17 00:00:00 2001 From: wp Date: Sat, 12 Jan 2019 23:43:20 +0000 Subject: [PATCH] TAChart: Fix position of series labels at a multi-y-valued non-stacked bar series. git-svn-id: trunk@60066 - --- components/tachart/taseries.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index f546f60afa..b1e34d1626 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -1246,11 +1246,17 @@ end; function TBarSeries.GetLabelDataPoint(AIndex, AYIndex: Integer): TDoublePoint; var - ofs, w: Double; + ofs, w, wbar: Double; begin Result := inherited GetLabelDataPoint(AIndex, AYIndex); BarOffsetWidth(TDoublePointBoolArr(Result)[IsRotated], AIndex, ofs, w); TDoublePointBoolArr(Result)[IsRotated] += ofs; + + // Find x centers of bars in multi-y non-stacked bar series. + if (not FStacked) and (Source.YCount > 1) then begin + wbar := 2 * w / Source.YCount; + TDoublePointboolArr(Result)[IsRotated] += (wbar * (AYIndex + 0.5) - w); + end; end; procedure TBarSeries.GetLegendItems(AItems: TChartLegendItems);