Graph: ezcGraphChartElementAxis
[ ]
[ Gallery ]
[ ]
[ ]
[ ]
[ ]
Class: ezcGraphChartElementAxis
|
Class to represent an axis as a chart element [
source]
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.
Parents
ezcBaseOptions
|
--ezcGraphChartElement
|
--ezcGraphChartElementAxis
Descendents
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 |
|
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. |
Member Variables
Inherited Member Variables
From
ezcBaseOptions:
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 )
Render the axis |
|
public void |
setFromPalette(
$palette )
Set colors and border fro this element |
|
public void |
__set(
$propertyName, $propertyValue )
__set |
Inherited Methods
From
ezcGraphChartElement :
From
ezcBaseOptions :
Methods
addData
void addData(
$values )
Add data for this axis
Parameters
| Name |
Type |
Description |
$values |
array |
|
Redefined in descendants as
calculateAxisBoundings
void calculateAxisBoundings(
)
Calculate axis bounding values on base of the assigned values
Redefined in descendants as
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
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
getMajorStepCount
integer getMajorStepCount(
)
Return count of major steps
Redefined in descendants as
getMinorStepCount
integer getMinorStepCount(
)
Return count of minor steps
Redefined in descendants as
getSteps
array( getSteps(
)
Return array of steps on this axis
Redefined in descendants as
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
render
Render the axis
Parameters
| Name |
Type |
Description |
$renderer |
ezcGraphRenderer |
Renderer |
$boundings |
ezcGraphBoundings |
Boundings for the axis |
Redefinition of
setFromPalette
Set colors and border fro this element
Parameters
Redefinition of
__set
void __set(
mixed
$propertyName, mixed
$propertyValue )
__set
Parameters
| Name |
Type |
Description |
$propertyName |
mixed |
|
$propertyValue |
mixed |
|
Throws
| Class | Description |
ezcBaseValueException |
If a submitted parameter was out of range or type. |
ezcBasePropertyNotFoundException |
If a the value for the property options is not an instance of |
Last updated: Mon, 10 Nov 2008