From a58d97ece824214662c5764e184294c0a1bdf58e Mon Sep 17 00:00:00 2001 From: wp Date: Fri, 19 Apr 2019 15:39:03 +0000 Subject: [PATCH] TAChart: Properly set TCustomAnimatedChartSource.XCount and .YCount for the case that its Origin in nil. Issue #35388, modified patch by Marcin Wiazowski. git-svn-id: trunk@61022 - --- components/tachart/taanimatedsource.pas | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/tachart/taanimatedsource.pas b/components/tachart/taanimatedsource.pas index 8a040f9ba5..4974191aa1 100644 --- a/components/tachart/taanimatedsource.pas +++ b/components/tachart/taanimatedsource.pas @@ -83,17 +83,29 @@ implementation uses LCLIntf, Math, SysUtils; +type + TCustomChartSourceAccess = class(TCustomChartSource); + { TCustomAnimatedChartSource } procedure TCustomAnimatedChartSource.Changed(ASender: TObject); begin Unused(ASender); + if FOrigin <> nil then begin + FXCount := Origin.XCount; + FYCount := Origin.YCount; + end else begin + FXCount := MaxInt; + FYCount := MaxInt; + end; Notify; end; constructor TCustomAnimatedChartSource.Create(AOwner: TComponent); begin inherited Create(AOwner); + FXCount := MaxInt; + FYCount := MaxInt; FListener := TListener.Create(@FOrigin, @Changed); FTimer := TCustomTimer.Create(nil); FTimer.Enabled := false; @@ -187,6 +199,7 @@ begin FOrigin := AValue; if FOrigin <> nil then FOrigin.Broadcaster.Subscribe(FListener); + Changed(nil); end; procedure TCustomAnimatedChartSource.SetXCount(AValue: Cardinal);