Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcGraphRenderer

Graph::ezcGraphRenderer

Class ezcGraphRenderer

Abstract class to transform the basic chart components. To be extended by three- and twodimensional renderers.

Source for this file: /Graph/src/interfaces/renderer.php

Version:   //autogentag//

Descendants

Child Class Description
ezcGraphRenderer3d Class to transform chart primitives into image primitives. This renderer renders the charts in a isometric three dimensional view.
ezcGraphRenderer2d Class to transform chart primitives into image primitives. Renders charts in a two dimensional view.

Member Variables

protected ezcGraphDriver $driver
Driver used to render results
protected array $elements = array()
Context sensitive references to chart elements to use for referencing image elements depending on the output driver, like image maps, etc.
protected float $xAxisSpace = false
Axis space used for the x axis
protected float $yAxisSpace = false
Axis space used for the y axis

Method Summary

protected void addElementReference( $context , $reference )
Adds a element reference for context
public abstract void drawAxis( $boundings , $start , $end , $axis , [ $labelClass = null] )
Draw axis
protected void drawAxisArrowHead( $position , $direction , $size , $color )
Draw axis arrow head
public abstract void drawBackgroundImage( $boundings , $file , [ $position = 48] , [ $repeat = ezcGraph::NO_REPEAT] )
Draw background image
public abstract void drawBar( $boundings , $context , $color , $position , $stepSize , [ $dataNumber = 1] , [ $dataCount = 1] , [ $symbol = ezcGraph::NO_SYMBOL] , [ $axisPosition = 0.] )
Draw bar
public abstract ezcGraphBoundings drawBox( $boundings , [ $background = null] , [ $borderColor = null] , [ $borderWidth = 0] , [ $margin = 0] , [ $padding = 0] , [ $title = false] , [ $titleSize = 16] )
Draw box
public abstract void drawDataHighlightText( $boundings , $context , $end , [ $axisPosition = 0.] , [ $dataNumber = 1] , [ $dataCount = 1] , $font , $text , $size , [ $markLines = null] , [ $xOffset = 0] , [ $yOffset = 0] , [ $stepSize = 0.] , [ $type = ezcGraph::LINE] )
Draws a highlight textbox for a datapoint.
public abstract void drawDataLine( $boundings , $context , $color , $start , $end , [ $dataNumber = 1] , [ $dataCount = 1] , [ $symbol = ezcGraph::NO_SYMBOL] , [ $symbolColor = null] , [ $fillColor = null] , [ $axisPosition = 0.] , [ $thickness = 1.] )
Draw data line
public abstract void drawLegend( $boundings , $legend , [ $type = ezcGraph::VERTICAL] )
Draw legend
public abstract void drawPieSegment( $boundings , $context , $color , [ $startAngle = .0] , [ $endAngle = 360.] , [ $label = false] , [ $moveOut = false] )
Draw pie segment
public void drawSymbol( $boundings , $color , [ $symbol = ezcGraph::NO_SYMBOL] )
Draw Symbol
public abstract void drawText( $boundings , $text , [ $align = ezcGraph::LEFT] , [ $rotation = null] )
Draw text
protected abstract void finish( )
Finish rendering
public array getElementReferences( )
Return all chart element references
public void render( [ $file = null] )
Finally renders the image
protected void resetRenderer( )
Reset renderer properties
public void setDriver( $driver )
Set renderers driver

Methods

addElementReference

void addElementReference( ezcGraphContext $context , mixed $reference )

Adds a element reference for context

Parameters:
Name Type Description
$context ezcGraphContext Dataoint context
$reference mixed Driver dependant reference

drawAxis

void drawAxis( $boundings , ezcGraphCoordinate $start , ezcGraphCoordinate $end , ezcGraphChartElementAxis $axis , [ezcGraphAxisLabelRenderer $labelClass = null] )

Draw axis

Draws an axis form the provided start point to the end point. A specific angle of the axis is not required.

For the labeleing of the axis a sorted array with major steps and an array with minor steps is expected, which are build like this: array( array( 'position' => (float), 'label' => (string), ) ) where the label is optional.

The label renderer class defines how the labels are rendered. For more documentation on this topic have a look at the basic label renderer class.

Additionally it can be specified if a major and minor grid are rendered by defining a color for them. The axis label is used to add a caption for the axis.

Parameters:
Name Type Description
$boundings ezcGraphBoundings Boundings of axis
$start ezcGraphCoordinate Start point of axis
$end ezcGraphCoordinate Endpoint of axis
$axis ezcGraphChartElementAxis Axis to render
$labelClass ezcGraphAxisLabelRenderer Used label renderer
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawAxis() Draw axis 
ezcGraphRenderer2d::drawAxis() Draw axis 

drawAxisArrowHead

