TAChart: Fix update of TListChartSource.ValuesTotal cache when adding or removing NaNs

git-svn-id: trunk@38694 -
This commit is contained in:
ask 2012-09-16 17:44:59 +00:00
parent 6a15305fe4
commit 583c74c2cc

View File

@ -463,7 +463,7 @@ begin
(FExtent.a.X < X) and (X < FExtent.b.X) and
(FExtent.a.Y < Y) and (Y < FExtent.b.Y);
if FValuesTotalIsValid then
FValuesTotal -= Y;
FValuesTotal -= NumberOr(Y);
end;
Dispose(Item[AIndex]);
FData.Delete(AIndex);
@ -628,12 +628,8 @@ var
begin
oldY := Item[AIndex]^.Y;
Item[AIndex]^.Y := AValue;
if FValuesTotalIsValid then begin
if not IsNan(AValue) then
FValuesTotal += AValue;
if not IsNan(oldY) then
FValuesTotal -= oldY;
end;
if FValuesTotalIsValid then
FValuesTotal += NumberOr(AValue) - NumberOr(oldY);
UpdateExtent;
Notify;
end;
@ -655,7 +651,7 @@ begin
UpdateMinMax(AY, FExtent.a.Y, FExtent.b.Y);
end;
if FValuesTotalIsValid then
FValuesTotal += AY;
FValuesTotal += NumberOr(AY);
Notify;
end;