TAChart: some issue with TFitSeries.AutoFit / SetFitBasisFunc
Original Reporter info from Mantis: Marcin Wiazowski
-
Reporter name:
Original Reporter info from Mantis: Marcin Wiazowski
- Reporter name:
Description:
The attached Reproduce application has a chart with TFitSeries, having FitEquation = feCustom.
In FormCrate(), calls to SetFitBasisFunc() are made - as needed in the feCustom mode.
The problem is: curve is not displayed.
Explanation: the loading order is:
-
TFitSeries.SourceChanged() is called, but we are in csLoading state, so nothing important happens.
-
TFitSeries.Loaded() is called - however, it does nothing for FitEquation = feCustom.
-
TListChartSource.Loaded() is called - it changes source contents.
-
Source contents have been changed, so TFitSeries.SourceChanged() is called again - it executes ExecFit() internally. But there are no basis functions (set by SetFitBasisFunc() calls) at this moment, so ExecFit() stucks with FState = fpsInvalid. This prevents drawing the curve.
-
FormCreate() is called, where TFitSeries.SetFitBasisFunc() calls are made - but it's already too late.
Solution: SetFitBasisFunc() in fact changes the interpolation, so it should invalidate the current, internal interpolation state.
The attached patch solves the problem.
Mantis conversion info:
- Mantis ID: 35179
- Build: 60564
- Version: 2.1 (SVN)
- Fixed in revision: 60567 (#c91e35a5)
- Target version: 2.2