Recent

Author Topic: distancedemo bug  (Read 930 times)

cleberlr

  • Newbie
  • Posts: 1
distancedemo bug
« on: May 16, 2019, 10:52:04 pm »
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

Code: Pascal  [Select][+][-]
  1. procedure TForm1.ctFitDataPointDistanceTool1GetDistanceText(
  2.   ASender: TDataPointDistanceTool; var AText: String);
  3. var
  4.   xmin, xmax: Double;
  5. begin
  6.   xmin := ASender.PointStart.AxisPos.X;
  7.   xmax := ASender.PointEnd.AxisPos.X;
  8.   EnsureOrder(xmin, xmax);
  9.   with chFitFitSeries1.FitRange do begin
  10.     Min := xmin;
  11.     Max := xmax;
  12.     if xmin < xmax then begin
  13.       UseMax := true;
  14.       UseMin := true;
  15.     end else begin
  16.       UseMin := true;
  17.       UseMax := true;
  18.     end;
  19.   end;
  20.   chFitFitSeries1.ExecFit;
  21.   case rgFitParamCount.ItemIndex of
  22.     0: AText := Format('Mean value: %f', [chFitFitSeries1.Param[0]]);
  23.     1: AText := Format('Slope: %f', [chFitFitSeries1.Param[1]]);
  24.     2:
  25.       with chFitFitSeries1 do
  26.         if Param[2] = 0 then
  27.           AText := ''
  28.         else
  29.           AText := Format('Peak at x=%f y=%f', [
  30.             -Param[1] / (2 * Param[2]),
  31.             Param[0] - Sqr(Param[1])/(4 * Param[2])
  32.         ]);
  33.   end;
  34.   chFitFitSeries1.Active := true;
  35.  
  36.   lblFit.Visible := true;
  37.   lblFit.Caption := AText;
  38. end;
  39.  

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: distancedemo bug
« Reply #1 on: May 16, 2019, 11:07:42 pm »
This already has been fixed in r60985.

 

TinyPortal © 2005-2018