GetASeries Method

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

GetASeries Method

Post by CCRyder » Tue Sep 19, 2006 9:02 am

Hi,
Can sombody explain the GetASeries method :?: I can't find any reference to it in the Users Guide.

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 » Tue Sep 19, 2006 9:21 am

Hi CCRyder,

You can find the reference at the help file:

The GetASeries function returns the FIRST Active Series in a Chart. If Chart has no Series, or none of the Series is Active, this function returns NIL.
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

CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

Post by CCRyder » Tue Sep 19, 2006 9:50 am

Thanks Narcis,
I was looking in the wrong place :oops:

CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

Post by CCRyder » Tue Sep 19, 2006 10:01 am

Hi Narcis,
How can I select a different series in a Gantt Chart. For instance I have a Gantt Chart with three Series and when I click on one of the bars in a different series that particular series should then be selected.

CCRyder

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

Post by Narcís » Tue Sep 19, 2006 10:09 am

Hi CCRyder,

You can do something like this:

Code: Select all

procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var i, SeriesIndex: Integer;
begin
 SeriesIndex:=-1;
 for i:=0 to Chart1.SeriesCount-1 do
  if (Chart1[i].Clicked(X,Y)<>-1) then
  begin
    SeriesIndex:=i;
    break;
  end;

 if (SeriesIndex<>-1) then
  Chart1[SeriesIndex].Color := clLime;
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
Image Image Image Image Image Image
Instructions - How to post in this forum

CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

Post by CCRyder » Tue Sep 19, 2006 10:59 am

Works perfect!

Thanks!

CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

Post by CCRyder » Tue Sep 19, 2006 4:31 pm

Hi Narcis,
Is there a way to find out how many bars are in a specific gantt series? What I am trying to do is create a graph containing more than one Gantt Series and when I add a new series (which can have the same date and time for some of the bars) I want to locate this series under the first set of bars without having to enter the Y positions manually.

Best regards,
CCRyder

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

Post by Narcís » Wed Sep 20, 2006 7:42 am

Hi CCRyder,

You can see the number of values (bars) a gantt series has using:

Code: Select all

  Series1.Count
To get its values and copy them to another series you could do something like this:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
  Series1.FillSampleValues();

  for i:=0 to Series1.Count-1 do
  begin
    Series2.AddGantt(Series1.StartValues[i],Series1.EndValues[i],Series1.YValues[i]);
  end;
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
Image Image Image Image Image Image
Instructions - How to post in this forum

CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

Post by CCRyder » Wed Sep 20, 2006 9:09 am

Thanks Narcis!

You are a Great help :D
Regards,
CCRyder

CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

Post by CCRyder » Wed Sep 20, 2006 12:12 pm

Hi Narcis,
Your suggestion works fine but I am running into a problem with the Left Axis Text. When I enter a new series into the Gantt Chart the previous series scrolls up but the text remains in the same position on the Left Axis. What do I have to do to get the text to scroll with the series?
Regards,
CCRyder

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

Post by Narcís » Wed Sep 20, 2006 12:33 pm

Hi CCRyder,

I'm not sure on how to reproduce this. Could you please send us an example we can run "as-is" or some code to reproduce the problem here?

You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.
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

CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

Post by CCRyder » Wed Sep 20, 2006 12:36 pm

Hi Narcis,
I guess I was a little fast on my last question. The Inserted Series appears above the previous series due to the sequence numbers that I am calculating. The problem is that for some reason the Bar Labels are not being inserted on the Left Axis.
Regards,
CCRyder

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

Post by Narcís » Wed Sep 20, 2006 1:04 pm

Hi CCRyder,

Sorry but I still don't know how to reproduce this issue. Could you please send us an example project, some code or further information on how to reproduce the problem here?

Thanks in advance.
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

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

Post by Narcís » Thu Sep 21, 2006 9:51 am

Hi CCRyder,

This is because only the labels for the first series in the chart are drawn. To achieve what you request you should use custom labels as shown in the “All Features\Welcome!\Axes\Labels\Custom Labels” example in the features demo available at TeeChart’s program group.

Also find attached the modified project at the attachments newsgroup.
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

CCRyder
Newbie
Newbie
Posts: 19
Joined: Fri Aug 11, 2006 12:00 am
Location: Germany
Contact:

Post by CCRyder » Thu Sep 21, 2006 10:29 am

Hi Narcis,
Your solution works great!!

Thanks!
Regards,
CCRyder

Post Reply