Hi everyone,
I'm plotting a FastLine series with data that's cyclical over time, for example a share price over a couple of years. I'd like to add another series on top of this one that indicates a trend on the original plot. For example when the share price is equal to a particular value, a point is plotted in the new series. I've looked at all the various function types and tools and can't seem to figure out how to do this. Any ideas on how this can be achieved in TeeChart, without crunching the underlying dataset in code?
Thanks,
Conutz.
Trending a primary series
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Trending a primary series
Hi Conutz,
There's no specific function for that. However, you can use Series OnAfterAdd event, for example:
There's no specific function for that. However, you can use Series OnAfterAdd event, for example:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
for i:=0 to 1000 do
Series1.Add(i mod 100);
end;
procedure TForm1.Series1AfterAdd(Sender: TChartSeries;
ValueIndex: Integer);
const
CompareValue = 50;
var
tmp: Double;
begin
tmp:=Series1.YValues[ValueIndex];
if tmp = CompareValue then
Series2.AddXY(Series1.XValue[ValueIndex], tmp);
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Trending a primary series
Hi Narcis,
that will work well. Thank you.
Conutz.
that will work well. Thank you.
Conutz.