How to define picture size in chart editor for export?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
ulibru
Newbie
Newbie
Posts: 54
Joined: Tue Jul 21, 2009 12:00 am

How to define picture size in chart editor for export?

Post by ulibru » Sun Mar 14, 2010 3:50 pm

Hi,

I can open the chart editor during runtime and export a chart as e.g. a bmp picture.
The editor window shows a picture size automatically derived from chart.width and chart.height
In the according edit fields it is possible to manually edit the width and heigth data.

How to fill these parameters by the application program? To set the chart dimension in the OnShow event of the chart editor does not help as it also changes the chart size on the screen.

Thanks for any advice

Uli

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

Re: How to define picture size in chart editor for export?

Post by Yeray » Mon Mar 15, 2010 9:42 am

Hi Uli,

You could change the chart's width and height before opening the editor and not allowing the chart to be redrawn with autorepaint=false:

Code: Select all

uses Series, TeeEdit;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.Width:=300;
  Chart1.Height:=200;

  with Chart1.AddSeries(TBarSeries.Create(self)) do FillSampleValues();
end;

procedure TForm1.Button1Click(Sender: TObject);
var oldWidth, oldHeight: Integer;
begin
  Chart1.AutoRepaint:=false;
  oldWidth:=Chart1.Width;
  oldHeight:=Chart1.Height;
  Chart1.Width:=600;
  Chart1.Height:=400;

  with TChartEditor.Create(self) do
  begin
    Chart:=Chart1;
    Execute;
  end;

  Chart1.AutoRepaint:=true;
  Chart1.Width:=oldWidth;
  Chart1.Height:=oldHeight;
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

ulibru
Newbie
Newbie
Posts: 54
Joined: Tue Jul 21, 2009 12:00 am

Re: How to define picture size in chart editor for export?

Post by ulibru » Tue Mar 16, 2010 7:21 am

Thanks.

Uli

Post Reply