Problem with smoothing

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Thomas Klingler
Advanced
Posts: 103
Joined: Tue Mar 02, 2004 5:00 am
Location: Bad Wurzach
Contact:

Problem with smoothing

Post by Thomas Klingler » Fri May 12, 2006 9:19 am

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

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

Post by Narcís » Fri May 12, 2006 9:48 am

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?
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

Thomas Klingler
Advanced
Posts: 103
Joined: Tue Mar 02, 2004 5:00 am
Location: Bad Wurzach
Contact:

Smoothing problem

Post by Thomas Klingler » Fri May 12, 2006 9:53 am

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.

Thomas Klingler
Advanced
Posts: 103
Joined: Tue Mar 02, 2004 5:00 am
Location: Bad Wurzach
Contact:

Smoothing problem

Post by Thomas Klingler » Fri May 12, 2006 10:40 am

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;

Post Reply