Equal axis scales

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
kfugate
Newbie
Newbie
Posts: 2
Joined: Fri Nov 15, 2002 12:00 am

Equal axis scales

Post by kfugate » Thu Jul 12, 2007 6:32 pm

How do I set equal axis scales so my map displays properly? When the map displays, it gets exanded out to fill the window, distorting the ratio of the x and y scales. I'm using pro version 5 with C++ Builder 6.

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Thu Jul 12, 2007 10:26 pm

Hi, look here: Isometric axis and TeeChart Pro -
http://www.steema.com/support/teechart/ ... %20Pro.htm

kfugate
Newbie
Newbie
Posts: 2
Joined: Fri Nov 15, 2002 12:00 am

Post by kfugate » Fri Jul 13, 2007 11:34 pm

Thanks.

Had to modify it a bit by changing the HORZSIZE and VERTSIZE to HORZRES and VERTRES because Screen->Width and Screen->Height are in pixels and the SIZE variables are in millimeters. Below is the C++ code for the method.

Code: Select all

void TInputForm::MakeISOAxis(TCustomChart *AChart)
{
    double tmpX, tmpY, XRange, YRange, Offset, XYScreen;

    if ((AChart->ChartHeight > 0)&&(AChart->ChartWidth > 0))
    {
        XRange = AChart->BottomAxis->Maximum - AChart->BottomAxis->Minimum;
        YRange = AChart->LeftAxis->Maximum - AChart->LeftAxis->Minimum;

        XYScreen = 1.0*(GetDeviceCaps(AChart->Canvas->Handle,HORZRES)/Screen->Width)
            /(GetDeviceCaps(AChart->Canvas->Handle,VERTRES)/Screen->Height);

        tmpX = XRange/AChart->ChartWidth;
        tmpY = (YRange/AChart->ChartHeight)*XYScreen;

        if (tmpX > tmpY)
        {
            if (tmpY != 0.0)
            {
                Offset = ((YRange*tmpX/tmpY)-YRange)/2.0;
                AChart->LeftAxis->SetMinMax(AChart->LeftAxis->Minimum-Offset,
                    AChart->LeftAxis->Maximum+Offset);
            }
        }
        else
        {
            if (tmpX != 0.0)
            {
                Offset = ((XRange*tmpY/tmpX)-XRange)/2.0;
                AChart->BottomAxis->SetMinMax(AChart->BottomAxis->Minimum-Offset,
                    AChart->BottomAxis->Maximum+Offset);
            }
        }
    }
}

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Sat Jul 14, 2007 10:31 pm

Don't you think that
GetDeviceCaps(AChart->Canvas->Handle,HORZRES)==Screen->Width
? :? [/quote]
Using HORZSIZE in this case allows take into account the aspect of a device.

wwp3321
Newbie
Newbie
Posts: 60
Joined: Wed Jul 02, 2003 4:00 am

Post by wwp3321 » Thu Dec 18, 2008 2:39 am

Thanks :D

Post Reply