Zeta Components Manual :: Docs For Class ezcGraphChartElement
Graph::ezcGraphChartElement
Class ezcGraphChartElement
Base class for chart elements
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)
- ...
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.
- 'Foo' => 23,
- 'Bar' => 42,
- ) );
- // Set a title and format the title element
- $graph->title = 'Example formatted pie chart';
- $graph->title->margin = 2;
- $graph->title->background = '#FFFFFF80';
- $graph->title->border = '#FFFFFF';
- $graph->title->borderWidth = 1;
- $graph->title->margin = 1;
- $graph->title->padding = 1;
- // Format the legend element
- $graph->legend->margin = 2;
- $graph->legend->background = '#FFFFFF80';
- $graph->legend->border = '#FFFFFF';
- $graph->legend->borderWidth = 1;
- $graph->legend->margin = 1;
- $graph->legend->padding = 1;
- $graph->background->background = '#888a85';
Source for this file: /Graph/src/interfaces/element.php
ezcBaseOptions | --ezcGraphChartElement
Version: | //autogentag// |
Descendants
Child Class | Description |
---|---|
ezcGraphChartElementBackground | Chart element representing the background. |
ezcGraphChartElementLegend | Class to represent a legend as a chart element |
ezcGraphChartElementAxis | Class to represent an axis as a chart element |
ezcGraphChartElementText | Chart element to display texts in a chart |
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 | |
---|---|
protected |
ezcBaseOptions::$properties
|
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 | |
---|---|
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
getTitleSize
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:
Name | Type | Description |
---|---|---|
$renderer |
ezcGraphRenderer | |
$boundings |
ezcGraphBoundings |
Redefined in descendants as:
Method | Description |
---|---|
ezcGraphChartElementBackground::render() |
Render the background |
ezcGraphChartElementLegend::render() |
Render a legend |
ezcGraphChartElementAxis::render() |
Render the axis |
ezcGraphChartElementText::render() |
Render the text |
setFromPalette
Set colors and border fro this element
Parameters:
Name | Type | Description |
---|---|---|
$palette |
ezcGraphPalette | Palette |
Redefined in descendants as:
Method | Description |
---|---|
ezcGraphChartElementBackground::setFromPalette() |
Set colors and border for this element |
ezcGraphChartElementAxis::setFromPalette() |
Set colors and border fro this element |