Page 1 of 1

Legend Width

Posted: Mon Sep 03, 2007 11:33 am
by 9245471
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.

Posted: Mon Sep 03, 2007 12:57 pm
by narcis
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.

Posted: Mon Sep 03, 2007 1:16 pm
by 9245471
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?

Posted: Mon Sep 03, 2007 1:25 pm
by narcis
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;