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 -
This commit is contained in:
wp 2019-02-14 11:07:44 +00:00
parent 2acdb72734
commit 2ff24ec235
4 changed files with 17 additions and 12 deletions

View File

@ -62,8 +62,7 @@
</element>
<element name="TChartSeries.OnGetMark">
<short>Called before the drawing of each mark.</short>
<seealso>
<link id="TChartSeries.Marks">Marks</link>
<seealso><link id="TChartSeries.Marks">Marks</link>
</seealso>
</element>
<element name="TChartSeries">
@ -87,8 +86,7 @@ from a <link id="TACustomSource.TCustomChartSource"><var>chart source</var>
</element>
<element name="TChartSeries.Extent">
<short>Return the bounding rectangle for all points in the serie.</short>
<seealso>
<link id="TASources.TCustomChartSource.Extent">TCustomChartSource.Extent</link>
<seealso><link id="TASources.TCustomChartSource.Extent">TCustomChartSource.Extent</link>
</seealso>
</element>
<element name="TChartSeries.FormattedMark">

View File

@ -240,10 +240,7 @@ For example, <link id="TASeries.TPieSeries">pie series</link> displays a separat
</element>
<element name="TChart.GraphToImage">
<short>Converts a point from graph coordinates to image coordinates.</short>
<seealso>
<link id="TChart.ImageToGraph"/>
<link id="TChart.XGraphToImage"/>
<link id="TChart.YGraphToImage"/>
<seealso><link id="TChart.ImageToGraph"/><link id="TChart.XGraphToImage"/><link id="TChart.YGraphToImage"/>
</seealso>
</element>
<element name="TChart.ImageToGraph">

View File

@ -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

View File

@ -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;