Statistics tool

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
stsl
Newbie
Newbie
Posts: 26
Joined: Mon Apr 19, 2004 4:00 am
Location: France

Statistics tool

Post by stsl » Tue Jul 17, 2007 7:39 am

Hi,

How is it possible to change, at runtime, the title caption of the statistics series created by the statistics tool ?

Is-it possible to change the curve fitting parameters when the use the curve fitting with the statistics tool ?

Regards

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jul 18, 2007 10:23 am

Hi,
How is it possible to change, at runtime, the title caption of the statistics series created by the statistics tool ?
If these have been created automatically (at runtime, via Editor) by the Statistics tool then one way to change its title would be to use the OnAddSeries event, something like this :

Code: Select all

procedure TForm1.Chart1AddSeries(Sender: TCustomChartSeries);
begin
 // Depending on Series type you can customize the title here..
 Chart1[Chart1.SeriesCount-1].Title :='Custom Title';
end;
If the function have been created by your hand in the code or design time, then you can reference to it and change it's titile,....
Is-it possible to change the curve fitting parameters when the use the curve fitting with the statistics tool ?
They cannot be accessed if Series asociated to a Function have not been created by code or designtime before to add the SeriesStats Tool, as the tool creates a internal (no visible) Series function with default values. In the other case, if the function series exists (created via code or designtime) then you can change its parameters by referencing directly to them.

stsl
Newbie
Newbie
Posts: 26
Joined: Mon Apr 19, 2004 4:00 am
Location: France

Statistics tool

Post by stsl » Thu Jul 19, 2007 7:05 am

Hi,

If the user add a statistic tool, how is it possible to know, in the OnAddSeries event, that the serie has been created by the statistic tool.
How is it possible to know, for example, that this is the median serie. I woul'd like to put the good title for the good serie ('Median' for the median serie).

It's very important, because we can't use the statistic tool with "Serie1, Serie2..."instead of "Median, Average, Trend..." titles.

Regards

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Mon Jul 30, 2007 3:12 pm

Hi,

you coud use similar code to the following :

Code: Select all

procedure TForm1.Chart1AddSeries(Sender: TCustomChartSeries);
var tmp : TTeeFunctionClass;
begin
  if assigned (Series1) then
    with Sender as tchartseries do
    begin
      if FunctionType=nil then
         tmp:=nil
      else
      begin
         tmp:=TTeeFunctionClass(FunctionType.ClassType);
         showmessage(tmp.classname);
         Chart1[Chart1.SeriesCount-1].Title :=tmp.ClassName;
      end
    end;
end;

stsl
Newbie
Newbie
Posts: 26
Joined: Mon Apr 19, 2004 4:00 am
Location: France

Statistics tool

Post by stsl » Tue Aug 07, 2007 7:42 am

Hi,

Thanks.
But i would like to know how is it possible to set a title like :
'Curve fitting (Serie nnn)'
If i have different statistics tool in a chart, i would like to distinguish the series linked to the function :
Curve fitting (Serie 1)
Curve fitting (Serie 2)

In the OnAddSerie event, I need to find the serie linked to a function. I didn't find how to do that.

Regards

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

Post by Narcís » Tue Aug 07, 2007 8:23 am

Hi stsl,

You can get the tool's series doing something like this:

Code: Select all

procedure TForm1.Chart1AddSeries(Sender: TCustomChartSeries);
var i: Integer;
    tmpSeries: TChartSeries;
begin

  for i:=0 to Chart1.Tools.Count-1 do
  begin
    if (Chart1.Tools[i] is TSeriesStatsTool) then
    begin
      tmpSeries:=(Chart1.Tools[i] as TSeriesStatsTool).Series;
    end;
  end;

end;
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

Post Reply