From 04b8a56aa0645db0ccbd05671d71237360bb4cf5 Mon Sep 17 00:00:00 2001 From: ask Date: Tue, 13 Sep 2011 17:43:34 +0000 Subject: [PATCH] TAChart: Skip leftmost point and points with dx = 0 in derivative source git-svn-id: trunk@32324 - --- components/tachart/tasources.pas | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/components/tachart/tasources.pas b/components/tachart/tasources.pas index f04589c8df..adc771f98f 100644 --- a/components/tachart/tasources.pas +++ b/components/tachart/tasources.pas @@ -913,20 +913,19 @@ var prevItem: PChartDataItem; i, j, ar: Integer; dx: Double; - t: TChartDataItem; begin - if AIndex = 0 then begin - AIndex := 1; - ExtractItem(t, AIndex); - FHistory.AddLast(t); - dx := t.X - FHistory.GetPLast(1)^.X; - end - else - dx := FItem.X - FHistory.GetPLast(1)^.X; FItem.ClearY; - if dx = 0 then exit; + if AIndex = 0 then begin + FItem.X := SafeNan; + exit; + end; + dx := FItem.X - FHistory.GetPLast(1)^.X; + if dx = 0 then begin + FItem.X := SafeNan; + exit; + end; ar := IfThen(AccumulationRange = 0, MaxInt, AccumulationRange); - ar := math.MinValue([ar, Integer(AIndex + 1), High(COEFFS)]); + ar := MinValue([ar, Integer(AIndex + 1), High(COEFFS)]); for j := 0 to ar - 1 do begin prevItem := FHistory.GetPLast(j); FItem.Y += prevItem^.Y * COEFFS[ar, j];