Merged revision(s) 62069-62070 #40d59fec0b-#40d59fec0b, 62073 #6d317e22dc from trunk:

TAChart: Fix chart distance tools crashing when series contains a NaN value.
........
TAChart: Replace r62069 #40d59fec0b by better solution.
........
TAChart: Fix divide-by-zero error in TFitSeries.
........

git-svn-id: branches/fixes_2_0@62084 -
This commit is contained in:
maxim 2019-10-18 22:07:19 +00:00
parent 8e223c396b
commit fbe9203283
2 changed files with 10 additions and 3 deletions

View File

@ -1742,8 +1742,12 @@ var
begin
Unused(APointIdx);
Unused(AXIdx, AYIdx);
pt := ParentChart.GraphToImage(AGraphPt);
Result := AParams.FDistFunc(AParams.FPoint, pt);
if IsNaN(AGraphPt) then
exit(MaxInt)
else begin
pt := ParentChart.GraphToImage(AGraphPt);
Result := AParams.FDistFunc(AParams.FPoint, pt);
end;
end;
// AIndex refers to the index into YList here.

View File

@ -332,7 +332,10 @@ begin
ycalc := CalcBestFitValues(x, y, n, m, FitParams);
CalcSumOfSquares(y, dy, ycalc, Result.SSE, Result.SSR);
SetLength(ycalc, 0);
chi2 := Result.SSE / (n - mfit);
if n > mfit then
chi2 := Result.SSE / (n - mfit)
else
chi2 := NaN;
// Calculate inverse of alpha. This is (almost) the variance-covariance matrix
invgen(mfit, mfit, alpha[0], term);