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

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Clara Genermont
Newbie
Newbie
Posts: 42
Joined: Mon Jun 11, 2007 12:00 am
Contact:

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

Post by Clara Genermont » Tue Nov 25, 2008 2:12 pm

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

Clara Genermont
Newbie
Newbie
Posts: 42
Joined: Mon Jun 11, 2007 12:00 am
Contact:

Post by Clara Genermont » Fri Nov 28, 2008 10:14 am

Hello Narcis...

Thank you for your HELP

Didier

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 28, 2008 10:48 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Clara Genermont
Newbie
Newbie
Posts: 42
Joined: Mon Jun 11, 2007 12:00 am
Contact:

Post by Clara Genermont » Fri Nov 28, 2008 1:54 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Mon Dec 01, 2008 2:30 pm

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Clara Genermont
Newbie
Newbie
Posts: 42
Joined: Mon Jun 11, 2007 12:00 am
Contact:

Post by Clara Genermont » Tue Dec 02, 2008 10:01 am

thank you very much :wink:

Didier

Post Reply