Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcGraphChartElementAxis

Graph::ezcGraphChartElementAxis

Class ezcGraphChartElementAxis

Class to represent an axis as a chart element

Chart elements can be understood as widgets or layout container inside the chart. The actual transformation to images happens inside the renderers. They represent all elements inside the chart and contain mostly general formatting options, while the renderer itself might define additional formatting options for some chart elments. You can find more about the general formatting options for chart elements in the base class ezcGraphChartElement.

The axis elements are special elements, as the border and background settings do not apply directly as axis axis are not put inside any boxes. The border value is reused for the color of the axis itself.

Generally you should select the axis which matches your data best. By default a labeled x axis and a numeric y axis are used. If you are using date or time values on either axis, you should for example use a ezcGraphChartElementDateAxis. The currently available axis types are:

  • ezcGraphChartElementDateAxis
  • ezcGraphChartElementLabeledAxis
  • ezcGraphChartElementLogarithmicalAxis
  • ezcGraphChartElementNumericAxis
Beside this there are several option to define the general layout of the axis labels. The $formatString option may be used to add additional text to each label on the axis, like a percent sign on the y axis:

  1.   $chart->xAxis->formatString = '%s %%';

For more complex formatting operations for the label you may assign a custom formatter function to the property $labelCallback.

The orientation of labels and their position relatively to the axis ticks is calcualted and rendered by the ezcGraphAxisLabelRenderer classes. You can choose between different axis label renderer, or create you own, and assign an instance of one to the property $axisLabelRenderer. Currently the available axis label renderers are:

  • ezcGraphAxisBoxedLabelRenderer
Renders grid and labels like commonly used in bar charts, with the label between two grid lines.

  • ezcGraphAxisCenteredLabelRenderer
Centers the label right next to a tick. Commonly used for labeled axis.

  • ezcGraphAxisExactLabelRenderer
Put the label next to each tick. Commonly used for numeric axis.

  • ezcGraphAxisNoLabelRenderer
Renders no labels.

  • ezcGraphAxisRadarLabelRenderer
Special label renderer for radar charts.

  • ezcGraphAxisRotatedLabelRenderer
Accepts a rotation angle for the texts put at some axis, which might be useful for longer textual labels on the axis.

The label renderer used by default is different depending on the axis type.

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

ezcBaseOptions
   |
   --ezcGraphChartElement
      |
      --ezcGraphChartElementAxis
Version:   //autogentag//

Descendants

Child Class Description
ezcGraphChartElementNumericAxis Class to represent a numeric axis.
ezcGraphChartElementLogarithmicalAxis Class to represent a logarithmic axis.
ezcGraphChartElementLabeledAxis Class to represent a labeled axis.
ezcGraphChartElementDateAxis Class to represent date axis.

Properties

ezcGraphAxisLabelRenderer read/write $axisLabelRenderer
AxisLabelRenderer used to render labels and grid on this axis.
float read/write $axisSpace
Percent of the chart space used to display axis labels and arrowheads instead of data values.
float read/write $chartPosition
Position of the axis in the chart. Only useful for additional axis. The basic chart axis will be automatically positioned.
string read/write $formatString
Formatstring to use for labeling of the axis.
bool read $initialized
Property indicating if some values were associated with axis, or a scaling has been set manually.
string read/write $label
Axis label
callback read/write $labelCallback
Callback function to format chart labels. Function will receive two parameters and should return a reformatted label. string function( label, step )
int read/write $labelMargin
Distance between label an axis
float read/write $labelRotation
Rotation of the axis label in degree
int read/write $labelSize
Size of axis label
ezcGraphColor read/write $majorGrid
Color of major majorGrid.
mixed read/write $majorStep
Labeled major steps displayed on the axis. @TODO: Should be moved to numeric axis.
int read/write $maxArrowHeadSize
Maximum Size used to draw arrow heads.
int read/write $minArrowHeadSize
Minimum Size used to draw arrow heads.
ezcGraphColor read/write $minorGrid
Color of minor majorGrid.
mixed read/write $minorStep
Non labeled minor steps on the axis. @TODO: Should be moved to numeric axis.
float read/write $nullPosition
The position of the null value.
float read/write $outerAxisSpace
Percent of the chart space used to display axis arrow at the outer side of the axis. If set to null, the axisSpace will be used here.

Member Variables

protected ezcGraphAxisLabelRenderer $axisLabelRenderer
Axis label renderer class
protected ezcGraphBoundings $innerBoundings
Optionally set inner boundings. May be null depending on the used chart implementation.

Inherited Member Variables

From ezcBaseOptions
protected ezcBaseOptions::$properties

Method Summary

public abstract void addData( $values )
Add data for this axis
public abstract void calculateAxisBoundings( )
Calculate axis bounding values on base of the assigned values
public abstract float getCoordinate( $value )
Get coordinate for a dedicated value on the chart
public abstract string getLabel( $step )
Get label for a dedicated step on the axis
public abstract integer getMajorStepCount( )
Return count of major steps
public abstract integer getMinorStepCount( )
Return count of minor steps
public array( getSteps( )
Return array of steps on this axis
public abstract bool isZeroStep( $step )
Is zero step
public ezcGraphBoundings render( $renderer , $boundings , [ $innerBoundings = null] )
Render the axis
public void setFromPalette( $palette )
Set colors and border fro this element
public void __set( $propertyName , $propertyValue )
__set

Inherited Methods

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
Redefined in descendants as:
Method Description
ezcGraphChartElementNumericAxis::addData() Add data for this axis 
ezcGraphChartElementLogarithmicalAxis::addData() Add data for this axis 
ezcGraphChartElementLabeledAxis::addData() Add data for this axis 
ezcGraphChartElementDateAxis::addData() Add data for this axis 

calculateAxisBoundings

void calculateAxisBoundings( )

Calculate axis bounding values on base of the assigned values

Redefined in descendants as:
Method Description
ezcGraphChartElementNumericAxis::calculateAxisBoundings() Calculate axis bounding values on base of the assigned values 
ezcGraphChartElementLogarithmicalAxis::calculateAxisBoundings() Calculate axis bounding values on base of the assigned values 
ezcGraphChartElementLabeledAxis::calculateAxisBoundings() Calculate axis bounding values on base of the assigned values 
ezcGraphChartElementDateAxis::calculateAxisBoundings() Calculate axis bounding values on base of the assigned values 

getCoordinate

float getCoordinate( float $value )

Get coordinate for a dedicated value on the chart

Parameters:
Name Type Description
$value float Value to determine position for
Redefined in descendants as:
Method Description
ezcGraphChartElementNumericAxis::getCoordinate() Get coordinate for a dedicated value on the chart 
ezcGraphChartElementLogarithmicalAxis::getCoordinate() Get coordinate for a dedicated value on the chart 
ezcGraphChartElementLabeledAxis::getCoordinate() Get coordinate for a dedicated value on the chart 
ezcGraphChartElementDateAxis::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
Redefined in descendants as:
Method Description
ezcGraphChartElementNumericAxis::getLabel() Get label for a dedicated step on the axis 
ezcGraphChartElementLogarithmicalAxis::getLabel() Get label for a dedicated step on the axis 
ezcGraphChartElementLabeledAxis::getLabel() Get label for a dedicated step on the axis 
ezcGraphChartElementDateAxis::getLabel() Get label for a dedicated step on the axis 

getMajorStepCount

integer getMajorStepCount( )

Return count of major steps

Redefined in descendants as:
Method Description
ezcGraphChartElementNumericAxis::getMajorStepCount() Return count of major steps 
ezcGraphChartElementLogarithmicalAxis::getMajorStepCount() Return count of major steps 
ezcGraphChartElementLabeledAxis::getMajorStepCount() Return count of major steps 
ezcGraphChartElementDateAxis::getMajorStepCount() Return count of major steps 

getMinorStepCount

integer getMinorStepCount( )

Return count of minor steps

Redefined in descendants as:
Method Description
ezcGraphChartElementNumericAxis::getMinorStepCount() Return count of minor steps 
ezcGraphChartElementLogarithmicalAxis::getMinorStepCount() Return count of minor steps 
ezcGraphChartElementLabeledAxis::getMinorStepCount() Return count of minor steps 
ezcGraphChartElementDateAxis::getMinorStepCount() Return count of minor steps 

getSteps

array( getSteps( )

Return array of steps on this axis

Redefined in descendants as:
Method Description
ezcGraphChartElementLabeledAxis::getSteps() Return array of steps on this axis 
ezcGraphChartElementDateAxis::getSteps() Return array of steps on this axis 

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
Redefined in descendants as:
Method Description
ezcGraphChartElementNumericAxis::isZeroStep() Is zero step 
ezcGraphChartElementLogarithmicalAxis::isZeroStep() Is zero step 
ezcGraphChartElementLabeledAxis::isZeroStep() Is zero step 
ezcGraphChartElementDateAxis::isZeroStep() Is zero step 

render

ezcGraphBoundings render( ezcGraphRenderer $renderer , $boundings , [ $innerBoundings = null] )

Render the axis

Parameters:
Name Type Description
$renderer ezcGraphRenderer Renderer
$boundings ezcGraphBoundings Boundings for the axis
$innerBoundings ezcGraphBoundings
Redefinition of:
Method Description
ezcGraphChartElement::render() Renders this chart element

setFromPalette

void setFromPalette( ezcGraphPalette $palette )

Set colors and border fro this element

Parameters:
Name Type Description
$palette ezcGraphPalette Palette
Redefinition of:
Method Description
ezcGraphChartElement::setFromPalette() Set colors and border fro this element

__set

void __set( mixed $propertyName , mixed $propertyValue )

__set

Parameters:
Name Type Description
$propertyName mixed
$propertyValue mixed
Exceptions:
Type Description
ezcBasePropertyNotFoundException If a the value for the property options is not an instance of
ezcBaseValueException If a submitted parameter was out of range or type.
Documentation generated by phpDocumentor 1.4.3