Chart dimension and legend

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Calou
Advanced
Posts: 104
Joined: Wed Nov 19, 2008 12:00 am

Chart dimension and legend

Post by Calou » Thu Jun 11, 2009 12:32 pm

Hello,

I would like to have the chart dimension always the same even if the legend is hidden or not. How can i do to block the automatic autosize?

Regards

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Chart dimension and legend

Post by Yeray » Fri Jun 12, 2009 1:10 pm

Hi Calou,

The legend visible in one of the four default positions, adds an extra margin to the chart. So what you could do is to position the legend manually by the start. Something like following:

Code: Select all

uses series;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.AddSeries(TLineSeries.Create(self));
  Chart1[0].FillSampleValues(25);

  Chart1.Legend.CustomPosition := true;
  Chart1.MarginRight := 12;
  Chart1.Draw;
  Chart1.Legend.Left := Chart1.Axes.Bottom.IEndPos + 20;
  Chart1.Legend.Top := Chart1.Axes.Left.IStartPos;
  CheckBox1.Checked := true;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  Chart1.Legend.Visible := CheckBox1.Checked;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply