Page 1 of 1

Position of a SubChart

Posted: Fri Oct 29, 2010 4:20 pm
by 16556791
Hello,
we have to position a SubChart outside the Chart Axis, e.g. under the Chart.Legend. Because the SubChart should not hide any info of the Main chart, but if we try this to position the SubChart under the Legend there are many problems :

procedure TGraphForm.ChartIntResize(Sender: TObject);
begin
ChartTool3.Charts[0].Chart.Left := ChartInt.Legend.Left -50 ;

ChartTool3.Charts[0].Chart.Top := ChartInt.Height - ChartTool3.Charts[0].Chart.Height -50 ;

end;

This code does not function well, because there is now way to deal with Form maximize and if only the Chart is resizing the SubChart is only following very slow the Main Chart Position.

Can you help us?

Your sincerely

Willi Ebert

Re: Position of a SubChart

Posted: Mon Nov 01, 2010 5:53 pm
by narcis
Hi Willi,

Could you please attach a simple example project we can run "as-is" to reproduce the problem here?

Thanks in advance.

Re: Position of a SubChart

Posted: Tue Nov 02, 2010 3:21 pm
by 16556791
Hello Narcís,
here is a test project. The SubChart stays not under the legend like it is defined in the Chart1Resize procedure.

Your sincerely

Willi

Re: Position of a SubChart

Posted: Tue Nov 02, 2010 3:52 pm
by narcis
Hi Willi,

Implementing OnResize as shown below works fine for me here. Chart needs to be drawn so that legend properties have correct values.

Code: Select all

procedure TForm2.Chart1Resize(Sender: TObject);
begin
  Chart1.Draw;
  ChartTool1.Charts[0].Chart.Left := Chart1.Legend.Left -50 ;
  ChartTool1.Charts[0].Chart.Top := Chart1.Legend.ShapeBounds.Bottom;
end;

Re: Position of a SubChart

Posted: Tue Nov 02, 2010 5:12 pm
by 16556791
Hello Narcís,
thank you very much for your help. Chart1.Draw was the key.

Your sincerely

Willi Ebert