## Apache Zeta Components Manual :: Docs For Class ezcGraphChartElementLabeledAxis

### Graph::ezcGraphChartElementLabeledAxis

### Class ezcGraphChartElementLabeledAxis

Class to represent a labeled axis.

Axis elements represent the axis in a bar, line or radar chart. They are chart elements (ezcGraphChartElement) extending from ezcGraphChartElementAxis, where additional formatting options can be found. You should generally use the axis, which matches your input data best, so that the automatic chart layouting works best. Aavailable axis types are:

- ezcGraphChartElementDateAxis
- ezcGraphChartElementLabeledAxis
- ezcGraphChartElementLogarithmicalAxis
- ezcGraphChartElementNumericAxis

The labeled axis will accept any values and converts them to strings. The labeled axis does not know about any special meanings of values and maintains the order of the given labels with equidistant spaces between all values. If your data has a special meaning, like a set of numbers or dates, use one of the other more appropriate axis.

Because it is not always possible to fit all labels in a chart you may define the count of labels drawn using the $labelCount option. For all other labels only a small step will be rendered.

The labeled axis may be used like:

1. $graph=new ezcGraphLineChart ();
2. $graph->options->fillLines=210;
3. $graph->options->font->maxFontSize=10;
4. $graph->title='Error level colors';
5. $graph->legend=false;
7. $graph->yAxis=new ezcGraphChartElementLabeledAxis ();
8. $graph->yAxis-> axisLabelRenderer ->showZeroValue=true;
10. $graph->yAxis->label='Color';
11. $graph->xAxis->label='Error level';
13. // Add data
14. $graph->data['colors']=new ezcGraphArrayDataSet (
15. array(
16. 'info'=>'blue',
17. 'notice'=>'green',
18. 'warning'=>'orange',
19. 'error'=>'red',
20. 'fatal'=>'red',
21. )
22. );
24. $graph-> render (400,150,'tutorial_axis_labeled.svg');

Source for this file: /Graph/src/axis/labeled.php

    ezcBaseOptions
       |
       --ezcGraphChartElement
          |
          --ezcGraphChartElementAxis
             |
             --ezcGraphChartElementLabeledAxis

Version: | //autogentag//

### Constants

`MAX_LABEL_COUNT = 10` | Maximum count of labels which can be displayed on one axis

### Properties

float | read/write | `$labelCount` Define count of displayed labels on the axis

### Member Variables

protected array | `$displayedLabels = array()` Reduced amount of labels which will be displayed in the chart
protected array | `$labels = array()` Array with labeles for data
protected array | `$labelsIndexed = array()` Labels indexed by their name as key for faster lookups
protected array(ezcGraphAxisStep) | `$steps` Precalculated steps on the axis

### Inherited Member Variables

From ezcGraphChartElementAxis
protected | `ezcGraphChartElementAxis::$axisLabelRenderer`
protected | `ezcGraphChartElementAxis::$innerBoundings`
From ezcBaseOptions
protected | `ezcBaseOptions::$properties`

### Method Summary

