From b12d54bac4b4f42bb0ba7e7dfa40b58c01df715d Mon Sep 17 00:00:00 2001 From: ask Date: Fri, 7 Sep 2012 03:00:47 +0000 Subject: [PATCH] TAChart: Support Y NaNs in polar series git-svn-id: trunk@38547 - --- components/tachart/taradialseries.pas | 33 ++++++++++++++++++++------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/components/tachart/taradialseries.pas b/components/tachart/taradialseries.pas index 00c6cbcf74..8475bcc1d9 100644 --- a/components/tachart/taradialseries.pas +++ b/components/tachart/taradialseries.pas @@ -548,19 +548,36 @@ end; procedure TPolarSeries.Draw(ADrawer: IChartDrawer); var i: Integer; + cnt: Integer = 0; pts: TPointArray; + gp: TDoublePoint; + firstPoint, lastPoint: TPoint; + firstPointSet: Boolean = false; begin PrepareAngleCache; SetLength(pts, Count); - for i := 0 to Count - 1 do - pts[i] := FChart.GraphToImage(GraphPoint(i)); ADrawer.Pen := LinePen; - if CloseCircle then begin - ADrawer.SetBrushParams(bsClear, clTAColor); - ADrawer.Polygon(pts, 0, Length(pts)); - end - else - ADrawer.Polyline(pts, 0, Length(pts)); + for i := 0 to Count - 1 do begin + gp := GraphPoint(i); + if IsNan(gp) then begin + if cnt > 0 then + ADrawer.Polyline(pts, 0, cnt); + cnt := 0; + end + else begin + lastPoint := FChart.GraphToImage(gp); + pts[cnt] := lastPoint; + cnt += 1; + if not firstPointSet then begin + firstPoint := lastPoint; + firstPointSet := true; + end; + end; + end; + if cnt > 0 then + ADrawer.Polyline(pts, 0, cnt); + if firstPointSet and CloseCircle then + ADrawer.Line(lastPoint, firstPoint); end; function TPolarSeries.Extent: TDoubleRect;