Path

ez components / documentation / api reference / latest / graph


eZ Components latest

Graph: ezcGraphAxisLabelRenderer

[ Tutorial ] [ Gallery ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcGraphAxisLabelRenderer

Abstract class to render labels and grids on axis. Will be extended to make it possible using different algorithms for rendering axis labels. [source]
Implements basic methods to render the grid and steps on a axis.

Parents

ezcBaseOptions
   |
   --ezcGraphAxisLabelRenderer

Descendents

Child Class Description
ezcGraphAxisBoxedLabelRenderer Renders axis labels centered between two axis steps like normally used for bar charts. Used with other chart types this axis label renderer may cause unexpected results. You may use this renderer by assigning it to one of the charts axis.
ezcGraphAxisCenteredLabelRenderer Renders axis labels centered below the axis steps.
ezcGraphAxisRotatedLabelRenderer Can render axis labels rotated, so that more axis labels fit on one axis.
ezcGraphAxisNoLabelRenderer Omits axis labels, steps and grid.
ezcGraphAxisExactLabelRenderer Renders axis labels like known from charts drawn in analysis
ezcGraphAxisRadarLabelRenderer Renders axis labels and grid optimized for radar charts. May cause unexpected results when used with other chart types.

Properties

bool read/write  $innerStep
Indicates if steps are shown on the inner side of axis.
int read/write  $labelPadding
Padding of labels.
bool read/write  $majorStepCount
Count of major steps.
int read/write  $majorStepSize
Size of major steps.
bool read/write  $minorStepCount
Count of minor steps.
int read/write  $minorStepSize
Size of minor steps.
bool read/write  $outerGrid
Indicates if the grid is shown on the outer side of axis.
bool read/write  $outerStep
Indicates if steps are shown on the outer side of axis.
bool read/write  $showLables
Indicates if the labels should be shown

Member Variables

protected ezcGraphDriver $driver
Driver to render axis labels

Inherited Member Variables

From ezcBaseOptions:
protected  ezcBaseOptions::$properties

Method Summary

public mixed determineLineCuttingPoint( $aStart, $aDir, $bStart, $bDir )
Checks for the cutting point of two lines.
protected void drawGrid( $renderer, $boundings, $position, $direction, $color )
Draw grid
protected void drawNonRectangularGrid( $renderer, $boundings, $position, $direction, $color )
Draw non-rectangular grid lines grid
protected void drawRectangularGrid( $renderer, $boundings, $position, $direction, $color )
Draw rectangular grid
public void drawStep( $renderer, $position, $direction, $axisPosition, $size, $color )
Draw single step on a axis
protected array getAxisSpace( $renderer, $boundings, $axis, $innerBoundings, &$gridBoundings )
Get axis space values
public ezcGraphBoundings modifyChartBoundings( $boundings, $direction )
Modify chart boundings
public ezcGraphCoordinate modifyChartDataPosition( $coordinate )
Modify chart data position
public abstract void renderLabels( $renderer, $boundings, $start, $end, $axis )
Render Axis labels

Inherited Methods

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

determineLineCuttingPoint

mixed determineLineCuttingPoint( ezcGraphCoordinate $aStart, ezcGraphCoordinate $aDir, ezcGraphCoordinate $bStart, ezcGraphCoordinate $bDir )
Checks for the cutting point of two lines.
The lines are given by a start position and the direction of the line, both as instances of ezcGraphCoordinate. If no cutting point could be calculated, because the lines are parallel the function will return false. Otherwise the factor returned can be used to calculate the cutting point using the following equatation: point = $aStart + $factor * $aDir;
We return the factor instead of the resulting point because it can be easily determined from the factor if the cutting point is in "behind" the line starting point, or if the distance to the cutting point is bigger then the direction vector is long ( $factor > 1 ).

Parameters

Name Type Description
$aStart ezcGraphCoordinate  
$aDir ezcGraphCoordinate  
$bStart ezcGraphCoordinate  
$bDir ezcGraphCoordinate  

drawGrid

void drawGrid( ezcGraphRenderer $renderer, $boundings, ezcGraphCoordinate $position, ezcGraphCoordinate $direction, ezcGraphColor $color )
Draw grid
Draws a grid line at the current position

Parameters

Name Type Description
$renderer ezcGraphRenderer Renderer to draw the grid with
$boundings ezcGraphBoundings Boundings of axis
$position ezcGraphCoordinate Position of step
$direction ezcGraphCoordinate Direction of axis
$color ezcGraphColor Color of axis

Redefined in descendants as

Method Description
ezcGraphAxisRadarLabelRenderer::drawGrid() Draw grid

drawNonRectangularGrid

void drawNonRectangularGrid( ezcGraphRenderer $renderer, $boundings, ezcGraphCoordinate $position, ezcGraphCoordinate $direction, ezcGraphColor $color )
Draw non-rectangular grid lines grid
Draws a grid line at the current position, for non-rectangular axis.

Parameters

Name Type Description
$renderer ezcGraphRenderer Renderer to draw the grid with
$boundings ezcGraphBoundings Boundings of axis
$position ezcGraphCoordinate Position of step
$direction ezcGraphCoordinate Direction of axis
$color ezcGraphColor Color of axis

drawRectangularGrid

void drawRectangularGrid( ezcGraphRenderer $renderer, $boundings, ezcGraphCoordinate $position, ezcGraphCoordinate $direction, ezcGraphColor $color )
Draw rectangular grid
Draws a grid line at the current position for rectangular directed axis.
Method special for rectangularly directed axis to minimize the floating point calculation inaccuracies. Those are not necessary for rectangles, while for non-rectangular directed axis.

Parameters

Name Type Description
$renderer ezcGraphRenderer Renderer to draw the grid with
$boundings ezcGraphBoundings Boundings of axis
$position ezcGraphCoordinate Position of step
$direction ezcGraphCoordinate Direction of axis
$color ezcGraphColor Color of axis

drawStep

void drawStep( ezcGraphRenderer $renderer, ezcGraphCoordinate $position, ezcGraphCoordinate $direction, int $axisPosition, int $size, ezcGraphColor $color )
Draw single step on a axis
Draws a step on a axis at the current position

Parameters

Name Type Description
$renderer ezcGraphRenderer Renderer to draw the step with
$position ezcGraphCoordinate Position of step
$direction ezcGraphCoordinate Direction of axis
$axisPosition int Position of axis
$size int Step size
$color ezcGraphColor Color of axis

getAxisSpace

array getAxisSpace( ezcGraphRenderer $renderer, $boundings, ezcGraphChartElementAxis $axis, mixed $innerBoundings, &$gridBoundings )
Get axis space values
Get axis space values, depending on passed parameters. If $innerBoundings is given it will be used to caclulat the axis spaces available for label rendering. If not given the legacy method will be used, which uses the xAxisSpace and yAxisSpace values calcualted by the renderer.
Returns an array( $xSpace, $ySpace ), containing the irespective size in pixels. Additionally calculates the grid boundings passed by reference.

Parameters

Name Type Description
$renderer ezcGraphRenderer  
$boundings ezcGraphBoundings  
$innerBoundings mixed  
$axis ezcGraphChartElementAxis  
&$gridBoundings  

modifyChartBoundings

ezcGraphBoundings modifyChartBoundings( $boundings, ezcGraphCoordinate $direction )
Modify chart boundings
Optionally modify boundings of chart data

Parameters

Name Type Description
$boundings ezcGraphBoundings Current boundings of chart
$direction ezcGraphCoordinate Direction of the current axis

modifyChartDataPosition

ezcGraphCoordinate modifyChartDataPosition( ezcGraphCoordinate $coordinate )
Modify chart data position
Optionally additionally modify the coodinate of a data point

Parameters

Name Type Description
$coordinate ezcGraphCoordinate Data point coordinate

Redefined in descendants as

Method Description
ezcGraphAxisBoxedLabelRenderer::modifyChartDataPosition() Modify chart data position
ezcGraphAxisRotatedLabelRenderer::modifyChartDataPosition() Modify chart data position
ezcGraphAxisRotatedBoxedLabelRenderer::modifyChartDataPosition() Modify chart data position

renderLabels

void renderLabels( ezcGraphRenderer $renderer, $boundings, ezcGraphCoordinate $start, ezcGraphCoordinate $end, ezcGraphChartElementAxis $axis )
Render Axis labels
Render labels for an axis.

Parameters

Name Type Description
$renderer ezcGraphRenderer Renderer used to draw the chart
$boundings ezcGraphBoundings Boundings of the axis
$start ezcGraphCoordinate Axis starting point
$end ezcGraphCoordinate Axis ending point
$axis ezcGraphChartElementAxis Axis instance

Redefined in descendants as

Method Description
ezcGraphAxisBoxedLabelRenderer::renderLabels() Render Axis labels
ezcGraphAxisCenteredLabelRenderer::renderLabels() Render Axis labels
ezcGraphAxisRotatedLabelRenderer::renderLabels() Render Axis labels
ezcGraphAxisRotatedBoxedLabelRenderer::renderLabels() Render Axis labels
ezcGraphAxisNoLabelRenderer::renderLabels() Render Axis labels
ezcGraphAxisExactLabelRenderer::renderLabels() Render Axis labels
ezcGraphAxisRadarLabelRenderer::renderLabels() Render Axis labels

Last updated: Mon, 21 Dec 2009