void drawAxisArrowHead( ezcGraphCoordinate $position , $direction , float $size , ezcGraphColor $color )

Draw axis arrow head

Draw an arrow head at the specified position using specified size and direction of the error head. Repsects the axisEndStyle option in the base renderer options class.

Parameters:
Name Type Description
$position ezcGraphCoordinate
$direction ezcGraphVector
$size float
$color ezcGraphColor

drawBackgroundImage

void drawBackgroundImage( $boundings , string $file , [int $position = 48] , [int $repeat = ezcGraph::NO_REPEAT] )

Draw background image

Draws a background image at the defined position. If repeat is set the background image will be repeated like any texture.

Parameters:
Name Type Description
$boundings ezcGraphBoundings Boundings for the background image
$file string Filename of background image
$position int Position of background image
$repeat int Type of repetition
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawBackgroundImage() Draw background image 
ezcGraphRenderer2d::drawBackgroundImage() Draw background image 

drawBar

void drawBar( $boundings , ezcGraphContext $context , ezcGraphColor $color , ezcGraphCoordinate $position , float $stepSize , [int $dataNumber = 1] , [int $dataCount = 1] , [int $symbol = ezcGraph::NO_SYMBOL] , [float $axisPosition = 0.] )

Draw bar

Draws a bar as a data element in a line chart

Parameters:
Name Type Description
$boundings ezcGraphBoundings Chart boundings
$context ezcGraphContext Context of call
$color ezcGraphColor Color of line
$position ezcGraphCoordinate Position of data point
$stepSize float Space which can be used for bars
$dataNumber int Number of dataset
$dataCount int Count of datasets in chart
$symbol int Symbol to draw for line
$axisPosition float Position of axis for drawing filled lines
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawBar() Draw bar 
ezcGraphRenderer2d::drawBar() Draw bar 
ezcGraphHorizontalRenderer::drawBar() Draw bar 

drawBox

ezcGraphBoundings drawBox( $boundings , [ezcGraphColor $background = null] , [ezcGraphColor $borderColor = null] , [int $borderWidth = 0] , [int $margin = 0] , [int $padding = 0] , [mixed $title = false] , [int $titleSize = 16] )

Draw box

Box are wrapping each major chart element and draw border, background and title to each chart element.

Optionally a padding and margin for each box can be defined.

Parameters:
Name Type Description
$boundings ezcGraphBoundings Boundings of the box
$background ezcGraphColor Background color
$borderColor ezcGraphColor Border color
$borderWidth int Border width
$margin int Margin
$padding int Padding
$title mixed Title of the box
$titleSize int Size of title in the box
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawBox() Draw box 
ezcGraphRenderer2d::drawBox() Draw box 

drawDataHighlightText

void drawDataHighlightText( $boundings , ezcGraphContext $context , ezcGraphCoordinate $end , [float $axisPosition = 0.] , [int $dataNumber = 1] , [int $dataCount = 1] , ezcGraphFontOptions $font , string $text , int $size , [ezcGraphColor $markLines = null] , [int $xOffset = 0] , [int $yOffset = 0] , [float $stepSize = 0.] , [int $type = ezcGraph::LINE] )

Draws a highlight textbox for a datapoint.

A highlight textbox for line and bar charts means a box with the current value in the graph.

Parameters:
Name Type Description
$boundings ezcGraphBoundings Chart boundings
$context ezcGraphContext Context of call
$end ezcGraphCoordinate Ending point
$axisPosition float Position of axis for drawing filled lines
$dataNumber int Number of dataset
$dataCount int Count of datasets in chart
$font ezcGraphFontOptions Font used for highlight string
$text string Acutual value
$size int Size of highlight text
$markLines ezcGraphColor
$xOffset int
$yOffset int
$stepSize float
$type int
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawDataHighlightText() Draws a highlight textbox for a datapoint. 
ezcGraphRenderer2d::drawDataHighlightText() Draws a highlight textbox for a datapoint. 

drawDataLine

void drawDataLine( $boundings , ezcGraphContext $context , ezcGraphColor $color , ezcGraphCoordinate $start , ezcGraphCoordinate $end , [int $dataNumber = 1] , [int $dataCount = 1] , [int $symbol = ezcGraph::NO_SYMBOL] , [ezcGraphColor $symbolColor = null] , [ezcGraphColor $fillColor = null] , [float $axisPosition = 0.] , [float $thickness = 1.] )

Draw data line

Draws a line as a data element in a line chart

Parameters:
Name Type Description
$boundings ezcGraphBoundings Chart boundings
$context ezcGraphContext Context of call
$color ezcGraphColor Color of line
$start ezcGraphCoordinate Starting point
$end ezcGraphCoordinate Ending point
$dataNumber int Number of dataset
$dataCount int Count of datasets in chart
$symbol int Symbol to draw for line
$symbolColor ezcGraphColor Color of the symbol, defaults to linecolor
$fillColor ezcGraphColor Color to fill line with
$axisPosition float Position of axis for drawing filled lines
$thickness float Line thickness
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawDataLine() Draw data line 
ezcGraphRenderer2d::drawDataLine() Draw data line 
ezcGraphHorizontalRenderer::drawDataLine() Draw data line 

drawLegend

void drawLegend( $boundings , ezcGraphChartElementLegend $legend , [int $type = ezcGraph::VERTICAL] )

Draw legend

Will draw a legend in the bounding box

Parameters:
Name Type Description
$boundings ezcGraphBoundings Bounding of legend
$legend ezcGraphChartElementLegend Legend to draw
$type int Type of legend: Protrait or landscape
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawLegend() Draw legend 
ezcGraphRenderer2d::drawLegend() Draw legend 

drawPieSegment

void drawPieSegment( $boundings , ezcGraphContext $context , ezcGraphColor $color , [float $startAngle = .0] , [float $endAngle = 360.] , [mixed $label = false] , [bool $moveOut = false] )

Draw pie segment

Draws a single pie segment

Parameters:
Name Type Description
$boundings ezcGraphBoundings Chart boundings
$context ezcGraphContext Context of call
$color ezcGraphColor Color of pie segment
$startAngle float Start angle
$endAngle float End angle
$label mixed Label of pie segment
$moveOut bool Move out from middle for hilighting
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawPieSegment() Draw pie segment 
ezcGraphRenderer2d::drawPieSegment() Draw pie segment 

drawSymbol

void drawSymbol( $boundings , ezcGraphColor $color , [int $symbol = ezcGraph::NO_SYMBOL] )

Draw Symbol

Draws a single symbol defined by the symbol constants in ezcGraph. for NO_SYMBOL a rect will be drawn.

Parameters:
Name Type Description
$boundings ezcGraphBoundings Boundings of symbol
$color ezcGraphColor Color of symbol
$symbol int Type of symbol

drawText

void drawText( $boundings , string $text , [int $align = ezcGraph::LEFT] , [ $rotation = null] )

Draw text

Draws the provided text in the boundings

Parameters:
Name Type Description
$boundings ezcGraphBoundings Boundings of text
$text string Text
$align int Alignement of text
$rotation ezcGraphRotation
Redefined in descendants as:
Method Description
ezcGraphRenderer3d::drawText() Draw text 
ezcGraphRenderer2d::drawText() Draw text 

finish

void finish( )

Finish rendering

Method is called before the final image is renderer, so that finishing operations can be performed here.

Redefined in descendants as:
Method Description
ezcGraphRenderer3d::finish() Call all postprocessing functions 
ezcGraphRenderer2d::finish() Call all postprocessing functions 

getElementReferences

array getElementReferences( )

Return all chart element references

Returns element references for the data sets in the chart, so the created graphic may be enhanced later.

The resulting array looks like:

  1.   array (
  2.       legend_url => array (
  3.           $name => $url | null,
  4.           ...
  5.       ),
  6.       legend => array (
  7.           $name => $data,
  8.           ...
  9.       )
  10.       data => array (
  11.           $dataset => array (
  12.               $name => $data,
  13.               ...
  14.           ),
  15.           ...
  16.       )
  17.   )

The legend elements won't show up in the array, if there is no legend redered. The URLs are only available, if the url property has been set on the respective dataset.

The data assigned to the legends and data elements is completely direver dependent. In the SVG and Flash driver there will jsut be some IDs, which allow you to reference the affected elements or element groups inside the flash or SVG file.

For bitmap formats, like in the Cairo or GD driver, $data will be an array of ezcGraphCoordinate objects, which roughly describe the outline of the referenced element. For circles and alike the resolution of this outline can be configured in the respective driver.

render

void render( [string $file = null] )

Finally renders the image

Parameters:
Name Type Description
$file string Filename of destination file

resetRenderer

void resetRenderer( )

Reset renderer properties

Reset all renderer properties, which were calculated during the rendering process, to offer a clean environment for rerendering.

Redefined in descendants as:
Method Description
ezcGraphRenderer3d::resetRenderer() Reset renderer properties 
ezcGraphRenderer2d::resetRenderer() Reset renderer properties 

setDriver

void setDriver( ezcGraphDriver $driver )

Set renderers driver

This method is used internally to set the direver used inside the chart class in the renderer. If you want to change the driver used for your chart, you should do this using the chart driver property, like:

  1.   $chart = new ezcGraphPieChart();
  2.   $chart->driver = new ezcGraphSvgDriver();
Parameters:
Name Type Description
$driver ezcGraphDriver Output driver
Documentation generated by phpDocumentor 1.4.3