Page 1 of 1

How to define picture size in chart editor for export?

Posted: Sun Mar 14, 2010 3:50 pm
by 10553945
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

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

Posted: Mon Mar 15, 2010 9:42 am
by yeray
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;

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

Posted: Tue Mar 16, 2010 7:21 am
by 10553945
Thanks.

Uli