public void | `addData( $values )` Add data for this axis
public abstract void | `calculateAxisBoundings( )` Calculate axis bounding values on base of the assigned values
public float | `getCoordinate( $value )` Get coordinate for a dedicated value on the chart
public string | `getLabel( $step )` Get label for a dedicated step on the axis
public integer | `getMajorStepCount( )` Return count of major steps
public integer | `getMinorStepCount( )` Return count of minor steps
public array( | `getSteps( )` Return array of steps on this axis
protected array | `increaseKeys( $array , $startKey )` Increase the keys of all elements in the array up from the start key, to insert an additional element at the correct position.
public bool | `isZeroStep( $step )` Is zero step
public void | `provideLabels( $labels )` Provide initial set of labels

### Inherited Methods

From ezcGraphChartElementAxis
public abstract void | `ezcGraphChartElementAxis::addData()` Add data for this axis
public abstract void | `ezcGraphChartElementAxis::calculateAxisBoundings()` Calculate axis bounding values on base of the assigned values
public abstract float | `ezcGraphChartElementAxis::getCoordinate()` Get coordinate for a dedicated value on the chart
public abstract string | `ezcGraphChartElementAxis::getLabel()` Get label for a dedicated step on the axis
public abstract integer | `ezcGraphChartElementAxis::getMajorStepCount()` Return count of major steps
public abstract integer | `ezcGraphChartElementAxis::getMinorStepCount()` Return count of minor steps
public array( | `ezcGraphChartElementAxis::getSteps()` Return array of steps on this axis
public abstract bool | `ezcGraphChartElementAxis::isZeroStep()` Is zero step
public ezcGraphBoundings | `ezcGraphChartElementAxis::render()` Render the axis
public void | `ezcGraphChartElementAxis::setFromPalette()` Set colors and border fro this element
public void | `ezcGraphChartElementAxis::__set()` __set
From ezcGraphChartElement
protected ezcGraphBoundings | `ezcGraphChartElement::getTitleSize()` Returns calculated boundings based on available percentual space of given bounding box specified in the elements options and direction of the box.
public abstract ezcGraphBoundings | `ezcGraphChartElement::render()` Renders this chart element
public void | `ezcGraphChartElement::setFromPalette()` Set colors and border fro this element
From ezcBaseOptions
public ezcBaseOptions | `ezcBaseOptions::__construct()` Construct a new options object.
public void | `ezcBaseOptions::merge()` Merge an array into the actual options object.
public bool | `ezcBaseOptions::offsetExists()` Returns if an option exists.
public mixed | `ezcBaseOptions::offsetGet()` Returns an option value.
public void | `ezcBaseOptions::offsetSet()` Set an option.
public void | `ezcBaseOptions::offsetUnset()` Unset an option.

### Methods

#### addData

void addData( $values )

Add data for this axis

##### Parameters:

Name | Type | Description
--- | --- | ---
`$values` | array | Value which will be displayed on this axis

##### Redefinition of:

Method | Description
--- | ---
`ezcGraphChartElementAxis::addData()` | Add data for this axis

#### calculateAxisBoundings

void calculateAxisBoundings( )

Calculate axis bounding values on base of the assigned values

##### Redefinition of:

Method | Description
--- | ---
`ezcGraphChartElementAxis::calculateAxisBoundings()` | Calculate axis bounding values on base of the assigned values

#### getCoordinate

float getCoordinate( string $value )

Get coordinate for a dedicated value on the chart

##### Parameters:

Name | Type | Description
--- | --- | ---
`$value` | string | Value to determine position for

##### Redefinition of:

Method | Description
--- | ---
`ezcGraphChartElementAxis::getCoordinate()` | Get coordinate for a dedicated value on the chart

#### getLabel

string getLabel( integer $step )

Get label for a dedicated step on the axis

##### Parameters:

Name | Type | Description
--- | --- | ---
`$step` | integer | Number of step

##### Redefinition of:

Method | Description
--- | ---
`ezcGraphChartElementAxis::getLabel()` | Get label for a dedicated step on the axis

#### getMajorStepCount

integer getMajorStepCount( )

Return count of major steps

##### Redefinition of:

Method | Description
--- | ---
`ezcGraphChartElementAxis::getMajorStepCount()` | Return count of major steps

#### getMinorStepCount

integer getMinorStepCount( )

Return count of minor steps

##### Redefinition of:

Method | Description
--- | ---
`ezcGraphChartElementAxis::getMinorStepCount()` | Return count of minor steps

#### getSteps

array( getSteps( )

Return array of steps on this axis

##### Redefinition of:

Method | Description
--- | ---
`ezcGraphChartElementAxis::getSteps()` | Return array of steps on this axis

#### increaseKeys

array increaseKeys( $array , int $startKey )

Increase the keys of all elements in the array up from the start key, to insert an additional element at the correct position.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$array` | array | Array
`$startKey` | int | Key to increase keys from

#### isZeroStep

bool isZeroStep( int $step )

Is zero step

Returns true if the given step is the one on the initial axis position

##### Parameters:

Name | Type | Description
--- | --- | ---
`$step` | int | Number of step

##### Redefinition of:

Method | Description
--- | ---
`ezcGraphChartElementAxis::isZeroStep()` | Is zero step

#### provideLabels

void provideLabels( $labels )

Provide initial set of labels

This method may be used to provide an ordered set of labels, containing labels, which are not available in the datasets or to provide a label order different to the one in the given dataset.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$labels` | array |

Documentation generated by phpDocumentor 1.4.3