Legend Width

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Corbie
Newbie
Newbie
Posts: 3
Joined: Thu Jun 07, 2007 12:00 am

Legend Width

Post by Corbie » Mon Sep 03, 2007 11:33 am

Hi

I have a legend on the graphs that I am printing.
If the title belonging to the TLineSeries that I am adding to the TChart has more than 65 characters, the legend is not displayed (even if it is just one of the titles is over the limit) if all the titles are shorter than 65 characters then the legend is displayed correctly.

is there any way round this limit?

I am using Delphi 7 and TeeChart Pro 7.07

Thanks in advance.

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 Sep 03, 2007 12:57 pm

Hi Corbie,

This happens either when legend's position is set to top or bottom and the legend is wider that ChartRect. Try making the chart wider and you'll see it admits more characters in the legend.
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

Corbie
Newbie
Newbie
Posts: 3
Joined: Thu Jun 07, 2007 12:00 am

Post by Corbie » Mon Sep 03, 2007 1:16 pm

Thanks for the reply

Yes I am setting the position to bottom, unfortunately I can't make the chart wider due to its position on the report.

is there any way to have a word wrap type property on the legend to cope with this scenario or is there a work around?

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 Sep 03, 2007 1:25 pm

Hi Corbie,

You can manually parse the text in the OnGetLegendText event. For example:

Code: Select all

procedure TForm1.Chart1GetLegendText(Sender: TCustomAxisPanel;
  LegendStyle: TLegendStyle; Index: Integer; var LegendText: String);
var tmpStr: String;
begin
  if (Length(LegendText) > 60) then
  begin
    LegendText:=copy(LegendText,0,60);
  end;
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