Path

ez components / documentation / api reference / 2008.2.1 / graph


eZ Components 2008.2.1

Graph: ezcGraphLineChart

[ Tutorial ] [ Gallery ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcGraphLineChart

Class for line charts. Can make use of an unlimited amount of datasets and will display them as lines by default. [source]
X axis:
  • Labeled axis
  • Centered axis label renderer
Y axis:
  • Numeric axis
  • Exact axis label renderer
 1.   // Create a new line chart
 2.     $chart new ezcGraphLineChart();
 3.  
 4.   // Add data to line chart
 5.     $chart->data['sample dataset'new ezcGraphArrayDataSet(
 6.       array(
 7.           '100' => 1.2,
 8.           '200' => 43.2,
 9.           '300' => -34.14,
10.           '350' => 65,
11.           '400' => 123,
12.       )
13.   );
14.  
15.   // Render chart with default 2d renderer and default SVG driver
16.     $chart->render500200'line_chart.svg' );
Each chart consists of several chart elements which represents logical parts of the chart and can be formatted independently. The line chart consists of: The type of the axis may be changed and all elements can be configured by accessing them as properties of the chart:
1.   $chart->legend->position ezcGraph::RIGHT;
The chart itself also offers several options to configure the appearance. The extended configure options are available in ezcGraphLineChartOptions extending the ezcGraphChartOptions.

Parents

ezcGraphChart
   |
   --ezcGraphLineChart

Descendents

Child Class Description
ezcGraphBarChart Class for bar charts. Can make use of an unlimited amount of datasets and will display them as bars by default.

Properties

ezcGraphLineChartOptions read/write  $options
Chart options class

Member Variables

protected ezcGraphAxisContainer $additionalAxis
Array with additional axis for the chart

Inherited Member Variables

From ezcGraphChart:
protected  ezcGraphChart::$data
protected  ezcGraphChart::$elements
protected  ezcGraphChart::$options
protected  ezcGraphChart::$properties
protected  ezcGraphChart::$renderElement

Method Summary

protected void checkRenderer( )
Check if renderer supports features requested by some special chart options.
public int getDefaultDisplayType( )
Returns the default display type of the current chart type.
public void render( $width, $height, [$file = null] )
Render the line chart
protected void renderData( $renderer, $boundings, $innerBoundings )
Render the assigned data
protected void renderElements( $width, $height )
Renders the basic elements of this chart type
public void renderToOutput( $width, $height )
Renders this chart to direct output
protected void setAxisValues( )
Aggregate and calculate value boundings on axis.
public void setFromPalette( $palette )
Set colors and border for this element

Inherited Methods

From ezcGraphChart :
protected void ezcGraphChart::addElement()
Add element to chart
public abstract int ezcGraphChart::getDefaultDisplayType()
Returns the default display type of the current chart type.
public mixed ezcGraphChart::getRenderedFile()
Return filename of rendered file, and false if no file was yet rendered.
public abstract void ezcGraphChart::render()
Renders this chart
public abstract void ezcGraphChart::renderToOutput()
Renders this chart to direct output
public void ezcGraphChart::setFromPalette()
Set colors and border fro this element

Methods

checkRenderer

void checkRenderer( )
Check if renderer supports features requested by some special chart options.

Throws

ClassDescription
ezcBaseValueException If some feature is not supported

getDefaultDisplayType

int getDefaultDisplayType( )
Returns the default display type of the current chart type.

Redefinition of

Method Description
ezcGraphChart::getDefaultDisplayType() Returns the default display type of the current chart type.

Redefined in descendants as

Method Description
ezcGraphBarChart::getDefaultDisplayType() Returns the default display type of the current chart type.

render

void render( int $width, int $height, [string $file = null] )
Render the line chart
Renders the chart into a file or stream. The width and height are needed to specify the dimensions of the resulting image. For direct output use 'php://stdout' as output file.

Parameters

Name Type Description
$width int Image width
$height int Image height
$file string Output file

Redefinition of

Method Description
ezcGraphChart::render() Renders this chart

renderData

void renderData( ezcGraphRenderer $renderer, $boundings, $innerBoundings )
Render the assigned data
Will renderer all charts data in the remaining boundings after drawing all other chart elements. The data will be rendered depending on the settings in the dataset.

Parameters

Name Type Description
$renderer ezcGraphRenderer Renderer
$boundings ezcGraphBoundings Remaining boundings
$innerBoundings ezcGraphBoundings  

renderElements

void renderElements( int $width, int $height )
Renders the basic elements of this chart type

Parameters

Name Type Description
$width int  
$height int  

renderToOutput

void renderToOutput( int $width, int $height )
Renders this chart to direct output
Does the same as ezcGraphChart::render(), but renders directly to output and not into a file.

Parameters

Name Type Description
$width int  
$height int  

Redefinition of

Method Description
ezcGraphChart::renderToOutput() Renders this chart to direct output

setAxisValues

void setAxisValues( )
Aggregate and calculate value boundings on axis.

setFromPalette

void setFromPalette( ezcGraphPalette $palette )
Set colors and border for this element

Parameters

Name Type Description
$palette ezcGraphPalette Palette

Redefinition of

Method Description
ezcGraphChart::setFromPalette() Set colors and border fro this element

Last updated: Mon, 09 Feb 2009