Page 1 of 1

Chart re-sizing on different machines

Posted: Tue Mar 03, 2015 11:30 am
by 16470701
HI,

I have an application that charts stock prices, on my desktop it looks perfect, as it does on all my colleagues desktops, please see desktop.jpg

However on my laptop or when a projector is connected to a PC changes size. I have tried locking the aspect ratio, preventing re-sizing etc nothing seems to work, pls see laptop.jpg

I would be grateful for any suggestions

Thanks

Barry

Re: Chart re-sizing on different machines

Posted: Wed Mar 04, 2015 9:19 am
by yeray
Hello,

I see the chart doesn't take all the form width.
Can you reproduce the problem in a new simple project? If so, could you please send it to us?

Re: Chart re-sizing on different machines

Posted: Thu Mar 05, 2015 2:39 pm
by 16470701
I think I have sorted it, it looks like the chart does not keep its aspect ratio on different screen sorts so on a 1600 * 1200 screen it looks fine. However on a 1920*1080 screen it does not. What I had to do is work out the width of the form and then size the chart Dynamical using

Code: Select all

LeftAlignCharts([Chart1,Chart2],8,Form1.Width - 28);
where

Code: Select all

procedure TForm1.LeftAlignCharts(Const Charts: Array of TCustomChart; aLeft: Integer; aWidth: Integer);

// This procedure align's two charts on the form

var i: Integer;

begin
  for i := Low(Charts) to High(Charts) do
  With Charts[i] do
  begin
    Left := aLeft;
    MarginLeft := 0;
    Width := aWidth;
    Axes.Left.TitleSize := 15;
    Axes.Left.LabelsSize := 100;  // Needs to be big as numbers can run to millions
    Axes.Left.LabelsAlign := alDefault;
    Marginright := 1;    // This is in % not pixels
  end;
end;
Have not tested it on all screens but on 2 or 3 seems ok.

Re: Chart re-sizing on different machines

Posted: Fri Mar 06, 2015 9:06 am
by yeray
Hello,

I'm glad to hear you found how to make it work fine.
If you still find problems with it, don't hesitate to let us know.