TChart Editor
TChart Editor
I would like to add a series at runtime that is a function of the series already run. The function would start with the second point of the first series with the X values being the same as the X values of the first series and the Y values computed as (X - Xprev)/(Y - Yprev) from the first series. Is this possible? Also, can the function itself be entered at runtime?
TChart Editor Functions
In relation to my last request, I am using Version 6 and would like to know if the standard functions for moving averages and exponential averages is available in V6?
Re: TChart Editor
Hi Roy,
- All features\Welcome !\Functions\Extended\Custom y=f(x)
- All features\Welcome !\Functions\Financial\Moving Average
- All features\Welcome !\Functions\Extended\Exp. Average
Have you tried using the custom function? You could do something similar to following:Roy wrote:I would like to add a series at runtime that is a function of the series already run. The function would start with the second point of the first series with the X values being the same as the X values of the first series and the Y values computed as (X - Xprev)/(Y - Yprev) from the first series. Is this possible? Also, can the function itself be entered at runtime?
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var source: TPointSeries;
line: TLineSeries;
func: TCustomTeeFunction;
begin
Chart1.View3D:=false;
source:=TPointSeries.Create(self);
Chart1.AddSeries(source);
source.FillSampleValues(100);
line:=TLineSeries.Create(self);
Chart1.AddSeries(line);
func:=TCustomTeeFunction.Create(self);
line.FunctionType:=func;
func.NumPoints:=source.Count-1;
func.StartX:=1;
line.DataSource:=source;
func.OnCalculate:=FunctionCalculate;
func.ReCalculate;
end;
procedure TForm1.FunctionCalculate(Sender:TCustomTeeFunction; const x:Double; var y:Double);
var ValueIndex: Integer;
begin
ValueIndex:=0;
while ((ValueIndex <Chart1[0].Count) and (Chart1[0].XValue[ValueIndex] < x)) do
Inc(ValueIndex);
if ((ValueIndex>0) and (ValueIndex<Chart1[0].Count) and (Chart1[0].YValue[ValueIndex] <> Chart1[0].YValue[ValueIndex-1])) then
y:=(Chart1[0].XValue[ValueIndex] - Chart1[0].XValue[ValueIndex-1]) / (Chart1[0].YValue[ValueIndex] - Chart1[0].YValue[ValueIndex-1]);
end;
Yes, I can see both functions in v6. You can see an example of all them in the features demo included with the installation:Roy wrote:In relation to my last request, I am using Version 6 and would like to know if the standard functions for moving averages and exponential averages is available in V6?
- All features\Welcome !\Functions\Extended\Custom y=f(x)
- All features\Welcome !\Functions\Financial\Moving Average
- All features\Welcome !\Functions\Extended\Exp. Average
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |