we made up a very simple program to use the smoothing function
which has a method called draw. when we "draw", we get a memory
access error at the setfunction line. The two series[Series1,2] are added in the chart editor. code is below: It compiles fine
***************************************************
Procedure Tform1.draw;
var
Tfunctiona:TsmoothingFunction;
Begin
series1.addXY(1,0,'',clTeeColor);
series1.addXY(2,2.5,'',clTeeColor);
series1.addXY(3,-1.6,'',clTeeColor);
series1.addXY(4,-0.5,'',clTeeColor);
series1.addXY(5,1.3,'',clTeeColor);
series1.addXY(6,1.5,'',clTeeColor);
series1.addXY(7,1.4,'',clTeeColor);
series1.addXY(8,-1.75,'',clTeeColor);
series1.addXY(9,-1.25,'',clTeeColor);
series1.addXY(10,1.3,'',clTeeColor);
series2.setfunction(Tfunctiona.create(self));
Tfunctiona.Interpolate:=true;
Tfunctiona.Factor:=4;
series2.datasources.clear;
series2.datasources.add(series1);
end;
************************************************************
Thanks,
Natalie
smoothing function
Hi, Jennifer.
The problem is the Tfunctiona.create(self); which has to be coded differently. The way you're using it you'll get AV error (because you're not actually calling the class construction). Here is corrected code which doesn't generate AV error:
The problem is the Tfunctiona.create(self); which has to be coded differently. The way you're using it you'll get AV error (because you're not actually calling the class construction). Here is corrected code which doesn't generate AV error:
Code: Select all
var
fFunctiona:TSmoothingFunction;
begin
series1.addXY(1,0,'',clTeeColor);
series1.addXY(2,2.5,'',clTeeColor);
series1.addXY(3,-1.6,'',clTeeColor);
series1.addXY(4,-0.5,'',clTeeColor);
series1.addXY(5,1.3,'',clTeeColor);
series1.addXY(6,1.5,'',clTeeColor);
series1.addXY(7,1.4,'',clTeeColor);
series1.addXY(8,-1.75,'',clTeeColor);
series1.addXY(9,-1.25,'',clTeeColor);
series1.addXY(10,1.3,'',clTeeColor);
tFunctiona := TSmoothingFunction.Create(Self);
series2.setfunction(tfunctiona);
Tfunctiona.Interpolate:=true;
Tfunctiona.Factor:=4;
series2.datasources.clear;
series2.datasources.add(series1);
end;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
smoothing function
Thanks-
We redid it as below and the strange thing is we have to clic k on draw
twice to get series 2 display. Click #1 shows source serties 1, while the second clicks causes both 1 and 2 to show.
**********************************************************
Procedure Tform1.draw;
var
Tfunctiona:TsmoothingFunction;
Begin
tfunctiona:=Tsmoothingfunction.create(self);
series2.setfunction(Tfunctiona);
Tfunctiona.Interpolate:=false;
Tfunctiona.Factor:=25;
series1.visible:=true;
series1.addXY(1,0,'',clTeeColor);
series1.addXY(2,2.5,'',clTeeColor);
series1.addXY(3,-1.6,'',clTeeColor);
series1.addXY(4,-0.5,'',clTeeColor);
series1.addXY(5,1.3,'',clTeeColor);
series1.addXY(6,1.5,'',clTeeColor);
series1.addXY(7,1.4,'',clTeeColor);
series1.addXY(8,-1.75,'',clTeeColor);
series1.addXY(9,-1.25,'',clTeeColor);
series1.addXY(10,1.3,'',clTeeColor);
series2.datasources.add(series1);
end;
We redid it as below and the strange thing is we have to clic k on draw
twice to get series 2 display. Click #1 shows source serties 1, while the second clicks causes both 1 and 2 to show.
**********************************************************
Procedure Tform1.draw;
var
Tfunctiona:TsmoothingFunction;
Begin
tfunctiona:=Tsmoothingfunction.create(self);
series2.setfunction(Tfunctiona);
Tfunctiona.Interpolate:=false;
Tfunctiona.Factor:=25;
series1.visible:=true;
series1.addXY(1,0,'',clTeeColor);
series1.addXY(2,2.5,'',clTeeColor);
series1.addXY(3,-1.6,'',clTeeColor);
series1.addXY(4,-0.5,'',clTeeColor);
series1.addXY(5,1.3,'',clTeeColor);
series1.addXY(6,1.5,'',clTeeColor);
series1.addXY(7,1.4,'',clTeeColor);
series1.addXY(8,-1.75,'',clTeeColor);
series1.addXY(9,-1.25,'',clTeeColor);
series1.addXY(10,1.3,'',clTeeColor);
series2.datasources.add(series1);
end;
Try adding
to your code.
Code: Select all
Series2.CheckDataSource;
Marjan Slatinek,
http://www.steema.com
http://www.steema.com