Legend on top of chart?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Whookie
Newbie
Newbie
Posts: 28
Joined: Fri Sep 24, 2004 4:00 am

Legend on top of chart?

Post by Whookie » Tue Feb 22, 2011 6:07 pm

As I'm showing the legend of my chart only on demand (click) i would like to have it drawn on top of the grid and all series (lower image) but it seems always to be shown below (lower image).
Is there a way to accomplish this?
legend.JPG
legend.JPG (19.44 KiB) Viewed 5583 times
TIA

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Legend on top of chart?

Post by Sandra » Wed Feb 23, 2011 12:55 pm

Hello TIA,

I couldn't reproduce your problem using last version 2010. Can you please, send us a simple project we can run as-is here? So we try to find a solution for your problem. Moreover you can tell us which version of TeeChartVCL you are using now?

Thanks,
Best Regards,
Sandra Pazos / 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

Whookie
Newbie
Newbie
Posts: 28
Joined: Fri Sep 24, 2004 4:00 am

Re: Legend on top of chart?

Post by Whookie » Wed Feb 23, 2011 6:15 pm

I've attached a simple form (no code). When I open the form the legend is drawn behind everything (actually showing the back wall completly hides the legend). This is the form, where yesterdays screenshot origins from.

I've had that with the older version of tchart as well as with the current (2010.02.20202).

TIA (which means Thanks In Advance :wink: )
Attachments
demo.7z
(2.66 KiB) Downloaded 464 times

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

Re: Legend on top of chart?

Post by Narcís » Thu Feb 24, 2011 11:56 am

Hi Whookie,

Ok, I had to look at the form in text mode then :wink:

The problem was ResizeChart property set to false. To achieve what you request you should set legend to a custom position as in the code snippet below.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart.Legend.ResizeChart:=True;
  Chart.Legend.CustomPosition:=True;
  Chart.Draw;
end;

procedure TForm1.ChartAfterDraw(Sender: TObject);
begin
  Chart.Legend.Left:=Chart.ChartRect.Right - Chart.Legend.Width - 10;
  Chart.Legend.Top:=10;
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

Post Reply