Page 1 of 1

How to negate a serie

Posted: Wed Nov 05, 2008 8:36 am
by 10547507
I'm using the Standard Deviation function within the design-mode.
Now I'm looking for a negate function, to create a new serie with the
negated data of the StdDev-Serie.

Maybe the subtract-function with a const like

StdDevMinSerie := 0 - StdDdv

What can I do

Posted: Wed Nov 05, 2008 9:49 am
by narcis
Hi Achim,

You can do something like this:

Code: Select all

  Series2.Clear;
  for i:=0 to Series1.Count-1 do
  begin
    Series2.AddXY(Series1.XValue[i], -Series1.YValue[i]);
  end;
You can also use custom function as shown in the example at All Features\Welcome!\Functions\Extended\Custom y=f(x) at the new features demo, available at TeeChart's program group.

Hope this helps!

Posted: Wed Nov 05, 2008 11:51 am
by 10547507

You can do something like this:

Code: Select all

  Series2.Clear;
  for i:=0 to Series1.Count-1 do
  begin
    Series2.AddXY(Series1.XValue[i], -Series1.YValue[i]);
  end;
But where is the best place(event) for this code. After showing a form I set query.active to true, and then the chart is shown.
You can also use custom function as shown in the example at All Features\Welcome!\Functions\Extended\Custom y=f(x) at the new features demo, available at TeeChart's program group.
Hm.. I' cannot set the OnCalculate property, because I don't find it, neither in the chart nor at the series. In short: I need a tutorial how to find the OnCalculate property at the Objectinspector. :-)
[/quote]

Posted: Wed Nov 05, 2008 12:11 pm
by narcis
Hi Achim,
But where is the best place(event) for this code. After showing a form I set query.active to true, and then the chart is shown.
You can use this code after activating the query or even in Series1 OnAfterAdd event.
Hm.. I' cannot set the OnCalculate property, because I don't find it, neither in the chart nor at the series. In short: I need a tutorial how to find the OnCalculate property at the Objectinspector.
You need to select function, for example TeeFunction1 and go to its events tab in the object inspector.

Posted: Wed Nov 05, 2008 1:34 pm
by 10547507
You can use this code after activating the query
Thanks, that works.
You need to select function, ....
I don't find it.

I drop a dbchart to a form, double-click on it -> Add.. -> functions -> y=f(x) . I get the serie1 in the serieslist.
After selecting the dbchart on the form, I saw the chart-properties in the objectinspector, but there is no property with name 'functions'. There is also the property 'SeriesList'. After selecting it, I can choose a serie and see its series-properties, even without 'functions'. Maybe I'm to stupit, but I cannot find it.

Posted: Wed Nov 05, 2008 1:41 pm
by narcis
Hi Achim,

No, you need to select TeeFunction1 object in the Object Inspector instead of DBChart1.

Posted: Wed Nov 05, 2008 2:31 pm
by 10547507
No, you need to select TeeFunction1 object in the Object Inspector
Wow, I've found it. It's the first time I've select a component in this way, after several 'delphi-years'. I've always select an icon or component on the form to access the properties. :oops: