Distancedemo wasn't calculating Fit measurements (only Nan values)...
I include chFitFitSeries1.ExecFit after the definition of FitRange in ctFitDataPointDistanceTool1GetDistanceText function to solve this problem..
I'm using:
Lazarus 2.1.0 SVN r60739M
FPC 3.3.1 SVN r41749
procedure TForm1.ctFitDataPointDistanceTool1GetDistanceText(
ASender: TDataPointDistanceTool; var AText: String);
var
xmin, xmax: Double;
begin
xmin := ASender.PointStart.AxisPos.X;
xmax := ASender.PointEnd.AxisPos.X;
EnsureOrder(xmin, xmax);
with chFitFitSeries1.FitRange do begin
Min := xmin;
Max := xmax;
if xmin < xmax then begin
UseMax := true;
UseMin := true;
end else begin
UseMin := true;
UseMax := true;
end;
end;
chFitFitSeries1.ExecFit;
case rgFitParamCount.ItemIndex of
0: AText := Format('Mean value: %f', [chFitFitSeries1.Param[0]]);
1: AText := Format('Slope: %f', [chFitFitSeries1.Param[1]]);
2:
with chFitFitSeries1 do
if Param[2] = 0 then
AText := ''
else
AText := Format('Peak at x=%f y=%f', [
-Param[1] / (2 * Param[2]),
Param[0] - Sqr(Param[1])/(4 * Param[2])
]);
end;
chFitFitSeries1.Active := true;
lblFit.Visible := true;
lblFit.Caption := AText;
end;