Page 1 of 1

Chart Height and Width

Posted: Wed Apr 08, 2009 2:42 pm
by 10547977
I placed on the form FMain: Chart1 (TChart) and Panel1 (TPanel) with Label1 and Label2 (TLabel). I used procedure TFMain.FormShow with two statements:
Label1.Caption:=IntToStr(Chart1.ChartHeight);
Label2.Caption:=IntToStr(Chart1.ChartWidth);
and procedure TFMain.Panel1Click with the same two statements.
However, at the start of my program, I obtain “0” and “0”, but when I click on Panel1, I obtain the actual height and the actual width of the Chart1. What is it? How I can obtain correct sizes of Chart1 right after the start of this program?

Posted: Thu Apr 09, 2009 8:40 am
by yeray
Hi avp,

I think that you'll need to force the chart to be drawn a first time if you want retrieve info from it that won't be updated until it will be drawn.

Code: Select all

Chart1.Draw;
Label1.Caption:=IntToStr(Chart1.ChartHeight);
Label2.Caption:=IntToStr(Chart1.ChartWidth);

Chart Height and Width

Posted: Fri Apr 10, 2009 12:46 am
by 10547977
Tank you very much!