Page 1 of 1

Statistics tool

Posted: Tue Jul 17, 2007 7:39 am
by 9337158
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

Posted: Wed Jul 18, 2007 10:23 am
by Pep
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.

Statistics tool

Posted: Thu Jul 19, 2007 7:05 am
by 9337158
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

Posted: Mon Jul 30, 2007 3:12 pm
by Pep
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;

Statistics tool

Posted: Tue Aug 07, 2007 7:42 am
by 9337158
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

Posted: Tue Aug 07, 2007 8:23 am
by narcis
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;