Class LinearScale
(Defined in: jpgraph.php : 4397)

Class usage and Overview
This class is the main scale class and implements the linear and integer scale for the axis.


See also related classes:
Axis and LogScale


Class Methods


LinearScale ::
Fix the maximum value for a scale

$aMax  Maximum value

Fix a maximum value for a scale eventhough autoscaling is used for the min value. 


// For a negative scale we might want to make sure it
// always start at the top from 0


LinearScale ::
Set the minimum data value when the autoscaling is used.

$aMin  Min value

Set the minimum data value when the autoscaling is used. Usefull if you want a fix minimum (like 0) but automtic maximum value. 


// Just let the maximum be autoscaled


LinearScale ::
Determine ticks automtically with manual scale

$aFlag true TRUE = determine ticks automatically

This is used in conjunction when a manual scale is specified. In normall cases one has also to specify major and minor tick steps.

For example:

However by instead using


The major and minor ticks are determined automatically.

The thing you have to be aware of is that the specified min and max values might be slightly modified so that the end/beginning of the scale will fall on a major tick step.

By default the auto ticks are off.  

See also:


// Manually set Y-scale min=30, max=90

// Let JpGraph figure out suitable tick marks


LinearScale ::
SetGrace($aGraceTop, $aGraceBottom)
// Specify scale "grace" value (top and bottom)

$aGraceTop  Top grace value
$aGraceBottom 0 Bottom grace value

By default the autoscaling determines the minimum and maximum as close to the plots min and max values as possible. Sometimes this might not be suitable and you need some more "air". For example if you plot a bar plot with values on top of the bar. If the bar reaces the max value (which is also the scale end point) the value on top of the bar might be out in the margin.)

By specifyin the grace you get added space. The value specified is interpretated as extra percentage of the total scale range.

For example if the scale range (without grace) is (0,100) and you add 10% top grace (with SetGrace(10)) the modified scale will be (0,110) and if you use a 100% top grace the scale will be (0,200) and so on.