Breaking up the legend

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Gerard
Newbie
Newbie
Posts: 26
Joined: Fri Nov 15, 2002 12:00 am
Location: Australia
Contact:

Breaking up the legend

Post by Gerard » Tue Oct 07, 2008 3:43 am

G'day,

I've currently got a graph that allows a number of series to be plotted. These series are actually divided into groups. For example, let's pretend I have three groups, each with a Quantity, Sold and Price series.

At the moment I'm just adding all the series to the legend, and that's fine, except you end up with something like:
[ ] Quantity [ ] Sold [ ] Price [ ] Quantity [ ] Sold etc

What I'd ideally like to know is if there's a way to break these down into their respective groups.
e.g.
Item1: [ ] Quantity [ ] Sold [ ] Price
Item2: [ ] Quantity [ ] Sold [ ] Price
Item3: [ ] Quantity [ ] Sold [ ] Price

I'd prefer to use the TeeChart legend, but if it comes to it I could probably figure something else out.

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 Oct 15, 2008 2:45 pm

Hi Gerard,

The best way would be creating several series groups. Setting each series to the group you want and then set "Series Groups" as legend style. This will make group names being displayed in the legend. Then you can customize each legend item text (directly or using the OnGetLegendText event). Here's an example modifying items directly:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
Chart1.Legend.Item[0].Text := 'Item1: [ ] Quantity [ ] Sold [ ] Price ';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.Draw;
end;
You'll find series groups examples at the new features demo, available at TeeChart's program group. You should go to the "Search" tab and search for "series groups".

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

Post Reply