Graph: ezcGraphChartElement
[ ]
[ Gallery ]
[ ]
[ ]
[ ]
[ ]
Class: ezcGraphChartElement
|
Base class for chart elements [
source]
The base class for chart elements. 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.
Important chart elements for example are:
- Chart title (ezcGraphChartElementText)
- Chart legend (ezcGraphChartElementLegend)
- The axis (ezcGraphChartElementNumericAxis,
ezcGraphChartElementLogarithmicalAxis, ezcGraphChartElementLabeledAxis,
ezcGraphChartElementDateAxis)
- ...
The position of chart elements is defined in the $position property. The effect this has on the visual representation depends on the actual type of the chart element.
Each chart element may be configured with options similar to CSS, used with HTML to define the general style of the repsective element:
- $padding & $margin defne the distance of the border from inner elements /
other chart elements.
- $borderWidth & $border define the style of the border used around the
chart element
- $background defines the background color of the chart element. As always
this may be a (semi-) transparent color.
A typical example with some layout for the chart title element could look like:
1. $graph = new ezcGraphPieChart();
2. $graph->data['example'] = new ezcGraphArrayDataSet( array(
3. 'Foo' => 23,
4. 'Bar' => 42,
5. ) );
6.
7. // Set a title and format the title element
8. $graph->title = 'Example formatted pie chart';
9. $graph->title->margin = 2;
10. $graph->title->background = '#FFFFFF80';
11. $graph->title->border = '#FFFFFF';
12. $graph->title->borderWidth = 1;
13. $graph->title->margin = 1;
14. $graph->title->padding = 1;
15.
16. // Format the legend element
17. $graph->legend->margin = 2;
18. $graph->legend->background = '#FFFFFF80';
19. $graph->legend->border = '#FFFFFF';
20. $graph->legend->borderWidth = 1;
21. $graph->legend->margin = 1;
22. $graph->legend->padding = 1;
23.
24. $graph->background->background = '#888a85';
25.
26. $graph->render( 400, 250, 'element.svg' );
Parents
ezcBaseOptions
|
--ezcGraphChartElement
Descendents
Properties
|
ezcGraphColor |
read/write
|
$background
Background color of chart element. |
|
ezcGraphColor |
read/write
|
$border
Border color of chart element. |
|
int |
read/write
|
$borderWidth
Border width. |
|
ezcGraphBoundings |
read
|
$boundings
Boundings of this elements. |
|
ezcGraphFontOptions |
read/write
|
$font
Font used for this element. |
|
bool |
read
|
$fontCloned
Indicates if font configuration was already cloned for this specific element. |
|
float |
read/write
|
$landscapeTitleSize
Percentage of boundings which are used for the title with position top or bottom. |
|
int |
read/write
|
$margin
Distance between outer boundings and border of an element. |
|
int |
read/write
|
$maxTitleHeight
Maximum size of the title. |
|
int |
read/write
|
$padding
Distance between border and content of element. |
|
float |
read/write
|
$portraitTitleSize
Percentage of boundings which are used for the title with position left, right or center. |
|
int |
read/write
|
$position
Integer defining the elements position in the chart. |
|
string |
read/write
|
$title
Title of chart element. |
Inherited Member Variables
From
ezcBaseOptions:
Method Summary
|
protected ezcGraphBoundings |
getTitleSize(
$boundings, [$direction = ezcGraph::HORIZONTAL] )
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 |
render(
$renderer, $boundings )
Renders this chart element |
|
public void |
setFromPalette(
$palette )
Set colors and border fro this element |
Inherited Methods
From
ezcBaseOptions :
Methods
getTitleSize
ezcGraphBoundings getTitleSize(
$boundings, [int
$direction = ezcGraph::HORIZONTAL] )
Returns calculated boundings based on available percentual space of given bounding box specified in the elements options and direction of the box.
Parameters
| Name |
Type |
Description |
$boundings |
ezcGraphBoundings |
|
$direction |
int |
|
render
Renders this chart element
This method receives and returns a part of the canvas where it can be rendered on.
Parameters
Redefined in descendants as
setFromPalette
Set colors and border fro this element
Parameters
Redefined in descendants as
Last updated: Mon, 09 Feb 2009