unit Un_graph1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, TeeProcs, TeEngine, Chart, MathComponent,
  TeeFunci, Series;

type
  TGraph1 = class(TForm)
    Label1: TLabel;
    MathControl1: TMathControl;
    Graph: TChart;
    Series1: TLineSeries;
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Graph1: TGraph1;

implementation

{$R *.dfm}
uses Un_main;

procedure TGraph1.FormShow(Sender: TObject);
 var i, j: integer;
     s, s1, s2, s3:string;
     k:real;
begin
 s:=Main.FuncEd.Text;
 j:=1;
 Series1.Clear;
 for i:=1 to 10 do
  begin
   s1:=s;
   j:=1;
   while j<=length(s) do
    begin
     if s1[j]='x' then
      begin
       s2:=inttostr(i);
       s1:=copy(s1,1,j-1)+s2+copy(s1,j+1,length(s1)-j);
      end;
     inc(j);
    end;
   MathControl1.MathExpression:=s1;
   k:=MathControl1.MathResult;
   Series1.AddXY( i, MathControl1.MathResult, '' , clBlue );
  end;
end;

end.
