GRAPH.Scale

Previous  Next

 

nStatus = GRAPH.Scale(  BYVAL nControl AS INTEGER,

                        BYVAL axis     AS INTEGER,

                       [BYVAL lower    AS REAL = 0],

                       [BYVAL upper    AS REAL = 0] ) AS INTEGER

 

fRange = GRAPH.Scale( BYVAL nControl AS INTEGER,

                      BYVAL range    AS INTEGER ) AS REAL

 

bAutoScale = GRAPH.Scale( BYVAL nControl AS INTEGER ) AS INTEGER

 


 

Scales the specified axis or returns the current lower or upper ranges.  If lower and upper are the same (default) the axis is auto scaled.   When getting the range, combine the Axis number with the range you want to retrieve.  See example.

 

The last format will return the state of Auto Scaling.

 

Please Note; Current implementation will AutoScale both axis regardless what axis is specified.

 

The following CONSTs are defined in MyBASIC2_Graph.BIS

 

NG_Axis_X      = 1          ' Horizontal Axis

NG_Axis_1      = 1          ' Same as NG_Axis_X

NG_Axis_Y      = 2          ' Vertical Axis

NG_Axis_2      = 2          ' Same as NG_Axis_Y

 

NG_Range_Min   = 0xFFFF0000 ' Return Lower (Min) Range

NG_Range_Max   = 0xFFFE0000 ' Return Upper (Max) Range

 

 

Example:

 

' Auto scale Horizontal Axis

GRAPH.Scale( nControl, NG_Axis_X )

 

' Scale Vertical axis from 0 to 100

GRAPH.Scale( nControl, NG_Axis_Y, 0, 100 )

 

' Print Lower and Upper Range of X and Y Axis

PRINT "Axis Scale X: "; GRAPH.SCALE( nControl, NG_Axis_X+NG_Range_Min );" - ";_

                       GRAPH.SCALE( nControl, NG_Axis_X+NG_Range_Max ),

PRINT "Axis Scale Y: "; GRAPH.SCALE( nControl, NG_Axis_Y+NG_Range_Min );" - ";_

                       GRAPH.SCALE( nControl, NG_Axis_Y+NG_Range_Max ),