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
- $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
- ezcGraphAxisCenteredLabelRenderer
- ezcGraphAxisExactLabelRenderer
- ezcGraphAxisNoLabelRenderer
- ezcGraphAxisRadarLabelRenderer
- ezcGraphAxisRotatedLabelRenderer
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
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
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
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
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
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
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
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
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
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
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
__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. |