var Form1: TForm1; Xmin, Xmax, Ymin, Ymax, Hx, Hy, h, x, y : Real; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin try Xmax:=StrToFloat(Edit1.Text); Xmin:=StrToFloat(Edit2.Text); Ymax:=StrToFloat(Edit3.Text); Ymin:=StrToFloat(Edit4.Text); Hx:=StrToFloat(Edit5.Text); Hy:=StrToFloat(Edit6.Text); H:=StrToFloat(Edit7.Text); except MessageBeep(Error); MessageDlg('Неверно заданы параметры', mtError, [mbOk], 0); end; Chart1.BottomAxis.Minimum:=Xmin; Chart1.BottomAxis.Maximum:=Xmax; Chart1.LeftAxis.Minimum:=Ymin; Chart1.LeftAxis.Maximum:=Ymax; Chart1.BottomAxis.Increment:=Hx; Chart1.LeftAxis.Increment:=Hy; Form1.Button1Click(Sender); end; procedure TForm1.Button1Click(Sender: TObject); begin Series1.Clear; x:=Xmin; While x<=Xmax do begin y:=StrToFloat(Edit8.Text); Series1.AddXY(x, y, '', clTeeColor); x:=x+h; end; end; end. 

Can you please tell me how to enter a function from the edit?

  • 3
    Write a parser of algebraic expressions. - Nofate

2 answers 2

I need at least an elementary interpreter of functions; I would certainly recommend using ready-made RemObjects Pascal Script III Copyright (C) 2000-2012 by Carlo Kok (ck@carlo-kok.com) full pascal in your application

    Function, as I understand it, to display in TChart as a graph? If the type of the function does not change, scatter the coefficients by edit and calculate the new values ​​of y through each step h along the x-axis.

    • Yes, the function for displaying graphs. I need the user to enter any function in Edit and it was built in Tchart. - Black_sinigami