MakeIsoAxis

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Jerry
Newbie
Newbie
Posts: 3
Joined: Thu Jul 03, 2008 12:00 am

MakeIsoAxis

Post by Jerry » Mon Feb 16, 2009 5:24 pm

MakeIsoAxis does not always work well. Apparently, GetDeviceCaps always returns HORTSIZE = 320 and VERTZSIZE = 240 for some versions of Windows (XP and NT I think are two of them). Is there some other way that we can get this function to work properly?

XYScreen:=1.0*(GetDeviceCaps(Canvas.Handle,HORZSIZE)/Screen.Width)/
(GetDeviceCaps(Canvas.Handle,VERTSIZE)/Screen.Height);

-Jerry

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Feb 17, 2009 10:14 am

Hi Jerry,

Are you testing this allways with the same monitor? In that case, this happens because the call GetDeviceCaps returns the size in mm of your screen monitor.

Could you please explain what are you trying to achieve?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Jerry
Newbie
Newbie
Posts: 3
Joined: Thu Jul 03, 2008 12:00 am

Post by Jerry » Tue Feb 17, 2009 6:36 pm

I am trying to use the MakeIsoAxis function from the All Features demo under 'Isometric Axis' :

procedure MakeIsoAxis(Vertical, Horizontal: TChartAxis); overload;
var tmpX,
tmpY,
XRange,
YRange,
Offset,
XYScreen : Double;
begin
with Vertical.ParentChart do
if (ChartHeight>0) and (ChartWidth>0) then
begin
With Horizontal do XRange:=Maximum-Minimum;

tmpX:=(XRange/ChartWidth);

{$IFDEF CLX}
XYScreen:=1024.0/768.0; //TODO
{$ELSE}
XYScreen:=1.0*(GetDeviceCaps(Canvas.Handle,HORZSIZE)/Screen.Width)/
(GetDeviceCaps(Canvas.Handle,VERTSIZE)/Screen.Height);
{$ENDIF}

With Vertical do YRange:=Maximum-Minimum;

tmpY:=(YRange/ChartHeight)*XYScreen;

if tmpX>tmpY then
begin
if tmpY<>0 then
begin
Offset:=((YRange*tmpX/tmpY)-YRange)/2.0;
With Vertical do SetMinMax(Minimum-Offset,Maximum+Offset);
end;
end
else
if tmpX<tmpY then
begin
if tmpX<>0 then
begin
Offset:=((XRange*tmpY/tmpX)-XRange)/2.0;
With Horizontal do SetMinMax(Minimum-Offset,Maximum+Offset);
end;
end;
end;
end;

Using Windows XP the GetDeviceCaps function returns

HORZSIZE = 320
VERTZIZE = 240

The same monitor using Windows 2000 returns

HORZSIZE = 470
VERTZIZE = 293

From a brief search of the internet, it appears that a lot of other people have had the same problem and Windows XP and perhaps NT will always return these values regardless of what size monitor is attached.

So, if I use the 'Isometric Axis' feature in the demo and click 'Make axis Isometric' then 'square' area on the chart has an approximate width of 153 and a height of 125 millimeters.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Thu Feb 19, 2009 1:25 pm

Hi Jerry,

We've tested with different windows versions and couldn't reproduce the problem here. Could you please test if the following code replacing the line where GetDeviceCaps is called at MakeIsoAxis method works fine for you?

Code: Select all

XYScreen:=1.0*(GetSystemMetrics(SM_CXSCREEN)/Screen.Width)/
                  (GetSystemMetrics(SM_CYSCREEN)/Screen.Height);
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Jerry
Newbie
Newbie
Posts: 3
Joined: Thu Jul 03, 2008 12:00 am

Post by Jerry » Tue Feb 24, 2009 2:18 pm

I think that GetSystemMetrics(SM_CXSCREEN) and GetSystemMetrics(SM_CYSCREEN) are the exact same thing as sceen.width and screen.height and therefore XYScreen would always be equal to 1?

I'm testing Windows XP inside a virtual machine. Maybe the virtual machine is incapable of getting the correct values from GetDeviceCaps?

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Tue Feb 24, 2009 3:37 pm

Hi Jerry,

I've tested this with several windows and screens and now I think I've found the problem. It seems that having a comfortable proportional resolution the demo apparently works fine (or the error is small) and when the resolution is "strange" the demo doesn't return square axis.

I've added this to the wish list to be revised for further releases (TV52013894) but, are you using proportional resolutions? I mean, your characters look fine? With a comfortable resolution I can see that the demo doesn't work perfectly but its error is minimum (about ten pixels more in high than in width).

I can't recommend you a resolution because the "comfortable look" should depend on the combination of resolution and screen size.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply