CLASS Ticks (Defined in: jpgraph.php : 4342)

Ticks
Set() SetColor() SetFormatCallback() SetLabelFormat() SetSide() SetSize() SetWeight() SupressFirst() SupressLast() SupressMinorTickMarks() SupressTickMarks() SupressZeroLabel()

Class usage and Overview
This is the abstract base class for ticks. Specifying the common signature for both linear and logartihmic ticks. Ticks are normally a property of the scale and can be accessed via the $graph->scale->ticks property.

Class Methods

function Set($aMaj,$aMin)
Set the distance between major and minor tick marks

Argument | Default | Description
--- | --- | ---
$aMaj |  | Distance (world coordinates) for major tick marks
$aMin |  | Distance (world coordinates) for minor tick marks

Description
Set the distance between major and minor tick marks. Note that when the scale is specified manually then the tick marks must also be specified manually.
See also
Graph::SetScale

Example

$graph->yaxis->scale->ticks->Set(10,5);

function SetColor($aMajorColor,$aMinorColor)
Set color for tick marks

Argument | Default | Description
--- | --- | ---
$aMajorColor |  | Major tick mark color
$aMinorColor | "" | Minor tick mark color

Description
Specify tick mark colors. If no minor tick mark color is specified then it will be the same as the major tick marks color.

Example

$graph->yaxis->scale->ticks->SetColor('red','black');

function SetFormatCallback($aCallbackFuncName)
Specify a format callback function for labels

Argument | Default | Description
--- | --- | ---
$aCallbackFuncName |  | name of function

Description
Specifies a callback function which will be called and given each tick label in turn as the argument. The callback function is supposed to return a proper formatted label to be displayed. Note: There is a shortcut to this method through the Axis::SetLabelFormatCallback. Note 2: The PHP function number_format() is often usefull in callback functions.
See also
Axis::SetLabelFormatCallback

Example

// Callback function for Y-scale. Use money format with
// a ',' to separate 1000:s
function yScaleCallback($aVal) {
return number_format($aVal);
}
// Short for $graph->yaxis->scale->ticks->SetFormatCallback()
$graph->yaxis->SetLabelFormatCallback('yScaleCallback');

function SetLabelFormat($aFormatString,$aDate)
Set format string for automatic labels

Argument | Default | Description
--- | --- | ---
$aFormatString |  | Specify a printf() style format string
$aDate | FALSE | No description available

Description
Specify a printf() style format string. Note: Can also be called trough the shortcut Axis::SetLabelFormatString()
See also
Ticks::SetFormatCallback

Example

$graph->yaxis->SetLabelFormatString("%-02.1f");

function SetSide($aSide)
Specify side of axis for ticks

Argument | Default | Description
--- | --- | ---
$aSide |  | Side

Description
Synonym for SetDirection(). Specify what side of the axis the tick marks should be drawn on. For Y -axis the possible directions are

- SIDE_LEFT
- SIDE_RIGHT

and for X-axis the possible parameters are

- SIDE_UP
- SIDE_DOWN

See also
Axis::SetTickSide, Axis::SetLabelSide and Axis::SetTitleSide

Example

$graph->xaxis->scale->ticks->SetSide(SIDE_UP);

function SetSize($aMajSize,$aMinSize)
Specify absolute size of tick marks in pixels

Argument | Default | Description
--- | --- | ---
$aMajSize |  | Major tick size
$aMinSize | 3 | Minor tick size

Description
Specify absolute size of tick marks in pixels

Example

$graph->xaxis->scale->ticks->SetSize(8,3);

function SetWeight($aWeight)
Specify width of tick marks

Argument | Default | Description
--- | --- | ---
$aWeight |  | Width (in pixels)

Description
Specify width of tick marks

Example

$graph->xaxis->scale->ticks->SetWeight(2);

function SupressFirst($aHide)
Hide the first tick mark

Argument | Default | Description
--- | --- | ---
$aHide | true | True=Hide the vbery first tick mark on the axis

Description
Hide the first tick mark on the axis.
See also
Ticks::SupressLast

Example

$graph->xaxis->scale->ticks->SupressFirst();

function SupressLast($aHide)
Hide the last tick mark

Argument | Default | Description
--- | --- | ---
$aHide | true | True=Hide the last tick mark

Description
Hide the last tick mark on the axis
See also
Ticks::SupressFirst

function SupressMinorTickMarks($aHide)
Hide all minor tick marks

Argument | Default | Description
--- | --- | ---
$aHide | true | True=Hide minor tick marks

Description
Hide all minor tick marks

function SupressTickMarks($aHide)
Hide major tick marks

Argument | Default | Description
--- | --- | ---
$aHide | true | True=Hide major tick marks

Description
Hide major tick marks
See also
Ticks::SupressMinorTickMarks

function SupressZeroLabel($aFlag)
Don't display the first zero label

Argument | Default | Description
--- | --- | ---
$aFlag | true | True=Hide zero-label

Description
Hide any label with numeric value == 0.0