From 2ff24ec235c729444df0f5963ee9fe7a00a84658 Mon Sep 17 00:00:00 2001 From: wp Date: Thu, 14 Feb 2019 11:07:44 +0000 Subject: [PATCH] TAChart: Avoid multiple painting of series labels and error bars in case of multi-y-valued line series. Issue #35077. git-svn-id: trunk@60420 - --- components/tachart/fpdoc/tacustomseries.xml | 6 ++---- components/tachart/fpdoc/tagraph.xml | 5 +---- components/tachart/tacustomseries.pas | 13 +++++++++++-- components/tachart/taseries.pas | 5 +++-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/components/tachart/fpdoc/tacustomseries.xml b/components/tachart/fpdoc/tacustomseries.xml index 4abe819736..2509a7a142 100644 --- a/components/tachart/fpdoc/tacustomseries.xml +++ b/components/tachart/fpdoc/tacustomseries.xml @@ -62,8 +62,7 @@ Called before the drawing of each mark. - - Marks + Marks @@ -87,8 +86,7 @@ from a chart source Return the bounding rectangle for all points in the serie. - - TCustomChartSource.Extent + TCustomChartSource.Extent diff --git a/components/tachart/fpdoc/tagraph.xml b/components/tachart/fpdoc/tagraph.xml index 5003854972..6a04d32017 100644 --- a/components/tachart/fpdoc/tagraph.xml +++ b/components/tachart/fpdoc/tagraph.xml @@ -240,10 +240,7 @@ For example, pie series displays a separat Converts a point from graph coordinates to image coordinates. - - - - + diff --git a/components/tachart/tacustomseries.pas b/components/tachart/tacustomseries.pas index 84c7f6e95b..c179e154d8 100644 --- a/components/tachart/tacustomseries.pas +++ b/components/tachart/tacustomseries.pas @@ -290,7 +290,7 @@ type procedure AfterDrawPointer( ADrawer: IChartDrawer; AIndex: Integer; const APos: TPoint); virtual; procedure DrawErrorBars(ADrawer: IChartDrawer); - procedure DrawLabels(ADrawer: IChartDrawer); + procedure DrawLabels(ADrawer: IChartDrawer; AYIndex: Integer = -1); procedure DrawPointers(ADrawer: IChartDrawer; AStyleIndex: Integer = 0; UseDataColors: Boolean = false); procedure FindExtentInterval( @@ -1243,7 +1243,8 @@ begin end; end; -procedure TBasicPointSeries.DrawLabels(ADrawer: IChartDrawer); +procedure TBasicPointSeries.DrawLabels(ADrawer: IChartDrawer; AYIndex: Integer = -1); +// Using AYIndex is workaround for issue #35077 var prevLabelPoly: TPointArray; @@ -1320,6 +1321,14 @@ begin if Stacked then prev := curr; + // Draw only the requested y index + if (AYIndex >= 0) then begin + if si < AYIndex then + Continue + else if si > AYIndex then + exit; + end; + with ParentChart do if ((Marks.YIndex = MARKS_YINDEX_ALL) or (Marks.YIndex = si)) and diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index 374d1e38a6..14daccccc1 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -667,8 +667,9 @@ begin else DrawColoredLines; end; - DrawErrorBars(ADrawer); - DrawLabels(ADrawer); + if AIndex = 0 then + DrawErrorBars(ADrawer); + DrawLabels(ADrawer, AIndex); if ShowPoints then DrawPointers(ADrawer, AIndex, FColorEach in [cePoint, cePointAndLineBefore, cePointAndLineAfter]); end;