Page 1 of 1

exporting charts with legends in custom positions

Posted: Fri Apr 20, 2007 9:17 am
by 9337510
If you position the legend (using custom) you can export the chart and all works well.

If you choose to reduce the size of the metafile then the legend disappears.

As far as I can understand it - it remains in the same position but as I have chosen to shrink the graph it has fallen off the canvas?

If you then place it on the right of the chart - it does not reduce in size in the same way as the chart - so you end up with a tiny graph and a big legend.

Richard

Posted: Fri Apr 20, 2007 1:40 pm
by narcis
Hi Richard,

This is probably because instead of assigning an absolute position to the legend you should assign a relative position. The position could be relative to any series point, axes position, chart borders, etc.

Posted: Fri Apr 20, 2007 1:56 pm
by 9337510
I am just moving it using the two scroll edits in the tchart editor - is there some other way?

Posted: Fri Apr 20, 2007 3:28 pm
by narcis
Hi Richard,

Yes, you can do this programmatically:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues();
  Chart1.Draw;

  With Chart1.Legend do
  begin
    CustomPosition:=true;
    Left:=Chart1.Axes.Left.PosAxis;
    Top:=Chart1.Axes.Left.IStartPos;
  end;
end;