Hi,
I read the article "Introduction to function". Before I start to use it, I want to ask a question, how to use AddPoint() to control the number of points added to the function series, ex. every two points of the original series.
Thanks.
Best regards
Fang
TTeeFunction question
-
- Newbie
- Posts: 27
- Joined: Sat Dec 06, 2003 5:00 am
- Location: baltimore
Hi.
In the AddPoints method you could use it's SourceSeries parameter to retrieve source series xvalues, yvalues, count, etc.. Here is an example of copying every second point from source to targer series (pseudo code)
There are several good examples of AddPoints implementation available in TeeChart sources. Check the StatChar.pas, the TMACDFunction.AddPoints implementation.
BTw, in many cases when function is not a very complicated one it's a lot easier and simpler to override the Calculate and (optionally) CalculateMany methods.
In the AddPoints method you could use it's SourceSeries parameter to retrieve source series xvalues, yvalues, count, etc.. Here is an example of copying every second point from source to targer series (pseudo code)
Code: Select all
procedure TYourFunction.AddPoints(Source: TChartSeries);
var N,i: Integer;
begin
N := Source.Count;
if N > 0 then
for i := 0 to N-1 do
if (i MOD 2 = 0) then ParentSeries.AddXY(Source.Xvalues[i],Source.YValues[i]);
end;
BTw, in many cases when function is not a very complicated one it's a lot easier and simpler to override the Calculate and (optionally) CalculateMany methods.
Marjan Slatinek,
http://www.steema.com
http://www.steema.com
-
- Newbie
- Posts: 27
- Joined: Sat Dec 06, 2003 5:00 am
- Location: baltimore
Thanks.
Here's another question.
I tried the teeFunction, but it gives me an exception whenever I close my application.
I am using v6pro, and I read in the v7 feature website, it says series.datasources had a bug which will cause access violation. I am not sure if it's exactly what happened to my case.
Because if I put the teeFunction example into a seperate program, it works fine. So I am not positive what's going on.
fang
Here's another question.
I tried the teeFunction, but it gives me an exception whenever I close my application.
I am using v6pro, and I read in the v7 feature website, it says series.datasources had a bug which will cause access violation. I am not sure if it's exactly what happened to my case.
Because if I put the teeFunction example into a seperate program, it works fine. So I am not positive what's going on.
fang
Hi,
A solution is to place the RemoveAllSeries and FreeAllSeries methods in the OnFormClose event.
Yes, I think it could be related with the same bug, it happens when you close the app.I am using v6pro, and I read in the v7 feature website, it says series.datasources had a bug which will cause access violation. I am not sure if it's exactly what happened to my case.
A solution is to place the RemoveAllSeries and FreeAllSeries methods in the OnFormClose event.
Pep Jorge
http://support.steema.com
http://support.steema.com