mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 09:39:31 +02:00
TAChart: Fix AreaSeries crashing when y of first or last data point is NaN.
git-svn-id: trunk@63215 -
This commit is contained in:
parent
97716ad3a4
commit
c97a2a7c76
@ -1938,6 +1938,16 @@ var
|
||||
zero: Double;
|
||||
ext, ext2: TDoubleRect;
|
||||
|
||||
{ Replaces y=NaN at first level by zero if StackedNaN is ReplaceByZero }
|
||||
procedure FixNaN;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if FStackedNaN = snReplaceByZero then
|
||||
for i := 0 to High(FGraphPoints) do
|
||||
if IsNaN(FGraphPoints[i].Y) then FGraphPoints[i].Y := 0.0;
|
||||
end;
|
||||
|
||||
procedure CollectMissingItem(AIndex: Integer);
|
||||
begin
|
||||
missing[numMissing] := AIndex;
|
||||
@ -1957,15 +1967,12 @@ var
|
||||
if IsNaN(item^.X) then
|
||||
CollectMissingItem(i)
|
||||
else
|
||||
if FBanded and IsNaN(item^.Y) then
|
||||
if IsNaN(item^.Y) and ((FStackedNaN = snDoNotDraw) or FBanded) then
|
||||
CollectMissingItem(i)
|
||||
else
|
||||
if FStacked and (FStackedNaN = snDoNotDraw) then
|
||||
if IsNaN(item^.Y) then
|
||||
CollectMissingItem(i)
|
||||
else
|
||||
for j := 0 to Source.YCount-2 do
|
||||
if IsNaN(item^.YList[j]) then CollectMissingItem(i);
|
||||
for j := 0 to Source.YCount - 2 do
|
||||
if IsNaN(item^.YList[j]) then CollectMissingItem(i);
|
||||
end;
|
||||
SetLength(missing, numMissing);
|
||||
end;
|
||||
@ -2218,6 +2225,7 @@ begin
|
||||
PrepareGraphPoints(ext, true);
|
||||
if Length(FGraphPoints) = 0 then
|
||||
exit;
|
||||
FixNaN;
|
||||
|
||||
if UseZeroLevel then
|
||||
zero := AxisToGraphY(ZeroLevel)
|
||||
|
Loading…
Reference in New Issue
Block a user