[ Index ]

PHP Cross Reference of MantisBT

title

Body

[close]

/library/ezc/Graph/src/renderer/ -> 2d.php (summary)

File containing the two dimensional renderer

Copyright: Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
License: http://ez.no/licenses/new_bsd New BSD License
Version: 1.5
File Size: 1901 lines (65 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

ezcGraphRenderer2d:: (26 methods):
  __construct()
  __get()
  drawPieSegment()
  finishCircleSectors()
  finishPieSegmentLabels()
  finishLineSymbols()
  drawBar()
  drawStackedBar()
  drawDataLine()
  getCoordinateFromAngleAndRadius()
  drawRadarDataLine()
  drawDataHighlightText()
  drawLegend()
  drawBox()
  drawText()
  drawGridLine()
  drawStepLine()
  drawAxis()
  drawAxisLabel()
  legacyDrawAxis()
  drawAxisLabels()
  drawBackgroundImage()
  finish()
  resetRenderer()
  drawOdometer()
  drawOdometerMarker()


Class: ezcGraphRenderer2d  - X-Ref

Class to transform chart primitives into image primitives. Renders charts in
a two dimensional view.

The class options are defined in the class {@link ezcGraphRenderer2dOptions}
extending the basic renderer options in {@link ezcGraphRendererOptions}.

<code>
$graph = new ezcGraphPieChart();
$graph->palette = new ezcGraphPaletteBlack();
$graph->title = 'Access statistics';
$graph->options->label = '%2$d (%3$.1f%%)';

$graph->data['Access statistics'] = new ezcGraphArrayDataSet( array(
'Mozilla' => 19113,
'Explorer' => 10917,
'Opera' => 1464,
'Safari' => 652,
'Konqueror' => 474,
) );
$graph->data['Access statistics']->highlight['Explorer'] = true;

// $graph->renderer = new ezcGraphRenderer2d();

$graph->renderer->options->moveOut = .2;

$graph->renderer->options->pieChartOffset = 63;

$graph->renderer->options->pieChartGleam = .3;
$graph->renderer->options->pieChartGleamColor = '#FFFFFF';
$graph->renderer->options->pieChartGleamBorder = 2;

$graph->renderer->options->pieChartShadowSize = 3;
$graph->renderer->options->pieChartShadowColor = '#000000';

$graph->renderer->options->legendSymbolGleam = .5;
$graph->renderer->options->legendSymbolGleamSize = .9;
$graph->renderer->options->legendSymbolGleamColor = '#FFFFFF';

$graph->renderer->options->pieChartSymbolColor = '#BABDB688';

$graph->render( 400, 150, 'tutorial_pie_chart_pimped.svg' );
</code>

__construct( array $options = array()   X-Ref
Constructor

param: array $options Default option array
return: void

__get( $propertyName )   X-Ref
__get

param: mixed $propertyName
return: mixed

drawPieSegment(ezcGraphBoundings $boundings,ezcGraphContext $context,ezcGraphColor $color,$startAngle = .0,$endAngle = 360.,$label = false,$moveOut = false )   X-Ref
Draw pie segment

Draws a single pie segment

param: ezcGraphBoundings $boundings Chart boundings
param: ezcGraphContext $context Context of call
param: ezcGraphColor $color Color of pie segment
param: float $startAngle Start angle
param: float $endAngle End angle
param: mixed $label Label of pie segment
param: bool $moveOut Move out from middle for hilighting
return: void

finishCircleSectors()   X-Ref
Draws the collected circle sectors

All circle sectors are collected and drawn later to be able to render
the shadows of the pie segments in the back of all pie segments.

return: void

finishPieSegmentLabels()   X-Ref
Draws the collected pie segment labels

All labels are collected and drawn later to be able to partition the
available space for the labels woth knowledge of the overall label
count and their required size and optimal position.

return: void

finishLineSymbols()   X-Ref
Draw the collected line symbols

Symbols for the data lines are collected and delayed to ensure that
they are not covered and hidden by other data lines.

return: void

drawBar(ezcGraphBoundings $boundings,ezcGraphContext $context,ezcGraphColor $color,ezcGraphCoordinate $position,$stepSize,$dataNumber = 1,$dataCount = 1,$symbol = ezcGraph::NO_SYMBOL,$axisPosition = 0. )   X-Ref
Draw bar

Draws a bar as a data element in a line chart

param: ezcGraphBoundings $boundings Chart boundings
param: ezcGraphContext $context Context of call
param: ezcGraphColor $color Color of line
param: ezcGraphCoordinate $position Position of data point
param: float $stepSize Space which can be used for bars
param: int $dataNumber Number of dataset
param: int $dataCount Count of datasets in chart
param: int $symbol Symbol to draw for line
param: float $axisPosition Position of axis for drawing filled lines
return: void

drawStackedBar(ezcGraphBoundings $boundings,ezcGraphContext $context,ezcGraphColor $color,ezcGraphCoordinate $start,ezcGraphCoordinate $position,$stepSize,$symbol = ezcGraph::NO_SYMBOL,$axisPosition = 0. )   X-Ref
Draw stacked bar

Draws a stacked bar part as a data element in a line chart

param: ezcGraphBoundings $boundings Chart boundings
param: ezcGraphContext $context Context of call
param: ezcGraphColor $color Color of line
param: ezcGraphCoordinate $start
param: ezcGraphCoordinate $position
param: float $stepSize Space which can be used for bars
param: int $symbol Symbol to draw for line
param: float $axisPosition Position of axis for drawing filled lines
return: void

drawDataLine(ezcGraphBoundings $boundings,ezcGraphContext $context,ezcGraphColor $color,ezcGraphCoordinate $start,ezcGraphCoordinate $end,$dataNumber = 1,$dataCount = 1,$symbol = ezcGraph::NO_SYMBOL,ezcGraphColor $symbolColor = null,ezcGraphColor $fillColor = null,$axisPosition = 0.,$thickness = 1. )   X-Ref
Draw data line

Draws a line as a data element in a line chart

param: ezcGraphBoundings $boundings Chart boundings
param: ezcGraphContext $context Context of call
param: ezcGraphColor $color Color of line
param: ezcGraphCoordinate $start Starting point
param: ezcGraphCoordinate $end Ending point
param: int $dataNumber Number of dataset
param: int $dataCount Count of datasets in chart
param: int $symbol Symbol to draw for line
param: ezcGraphColor $symbolColor Color of the symbol, defaults to linecolor
param: ezcGraphColor $fillColor Color to fill line with
param: float $axisPosition Position of axis for drawing filled lines
param: float $thickness Line thickness
return: void

getCoordinateFromAngleAndRadius(ezcGraphBoundings $boundings,ezcGraphCoordinate $center,$angle,$radius)   X-Ref
Returns a coordinate in the given bounding box for the given angle
radius with the center as base point.

param: ezcGraphBoundings $boundings
param: ezcGraphCoordinate $center
param: float $angle
param: float $radius
return: float

drawRadarDataLine(ezcGraphBoundings $boundings,ezcGraphContext $context,ezcGraphColor $color,ezcGraphCoordinate $center,ezcGraphCoordinate $start,ezcGraphCoordinate $end,$dataNumber = 1,$dataCount = 1,$symbol = ezcGraph::NO_SYMBOL,ezcGraphColor $symbolColor = null,ezcGraphColor $fillColor = null,$thickness = 1.)   X-Ref
Draw radar chart data line

Draws a line as a data element in a radar chart

param: ezcGraphBoundings $boundings Chart boundings
param: ezcGraphContext $context Context of call
param: ezcGraphColor $color Color of line
param: ezcGraphCoordinate $center Center of radar chart
param: ezcGraphCoordinate $start Starting point
param: ezcGraphCoordinate $end Ending point
param: int $dataNumber Number of dataset
param: int $dataCount Count of datasets in chart
param: int $symbol Symbol to draw for line
param: ezcGraphColor $symbolColor Color of the symbol, defaults to linecolor
param: ezcGraphColor $fillColor Color to fill line with
param: float $thickness Line thickness
return: void

drawDataHighlightText(ezcGraphBoundings $boundings,ezcGraphContext $context,ezcGraphCoordinate $end,$axisPosition = 0.,$dataNumber = 1,$dataCount = 1,ezcGraphFontOptions $font,$text,$size,ezcGraphColor $markLines = null,$xOffset = 0,$yOffset = 0,$stepSize = 0.,$type = ezcGraph::LINE )   X-Ref
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.

param: ezcGraphBoundings $boundings Chart boundings
param: ezcGraphContext $context Context of call
param: ezcGraphCoordinate $end Ending point
param: float $axisPosition Position of axis for drawing filled lines
param: int $dataNumber Number of dataset
param: int $dataCount Count of datasets in chart
param: ezcGraphFontOptions $font Font used for highlight string
param: string $text Acutual value
param: int $size Size of highlight text
param: ezcGraphColor $markLines
param: int $xOffset
param: int $yOffset
param: float $stepSize
param: int $type
return: void

drawLegend(ezcGraphBoundings $boundings,ezcGraphChartElementLegend $legend,$type = ezcGraph::VERTICAL )   X-Ref
Draw legend

Will draw a legend in the bounding box

param: ezcGraphBoundings $boundings Bounding of legend
param: ezcGraphChartElementLegend $legend Legend to draw;
param: int $type Type of legend: Protrait or landscape
return: void

drawBox(ezcGraphBoundings $boundings,ezcGraphColor $background = null,ezcGraphColor $borderColor = null,$borderWidth = 0,$margin = 0,$padding = 0,$title = false,$titleSize = 16 )   X-Ref
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.

param: ezcGraphBoundings $boundings Boundings of the box
param: ezcGraphColor $background Background color
param: ezcGraphColor $borderColor Border color
param: int $borderWidth Border width
param: int $margin Margin
param: int $padding Padding
param: mixed $title Title of the box
param: int $titleSize Size of title in the box
return: ezcGraphBoundings Remaining inner boundings

drawText(ezcGraphBoundings $boundings,$text,$align = ezcGraph::LEFT,ezcGraphRotation $rotation = null )   X-Ref
Draw text

Draws the provided text in the boundings

param: ezcGraphBoundings $boundings Boundings of text
param: string $text Text
param: int $align Alignement of text
param: ezcGraphRotation $rotation
return: void

drawGridLine( ezcGraphCoordinate $start, ezcGraphCoordinate $end, ezcGraphColor $color )   X-Ref
Draw grid line

Draw line for the grid in the chart background

param: ezcGraphCoordinate $start Start point
param: ezcGraphCoordinate $end End point
param: ezcGraphColor $color Color of the grid line
return: void

drawStepLine( ezcGraphCoordinate $start, ezcGraphCoordinate $end, ezcGraphColor $color )   X-Ref
Draw step line

Draw a step (marker for label position) on a axis.

param: ezcGraphCoordinate $start Start point
param: ezcGraphCoordinate $end End point
param: ezcGraphColor $color Color of the grid line
return: void

drawAxis(ezcGraphBoundings $boundings,ezcGraphCoordinate $start,ezcGraphCoordinate $end,ezcGraphChartElementAxis $axis,ezcGraphAxisLabelRenderer $labelClass = null,ezcGraphBoundings $innerBoundings = null )   X-Ref
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.

param: ezcGraphBoundings $boundings Boundings of axis
param: ezcGraphCoordinate $start Start point of axis
param: ezcGraphCoordinate $end Endpoint of axis
param: ezcGraphChartElementAxis $axis Axis to render
param: ezcGraphAxisLabelRenderer $labelClass Used label renderer
return: void

drawAxisLabel( ezcGraphCoordinate $position, ezcGraphBoundings $boundings, ezcGraphChartElementAxis $axis )   X-Ref
Draw axis label

Draw labels at the end of an axis.

param: ezcGraphCoordinate $position
param: ezcGraphBoundings $boundings
param: ezcGraphChartElementAxis $axis
return: void

legacyDrawAxis(ezcGraphBoundings $boundings,ezcGraphCoordinate $start,ezcGraphCoordinate $end,ezcGraphChartElementAxis $axis,ezcGraphAxisLabelRenderer $labelClass = null )   X-Ref
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.

This function is deprecated and will be removed in favor of its
reimplementation using the innerBoundings parameter.

param: ezcGraphBoundings $boundings Boundings of axis
param: ezcGraphCoordinate $start Start point of axis
param: ezcGraphCoordinate $end Endpoint of axis
param: ezcGraphChartElementAxis $axis Axis to render
param: ezcGraphAxisLabelRenderer $labelClass Used label renderer
return: void

drawAxisLabels()   X-Ref
Draw all left axis labels

return: void

drawBackgroundImage(ezcGraphBoundings $boundings,$file,$position = 48, $repeat = ezcGraph::NO_REPEAT )   X-Ref
Draw background image

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

param: ezcGraphBoundings $boundings Boundings for the background image
param: string $file Filename of background image
param: int $position Position of background image
param: int $repeat Type of repetition
return: void

finish()   X-Ref
Call all postprocessing functions

return: void

resetRenderer()   X-Ref
Reset renderer properties

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

return: void

drawOdometer( ezcGraphBoundings $boundings, ezcGraphChartElementAxis $axis,ezcGraphOdometerChartOptions $options )   X-Ref
Render odometer chart

param: ezcGraphBoundings $boundings
param: ezcGraphChartElementAxis $axis
param: ezcGraphOdometerChartOptions $options
return: ezcGraphBoundings

drawOdometerMarker(ezcGraphBoundings $boundings,ezcGraphCoordinate $position,$symbol,ezcGraphColor $color,$width )   X-Ref
Draw a single odometer marker.

param: ezcGraphBoundings $boundings
param: ezcGraphCoordinate $position
param: int $symbol
param: ezcGraphColor $color
param: int $width



Generated: Thu Jul 28 15:48:31 2011 Cross-referenced by PHPXref 0.7