Hi Narcis,
Thank you very much
We are soon at the end of the problem ..
But a small concern of conversion that I do not understand because
AddXY expected and provide double
but the message indicates an incompatibility between integer and double ..
??
Look at the code :
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, TeeFunci, Series, ExtCtrls, TeeProcs, Chart, Math,
StdCtrls;
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TLineSeries;
TeeFunction1: TCustomTeeFunction;
Series2: TLineSeries;
TeeFunction2: TCustomTeeFunction;
Series3: TLineSeries;
TeeFunction3: TCustomTeeFunction;
procedure TeeFunction1Calculate(Sender: TCustomTeeFunction;
const x: Double; var y: Double);
procedure TeeFunction2Calculate(Sender: TCustomTeeFunction;
const x: Double; var y: Double);
procedure FormCreate(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
a, b, Qf, S, Sa, calcul, tc,y1,y2: Double;
implementation
{$R *.dfm}
procedure TForm1.TeeFunction1Calculate(Sender: TCustomTeeFunction;
const x: Double; var y: Double);
begin
y := a * power(60 * x, 1 - b); // First function
end;
procedure TForm1.TeeFunction2Calculate(Sender: TCustomTeeFunction;
const x: Double; var y: Double);
begin
if ((Qf <> 0) and (S <> 0) and (Sa <> 0)) then
y := (Qf * S * 0.36 * x) / Sa; // second function
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D := false;
a := 28.916;
b := 0.848;
Qf := 1;
S := 8;
Sa := 4.3;
// calculate the critical value :
tc := exp(-ln((Qf * S * 0.36) / (Sa * (1 - b) * a * power(60, 1 - b))) / b);
// determination of the Y values of the two curves to the value tc
y1 := a * power(60 * tc, 1 - b);
y2 := (Qf * S * 0.36 * tc) / Sa;
Series1.CheckDataSource;
Series2.CheckDataSource;
// Draw a line between the two points
Series3.AddXY(Series1.XValue[tc], Series1.YValue[y1]); // error on this line !!!
Series3.AddXY(Series2.XValue[tc], Series2.YValue[y2]);
Series3.Pointer.Visible := true;
end;
end.
Thank you in advance for your help
Didier