Page 1 of 1

Problem with smoothing

Posted: Fri May 12, 2006 9:19 am
by 8443014
I had the following routine working for some time but now it produces the error message "Chart exception... circular series dependences are not allowed" . Can someone explain what has gone wrong please?


procedure TForm1.SmoothingClick(Sender: TObject);
var
Tfunctiona: TSmoothingFunction;
i: Integer;
begin
Tfunctiona:=TSmoothingFunction.create(self);
Series21.SetFunction(Tfunctiona);

Tfunctiona.Interpolate:=false;
Tfunctiona.Factor:=4;

for i:= 0 to 20 do
begin

series21.datasources.clear;

series21.datasources.add(chart.series);
Series21.CheckDataSource;

chart.series.datasources.add(series21);
chart.Series.CheckDataSource;

end;
Series21.clear;
Series21.visible:= false;
TFunctiona.free;

end;

Mike Glazer

Posted: Fri May 12, 2006 9:48 am
by narcis
Hi Mike,

This is because, in the SmoothingClick procedure's for loop,

Series21 is being assigned Chart.Series as datasource and at the same time Chart.Series is being assigned Series21 as datasource.

Could you please let us know what are you trying to achieve so that we can suggest you a solution?

Smoothing problem

Posted: Fri May 12, 2006 9:53 am
by 8443014
Hi Narcis

I have several series , 0, 1 ,2 .... plotted on a chart. I want at the press of a button to smooth them all.

So what I did is to read each one into series21, smooth and then replot back in the original series one after another. I had this working some time ago nicely but it has now stopped.

Smoothing problem

Posted: Fri May 12, 2006 10:40 am
by 8443014
Hi Narcis
I have found a solution (see below) using the AssignValues method.
procedure TForm1.SmoothingClick(Sender: TObject);
var
Tfunctiona: TSmoothingFunction;
i: Integer;
begin
Tfunctiona:=TSmoothingFunction.create(self);
Series22.SetFunction(Tfunctiona);

Tfunctiona.Interpolate:=false;
Tfunctiona.Factor:=4;

for i:= 0 to 20 do
begin

series22.datasources.clear;

series22.datasources.add(chart.series);

Series22.CheckDataSource;
chart.series.assignvalues(Series22);
chart.Series.CheckDataSource;

end;
Series22.clear;
Series22.visible:= false;
TFunctiona.free;

end;