Class Ticks
(Defined in: jpgraph.php : 3914)

Ticks
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

Ticks ::
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');

Ticks ::
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:

- AxisPrototype::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');

Ticks ::
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");

Ticks ::
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:

- AxisPrototype::SetTickSide()
- AxisPrototype::SetLabelSide()
- AxisPrototype::SetTitleSide()

Example:

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

Ticks ::
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);

Ticks ::
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);

Ticks ::
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();

Ticks ::
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()

Ticks ::
SupressMinorTickMarks($aHide)
Hide all minor tick marks

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

Description:
Hide all minor tick marks

Ticks ::
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()

Ticks ::
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