Abstract class to render labels and grids on axis. Will be extended to make it possible using different algorithms for rendering axis labels.
Implements basic methods to render the grid and steps on a axis.
Source for this file: /Graph/src/interfaces/axis_label_renderer.php
ezcBaseOptions | --ezcGraphAxisLabelRenderer
Version: | //autogentag// |
Child Class | Description |
---|---|
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. |
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. |
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 |
protected ezcGraphDriver |
$driver
Driver to render axis labels |
From ezcBaseOptions | |
---|---|
protected |
ezcBaseOptions::$properties
|
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 |
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. |
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 ).
Name | Type | Description |
---|---|---|
$aStart |
ezcGraphCoordinate | |
$aDir |
ezcGraphCoordinate | |
$bStart |
ezcGraphCoordinate | |
$bDir |
ezcGraphCoordinate |
Draw grid
Draws a grid line at the current position
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 |
Method | Description |
---|---|
ezcGraphAxisRadarLabelRenderer::drawGrid() |
Draw grid |
Draw non-rectangular grid lines grid
Draws a grid line at the current position, for non-rectangular axis.
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 |
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.
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 |
Draw single step on a axis
Draws a step on a axis at the current position
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 |
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.
Name | Type | Description |
---|---|---|
$renderer |
ezcGraphRenderer | |
$boundings |
ezcGraphBoundings | |
$innerBoundings |
mixed | |
$axis |
ezcGraphChartElementAxis | |
&$gridBoundings |
Modify chart boundings
Optionally modify boundings of chart data
Name | Type | Description |
---|---|---|
$boundings |
ezcGraphBoundings | Current boundings of chart |
$direction |
ezcGraphCoordinate | Direction of the current axis |
Modify chart data position
Optionally additionally modify the coodinate of a data point
Name | Type | Description |
---|---|---|
$coordinate |
ezcGraphCoordinate | Data point coordinate |
Method | Description |
---|---|
ezcGraphAxisRotatedLabelRenderer::modifyChartDataPosition() |
Modify chart data position |
ezcGraphAxisRotatedBoxedLabelRenderer::modifyChartDataPosition() |
Modify chart data position |
ezcGraphAxisBoxedLabelRenderer::modifyChartDataPosition() |
Modify chart data position |
Render Axis labels
Render labels for an axis.
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 |
Method | Description |
---|---|
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 |
ezcGraphAxisBoxedLabelRenderer::renderLabels() |
Render Axis labels |
ezcGraphAxisCenteredLabelRenderer::renderLabels() |
Render Axis labels |