TAChart: Fix initialization/reset issue in TCustomAxisChartSource. Issue #35387, patch by Marcin Wiazowski.

git-svn-id: trunk@60997 -
This commit is contained in:
wp 2019-04-16 14:24:51 +00:00
parent 5d5d933bd5
commit dcb6dc0705

View File

@ -31,7 +31,6 @@ type
procedure SetYCount(AValue: Cardinal); override; procedure SetYCount(AValue: Cardinal); override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
public public
function IsSorted: Boolean; override; function IsSorted: Boolean; override;
@ -42,6 +41,7 @@ type
implementation implementation
uses uses
Math,
TAChartUtils; TAChartUtils;
{ TCustomAxisChartSource } { TCustomAxisChartSource }
@ -50,14 +50,10 @@ constructor TCustomAxisChartSource.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FItem.Color := clTAColor; FItem.Color := clTAColor;
FItem.XList := nil;
FItem.YList := nil; FItem.YList := nil;
end; end;
destructor TCustomAxisChartSource.Destroy;
begin
inherited Destroy;
end;
function TCustomAxisChartSource.GetCount: Integer; function TCustomAxisChartSource.GetCount: Integer;
begin begin
if AxisFrom = nil then if AxisFrom = nil then
@ -71,7 +67,12 @@ var
v: Double; v: Double;
begin begin
Result := @FItem; Result := @FItem;
if AxisFrom = nil then exit; if AxisFrom = nil then begin
FItem.Text := '';
FItem.X := NaN;
FItem.Y := NaN;
exit;
end;
with AxisFrom.Value[AIndex] do begin with AxisFrom.Value[AIndex] do begin
FItem.Text := FText; FItem.Text := FText;
v := FValue; v := FValue;