Page 1 of 1

Breaking up the legend

Posted: Tue Oct 07, 2008 3:43 am
by 8573707
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.

Posted: Wed Oct 15, 2008 2:45 pm
by narcis
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!