Sorry but I had to post this again:
TeeChart Version 7 & Delphi 7:
You have an issue with the TTrendFucntion when one of the point is zero.
I am using a TPointSeries and TLineSeries to draw a calibration line.
1st point: 0 , 1.06207
2nd point:1 , 672.42340
and this is the section of code that calls the TTrendFunction
with MyLineSeries do begin
DataSources.Clear;
DataSources.Add( MyPointSeries );
SetFunction( TTrendFunction.Create(Self) );
{display trend line}
CheckDataSource;
X1 := XValue[0];
X2 := XValue[1];
Y1 := YValue[0];
Y2 := YValue[1];
end;
Now what you will notice that the value of YValue[0] changes somehow to double the value of 1.06207. The error is less notisable when you have more than 2 points and it only happens when you have a zero as one of the points.
X1, X2, Y1, Y2 are used to calculate the slope and the Y intercept
Slope:= (Y2 - Y1)/(X2 - X1);
YIntercept := Y1 - X1 * (Y2 - Y1) / (X2 - X1) ;
Using the values above after the line has been ploted the YIntercept was calculated to be 2.124 where it should have been = to 1.06207.
I have checked TeeChart Version 4 & Delphi 5 and the calculations are correct.
Any ideas?
Regards,
Slim
TTrendFucntion (2nd posting)
Hi Slim,
sorry for delay !
I think this can be worked around - simply eliminate the "null" values before setting the datasource of the second function series, e.g.
sorry for delay !
I think this can be worked around - simply eliminate the "null" values before setting the datasource of the second function series, e.g.
Code: Select all
For i := 0 To Series1.Count - 1 do
begin
If Series1.YValues.Value[i] = 0 Then
begin
Series1.Delete(i);
Series1.YValues.Sort
End;
end;
Series2.DataSource := Series1;
Pep Jorge
http://support.steema.com
http://support.steema.com