custom legend

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
seanmurphy
Newbie
Newbie
Posts: 48
Joined: Fri Mar 12, 2004 5:00 am

custom legend

Post by seanmurphy » Thu Nov 09, 2006 3:50 pm

D6Pro, Teechart 7.07, Chart with 4 lineseries. I would like to customise the legend so that I can add a columns for stats, so it could show say the average, and maybe the standard deviation and min and max. Is there a recommended way to do this?

thanks
Sean

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 Nov 10, 2006 8:38 am

Hi Sean,

It may help you doing something like the examples below in the features demo:

All Features\Welcome!\Miscellaneous\Legend\Drawing more text
All Features\Welcome!\Miscellaneous\Legend\Multiple legends

You'll find the features demo at the program group created by the binary installer.
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

seanmurphy
Newbie
Newbie
Posts: 48
Joined: Fri Mar 12, 2004 5:00 am

Post by seanmurphy » Tue Nov 14, 2006 10:16 pm

thanks, but I'm still having trouble. I have 32 Teecharts, each with one lineseries, the chartys stacked one above the other on a form. all charts are same height and width. I need all series and x-axes to align vertiocally, and all legends to align vertically.

I've got

procedure TLineplotfrm.Chart1GetLegendPos(Sender: TCustomChart;
Index: Integer; var X, Y, XColor: Integer);
begin
with charts[1].Legend do
customposition:=true;
x:=charts[1].width-100;
xcolor:=x-15;
end;

and this gives the alignment for charts and legends. But I can't see how to add columns to the legend. there is a demo which shows

chart1.legend.columnwidhs[0]:=
chart1.legend.columnwidhs[1]:=

but how do I add text to the columns.

I tried using the afterdraw of the charts with
with charts[1].Legend.shapebounds do
begin
WITH charts[1].Canvas do
begin
textalign:=ta_left;
font.Size:=8;
textout(charts[1].legend.left+30,bottom,'Text-1');
textout(left+30,bottom+10,'Text-2');
end;
end;

but this doesn't track correctly when the chart/form is resized in X, so it moves in its vertical alignment the series titles in the legend. I supect in the afterdraw I'm not getting the correct position of the legend.

thanks
Sean

Pep
Site Admin
Site Admin
Posts: 3295
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Nov 21, 2006 12:39 pm

Hi Sean,

I'm afraid that seeing the manner you want to get texts in the legend, the best way would be to draw your custom legend (using the Canvas techniques) directly onto the Chart canvas and not to use the Chart.Legend.

Post Reply