Example code using groups

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
nile
Newbie
Newbie
Posts: 25
Joined: Tue Jan 20, 2009 12:00 am
Location: Auckland
Contact:

Example code using groups

Post by nile » Wed Jan 21, 2009 9:18 pm

Hi,

Is there an example code of how to use chart groups? While easy enough to create from within the chart editor, getting them to display at runtime seems elusive.

nsm
To be or not to be. This is not the question. Rather it is a choice.

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 Jan 22, 2009 8:38 am

Hi nile,

You can use series groups like this:

Code: Select all

Chart1.SeriesGroups.Add;
Chart1.SeriesGroups.Items[0].Add(point1);
Chart1.SeriesGroups.Clear;
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

nile
Newbie
Newbie
Posts: 25
Joined: Tue Jan 20, 2009 12:00 am
Location: Auckland
Contact:

Post by nile » Fri Jan 23, 2009 1:31 am

Hi Narcis,

Thanks for your reply. However, this isn't quite what i had in mind. The interface I'm designing is zero code based, as all data is processed via dbchart from a virtual table. As such, using the charteditor, lets say i've got 3 groups. All, Std, Financial. Let's now add a combo box with these choices. Then ideally, if the user chooses Std, I would like my ChartListBox to display only the charts contained by the Financial group (and in order).

For this i was expecting something like:

ChartListBox->SeriesGroup = Chart->SeriesGroups->Items[0];

But when i do this, my ChartListBox is empty.

Cheers, Nile.
To be or not to be. This is not the question. Rather it is a choice.

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 Jan 23, 2009 8:29 am

Hi Nile,

Currently TChartListBox component doesn't support series groups. I added your request to the wish-list. In the meantime, you'll have to add all series in a group to TChartListBox.
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

nile
Newbie
Newbie
Posts: 25
Joined: Tue Jan 20, 2009 12:00 am
Location: Auckland
Contact:

Post by nile » Fri Jan 23, 2009 9:30 pm

Ah, okay. Would have thought this to be a natural extension of having groups with the listbox. Meanwhile is there an alternative you can suggest?

If I can cycle through the list of series available in a specific group, then I should be able to turn off the visibility that are not in the all group - or something similar?

Thanks, nile.
To be or not to be. This is not the question. Rather it is a choice.

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

Post by Narcís » Mon Jan 26, 2009 9:22 am

Hi nile,

Yes, you can do something like this:

Code: Select all

void __fastcall TForm4::FormCreate(TObject *Sender)
{
	Chart1->SeriesGroups->Add();
	Chart1->SeriesGroups->Items[0]->Add(Series1);
	Chart1->SeriesGroups->Items[0]->Add(Series2);

	Chart1->SeriesGroups->Add();
	Chart1->SeriesGroups->Items[1]->Add(Series3);
	Chart1->SeriesGroups->Items[1]->Add(Series4);

	for (int i = 0; i < Chart1->SeriesGroups->Items[0]->Series->Count; i++) {
		ChartListBox1->AddItem(Chart1->SeriesGroups->Items[0]->Series->Items[i]->Name,
								Chart1->SeriesGroups->Items[0]->Series->Items[i]);
	}
}
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

nile
Newbie
Newbie
Posts: 25
Joined: Tue Jan 20, 2009 12:00 am
Location: Auckland
Contact:

Post by nile » Mon Jan 26, 2009 8:52 pm

Got it - looks like this will do just fine.

Many thanks,
Nile.
To be or not to be. This is not the question. Rather it is a choice.

Post Reply