Get a BarSeries by Index

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
AchatSolutions
Newbie
Newbie
Posts: 20
Joined: Wed Jul 11, 2001 4:00 am
Location: Bavaria
Contact:

Get a BarSeries by Index

Post by AchatSolutions » Thu Dec 06, 2007 2:19 pm

Hello supportteam,

I am using Delphi 6 and TeeChart Pro v5.02.

I have a teechart with a dynamic amount of series.

Image
Big version

So i add Series1 for 'Line19', 'Line20' and for 'Line21'. So i have three bars displayed but only one series.
When i add this series i would like to add the index of this three bars to a list.

But how can i do this? How do i know the index e.g. for Series1 'Line21'?

Background information:
When i add the series i would like to add the series index to a list with more information about this bar.

Then i would like to add a individual mark text for each displayed bar in the 'OnMarkTextEvent'.

Do you know a better way how to tagging a bar to add a individual mark text?

TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

Post by TestAlways » Fri Dec 07, 2007 1:36 am

OnMarkTextEvent has an index param (ValueText), so you should be able to to the value--or am I missing something?

AchatSolutions
Newbie
Newbie
Posts: 20
Joined: Wed Jul 11, 2001 4:00 am
Location: Bavaria
Contact:

Post by AchatSolutions » Fri Dec 07, 2007 8:13 am

Thanks for the answer.

Yep thats right.. but i need the index param when i am adding a value to the bar --> outside the OnMarkTextEvent.

I need this because i would like to save more information about this bar in a list when adding a y value to the bar. Then in the OnMarkTextEvent i would like to search the list items which one has the same index param and then add a mark text that is in the list item to show an individual text for every bar.



Hope thats clear. Thanks!

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 Dec 07, 2007 10:22 am

Hi AChatSoluions,

You can obtain each series and point indexes like this:

Code: Select all

Uses Series;

procedure TForm1.FormCreate(Sender: TObject);
var SeriesIndex, ValueIndex: Integer;
    tmpSeries: TChartSeries;
begin
  tmpSeries:=Chart1.AddSeries(TBarSeries.Create(self));
  SeriesIndex:=Chart1.SeriesList.IndexOf(tmpSeries);

  ValueIndex:=Chart1.Series[SeriesIndex].Add(random);

  Chart1.Title.Text.Clear;
  Chart1.Title.Text.Add(IntToStr(SeriesIndex));
  Chart1.Title.Text.Add(IntToStr(ValueIndex));
end;
Hope this helps!
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

AchatSolutions
Newbie
Newbie
Posts: 20
Joined: Wed Jul 11, 2001 4:00 am
Location: Bavaria
Contact:

Post by AchatSolutions » Tue Dec 11, 2007 4:10 pm

Thank you very much, it works :D

Post Reply