TAChart: lack of validation in TFitSeries.SetParamCount
Original Reporter info from Mantis: Marcin Wiazowski
-
Reporter name:
Original Reporter info from Mantis: Marcin Wiazowski
- Reporter name:
Description:
Launch the attached Reproduce application and press the "Test" button: ERangeError exception is generated; it's not nice to have out-of-range operations. The series disappears from the chart.
The cause is that the code makes a thing, that should be impossible: it sets TFitSeries.ParamCount to zero. In any case, ParamCount must be at lest 1 - in this case the interpolated equation will be: y = const.
The attached patch does not allow to set ParamCount to zero - in this case the operation is ignored; this is same as currently when FitEquation is feLinear, feExp or fePower - in this case the operation is also ignored, and the previous value is not changed (this is because feLinear, feExp and fePower require ParamCount tied to 2).
As can be seen in the Object Inspector, when TFitSeries has its FitEquation property set to feLinear, feExp or fePower, trying to change the ParamCount property, makes it returning immediately to 2.
After applying the patch, similar behavior is also when FitEquation property is set to fePolynomial or feCustom, when trying to set the ParamCount property to 0 - it returns immediately to its previous value.
Mantis conversion info:
- Mantis ID: 35164
- Build: 60526
- Version: 2.1 (SVN)
- Fixed in revision: 60534 (#acf40b54)
- Target version: 2.2