Parser Value Example

procedure TForm1.PlotBtnClick(Sender: TObject);

{Read a string and plot the function that this string represents.}

var i:Integer; x,dx:Double;

begin

Graph.DeleteAllSeries;

aParser.SetParseString(funcEdit.text);

x:=graph.HorzScale.axisMin;

dx:=(graph.HorzScale.axisMax-x)/(numpts-1);

With aParser Do

begin

for i:=1 to numPts do

begin

graph.RegisterDatum(1,x,Value(x));

x:=x+dx;

end;

end;

graph.SetSeriesStyle(1,clBlack,true,none);

Graph.Invalidate;

end;