From 4907624f268fa13adb1b3d3304fcb309056d52f2 Mon Sep 17 00:00:00 2001 From: wp Date: Fri, 24 Aug 2018 12:54:25 +0000 Subject: [PATCH] TAChart: Rename TFuncSeries method SetFitParamBasisFunc to SetFitBasisFunc; restrict its parameter AIndex to be > 0. git-svn-id: trunk@58770 - --- components/tachart/demo/fit/Main.pas | 7 +++---- components/tachart/tafuncseries.pas | 9 ++++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/components/tachart/demo/fit/Main.pas b/components/tachart/demo/fit/Main.pas index 5a0b7e4726..45975c6ccb 100644 --- a/components/tachart/demo/fit/Main.pas +++ b/components/tachart/demo/fit/Main.pas @@ -227,10 +227,9 @@ begin feCustom: begin FitSeries.ParamCount := 4; - FitSeries.SetFitParamBasisFunc(0, @FitBaseFunc_Const, ''); - FitSeries.SetFitParamBasisFunc(1, @HarmonicBaseFunc, 'sin(x)'); - FitSeries.SetFitParamBasisFunc(2, @HarmonicBaseFunc, 'sin(3 x)'); - FitSeries.SetFitParamBasisFunc(3, @HarmonicBaseFunc, 'sin(5 x)'); + FitSeries.SetFitBasisFunc(1, @HarmonicBaseFunc, 'sin(x)'); + FitSeries.SetFitBasisFunc(2, @HarmonicBaseFunc, 'sin(3 x)'); + FitSeries.SetFitBasisFunc(3, @HarmonicBaseFunc, 'sin(5 x)'); cbFitParam0Fixed.Caption := 'b0 = '; cbFitParam1Fixed.Caption := 'b1 = '; edFitParam0.Value := HARMONIC_PARAMS[0]; diff --git a/components/tachart/tafuncseries.pas b/components/tachart/tafuncseries.pas index 445a3b1610..e493263d60 100644 --- a/components/tachart/tafuncseries.pas +++ b/components/tachart/tafuncseries.pas @@ -282,7 +282,9 @@ type TCalcGoodnessOfFitEvent = procedure (Sender: TObject; var x,y: ArbFloat; n: Integer; out AResult: Double) of object; - TFitFuncEvent = procedure(AIndex: Integer; AFitFunc: TFitFunc) of object; + TFitFuncIndex = 1..MaxInt; + + TFitFuncEvent = procedure(AIndex: TFitFuncIndex; AFitFunc: TFitFunc) of object; TFitSeries = class(TBasicPointSeries) strict private @@ -352,7 +354,8 @@ type function GetNearestPoint( const AParams: TNearestPointParams; out AResults: TNearestPointResults): Boolean; override; - procedure SetFitParamBasisFunc(AIndex: Integer; AFitFunc: TFitFunc; AFitFuncName: String); + procedure SetFitBasisFunc(AIndex: TFitFuncIndex; AFitFunc: TFitFunc; + AFitFuncName: String); public // properties property Param[AIndex: Integer]: Double read GetParam; property ParamError[AIndex: Integer]: Double read GetParamError; @@ -1996,7 +1999,7 @@ begin UpdateParentChart; end; -procedure TFitSeries.SetFitParamBasisFunc(AIndex: Integer; AFitFunc: TFitFunc; +procedure TFitSeries.SetFitBasisFunc(AIndex: TFitFuncIndex; AFitFunc: TFitFunc; AFitFuncName: String); begin FFitParams[AIndex].Func := AFitFunc;