Page 1 of 1

TeeChart Pro v 7.12 drawing a function y= f(x)

Posted: Tue Nov 25, 2008 2:12 pm
by 9350489
Hi Narcis,

here is my code :

Code: Select all

PROCEDURE TForm1.TeeFunction1Calculate(Sender: TCustomTeeFunction; 
CONST x: Double; VAR y: Double); 
BEGIN 
IF (Edit1.Text = Null) OR (Edit1.Text = '') THEN exit; 
y := StrToFloat(Edit1.Text); 
END; 

PROCEDURE TForm1.Edit1KeyDown(Sender: TObject; VAR Key: Word; 
Shift: TShiftState); 
BEGIN 
IF key = VK_RETURN THEN 
Series1.CheckDataSource; 
END; 
if I put x+2 in edit1 and hit the return key
I have EconvertError message

Can you help me ?

Didier

Posted: Fri Nov 28, 2008 10:14 am
by 9350489
Hello Narcis...

Thank you for your HELP

Didier

Posted: Fri Nov 28, 2008 10:48 am
by narcis
Hi Didier,

Sorry for the delayed reply but I needed to do some investigation on this field.

The only solution I can think of to solve this is using a mathematical formula expression parser.

Dew Research's MtxVec 3.5 includes TMxParser which can easily handle this. You can download a trial version here:

http://www.dewresearch.com/downloads-delphi.html

Demo, available here, includes several parser examples, together with full TeeChart support.

Posted: Fri Nov 28, 2008 1:54 pm
by 9350489
Hi Narcis,

Sorry you have asked to quickly ..
The solution you propose (parser) is interesting but seems too heavy for the moment ..
the error message is:
The project caused a Project1.exe class EConcertError exception with the message "x+2' is not a floating point value correcte.

I am not trying to solve all sorts of falling to a function to analyze ..

I would like to write a simple processing chain that sets the sake of "x+2'

the concern seems to be: "
Thank you very much for your help

Didier

Posted: Mon Dec 01, 2008 2:30 pm
by narcis
Hi Didier,

In that case you should implement your own parser. Something like what's done here:

http://www.jguru.com/faq/view.jsp?EID=480122

Searching on the internet I found there are several components for doing this but none of them is free:

http://www.sourcecodeonline.com/details ... arser.html

That's why I recommended using Dew Research's as MtxVec includes full TeeChart support.

Posted: Tue Dec 02, 2008 10:01 am
by 9350489
thank you very much :wink:

Didier