TAChart: Fix TListChartSource's extent calculation when XCount or YCount are zero. Issue #35125, patch by Marcin Wiazowski.

git-svn-id: trunk@60515 -
This commit is contained in:
wp 2019-02-26 17:26:00 +00:00
parent fdf2e848f4
commit fd88788ac2
2 changed files with 24 additions and 20 deletions

View File

@ -785,25 +785,29 @@ begin
if FExtentIsValid then exit(FExtent);
FExtent := EmptyExtent;
if HasXErrorBars then
for i := 0 to Count - 1 do begin
GetXErrorBarLimits(i, vhi, vlo);
UpdateMinMax(vhi, FExtent.a.X, FExtent.b.X);
UpdateMinMax(vlo, FExtent.a.X, FExtent.b.X);
end
else
for i:=0 to Count - 1 do
UpdateMinMax(Item[i]^.X, FExtent.a.X, FExtent.b.X);
if XCount > 0 then begin
if HasXErrorBars then
for i := 0 to Count - 1 do begin
GetXErrorBarLimits(i, vhi, vlo);
UpdateMinMax(vhi, FExtent.a.X, FExtent.b.X);
UpdateMinMax(vlo, FExtent.a.X, FExtent.b.X);
end
else
for i:=0 to Count - 1 do
UpdateMinMax(Item[i]^.X, FExtent.a.X, FExtent.b.X);
end;
if HasYErrorBars then
for i := 0 to Count - 1 do begin
GetYErrorBarLimits(i, vhi, vlo);
UpdateMinMax(vhi, FExtent.a.Y, FExtent.b.Y);
UpdateMinMax(vlo, FExtent.a.Y, FExtent.b.Y);
end
else
for i:=0 to Count - 1 do
UpdateMinMax(Item[i]^.Y, FExtent.a.Y, FExtent.b.Y);
if YCount > 0 then begin
if HasYErrorBars then
for i := 0 to Count - 1 do begin
GetYErrorBarLimits(i, vhi, vlo);
UpdateMinMax(vhi, FExtent.a.Y, FExtent.b.Y);
UpdateMinMax(vlo, FExtent.a.Y, FExtent.b.Y);
end
else
for i:=0 to Count - 1 do
UpdateMinMax(Item[i]^.Y, FExtent.a.Y, FExtent.b.Y);
end;
FExtentIsValid := true;
Result := FExtent;

View File

@ -870,8 +870,8 @@ end;
procedure TListChartSource.UpdateCachesAfterAdd(AX, AY: Double);
begin
if FExtentIsValid then begin
UpdateMinMax(AX, FExtent.a.X, FExtent.b.X);
UpdateMinMax(AY, FExtent.a.Y, FExtent.b.Y);
if FXCount > 0 then UpdateMinMax(AX, FExtent.a.X, FExtent.b.X);
if FYCount > 0 then UpdateMinMax(AY, FExtent.a.Y, FExtent.b.Y);
end;
if FValuesTotalIsValid then
FValuesTotal += NumberOr(AY);