Page 1 of 2

Teechartpro 7.12 Drawing a graph

Posted: Fri Aug 01, 2008 9:24 am
by 9350489
Hi Narcis,

Can we draw the graph of any function with
teechart directly with his equation?


Thank you for your help

Didier

Posted: Fri Aug 01, 2008 9:35 am
by narcis
Hi Didier,

Yes, you can use custom function. You'll find an example at All Features\Welcome!\Functions\Extended\Custom y=f(x) in the new features demo, available at TeeChart's program group.

Posted: Sun Aug 03, 2008 9:37 pm
by 9350489
thank you Narcis,

but I can't draw a function like this

y=2+3*(1+x)-5 + (abs(-x^2) - x*x) * 2 - 1/(x + 1)
or yet
y=sinx + cosx - abs(tanx) + x


How can draw them ?

I don't understand how to intoduce this equation...

Can you show me an example ?

thank you very much for your help

Didier

Posted: Mon Aug 04, 2008 7:41 am
by yeray
Hi Clara,

This works for me here.

Code: Select all

procedure TForm1.TeeFunction1Calculate(Sender: TCustomTeeFunction;
  const x: Double; var y: Double);
begin
  //y := 2+3*(1+x)-5 + (abs(power(-x,2)) - x*x) * 2 - 1/(x + 1);
 y := sin(x) + cos(x) - abs(tan(x)) + x;
end;

Posted: Mon Aug 04, 2008 5:06 pm
by 9350489
sorry but
what is TeeFunction1Calculate ?
event, object or a component ?

thank you in advance

Posted: Tue Aug 05, 2008 8:21 am
by yeray
Hi Didier,

It's an event for TCustomTeeFunction. You should find it through Object inspector as usually if you added the function at design time (at the function object, not the series).

Posted: Tue Aug 05, 2008 3:13 pm
by 9350489
Yès, il found it and I choose Y= f(x)

but Idon't see the event ! (F11 on the Teechart)

thanks

Didier

Posted: Tue Aug 05, 2008 4:02 pm
by Marc
Hello Didier,

When the function has been selected by editor, close the editor and F11 will take you to the object inspector. Select 'TeeFunction1' from the drop-down combobox and click on the Object Inspector's Events tab. From here you can select the event.

Regards,
Marc Meumann

Posted: Wed Aug 06, 2008 9:35 am
by 9350489
I don't see the event
I choose "functions" and "y = f(x)"

then in the combobox I see Y= f(x) not TeeFunction1
and on F11

I don't see "OnCalculate"

????

nb:
version 7.12[/url]

Posted: Thu Aug 07, 2008 7:29 am
by yeray
Hi Didier,

That's strange. You should see a series and a teefunction.
Another test you can do could be to add a chart (and a function) to a new form at design time and see the declarations in the code generated. For me:

Code: Select all

 //...
type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TLineSeries;
    TeeFunction1: TCustomTeeFunction;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
//...

Posted: Thu Aug 07, 2008 12:31 pm
by 9350489
yès !

that's good !!! :D :D :D :D :D

I had a little concern with the installation...

THANK YOU VERY MUCH

Posted: Fri Aug 08, 2008 7:27 am
by yeray
Hi Didier,

I'm happy to see that!

Posted: Mon Nov 24, 2008 11:02 am
by narcis
Hi Didier,

Please notice that I have splitted your last post into a new topic:

http://www.teechart.net/support/viewtopic.php?t=8798

It's better starting a new topic for each now issue. It's easier to follow up.

Posted: Mon Apr 27, 2009 9:19 am
by 8571714
Hi Narcis,

How can I Draw this function with TeeFunction1Calculate
with three parameters :

Qf, S, Sa that can be defined by double
(exemple : Qf = 1, S = 8, Sa =4,3)

Code: Select all

y := (Qf * S * 0.36 * x) / Sa;
for this moment, I have a message "operation en virgule flottante incorrecte"

Thank you for your help

Didier

Posted: Mon Apr 27, 2009 9:42 am
by narcis
Hi Didier,

You can do this:

Code: Select all

procedure TForm1.TeeFunction1Calculate(Sender: TCustomTeeFunction;
  const x: Double; var y: Double);
const
  Qf = 1;
  S = 8;
  Sa = 4.3;
begin
  y := (Qf * S * 0.36 * x) / Sa;
end;
If those constants need to be modified then you can create them as global variables in your unit.

Hope this helps!