Class SvgGrapher

Description

SvgGrapher.

Build a svg document.

The most of plugin functionality are plugin defined. The plugin types are :

  • dataprovider for get the datas from various sources.
  • defs for the various svg definition.
  • filter for the curves filters.
  • internal for the internal functions (must already be in the internal
directory).
  • marker for the curves makers
  • script for the svg scripts.
  • visual for the visual representation of the curves.
For each plugin the file must be named svgGrapher.type.keyword.php and must contain a function named svgGrapher_type_keyword. eg: to the visual plugin who defined the line representation of curve the file name is svgGrapher.visual.line.php and the function is named svgGrapher_visual_line.

All plugins are call using the PluginManager class, the plugins can access to the SvgGrapher class using the SvgGrapher::singleton() method.

The plugins paths are define in the PluginManager class file.

You can redefine most of constant using by the library, they are listed in the SvgGrapher.constants.php, you must redefined them before include SvgGrapher.php

Located in /SvgGrapher.php (line 89)


	
			
Variable Summary
Method Summary
 static void exceptionHandler (object $exception)
 static SvgGrapher singleton ([float $width = 0], [float $height = 0])
 void __construct ([float $width = 400], [float $height = 300], [bool $setEHOn = false])
 boolean addCurve (mixed $name, [array $params = array()], string $color)
 void drawHLine (integer $value, [string $color = NULL], [ $id = NULL])
 void drawSVG ([string $filename = NULL], [string $specifyCSS = NULL], [boolean $prettyXML = false])
 void drawVLine (integer $value, [string $color = NULL], [ $id = NULL])
 void dumpSVG ([string $specifyCSS = NULL], [ $prettyXML = false])
 void genGraph ()
 void setDisplay (mixed $value)
 void __get (mixed $property)
 void __set (mixed $property, mixed $value)
Variables
static SvgGrapher $instance = false (line 97)

Instance (singleton) of the class

Box $boxDoc (line 159)

boxDoc

  • access: public
array $boxesPositions = array(
'title' => 'top',
'legend' => 'right')
(line 452)

boxesPositions

Boxes positions array, acceptables values are:

  • title : top or bottom
  • legend : left or right

  • access: public
Box $boxGraphPane (line 207)

boxGraphPane

  • access: public
Box $boxLabelX (line 191)

boxLabelX

  • access: public
Box $boxLabelY (line 199)

boxLabelY

  • access: public
Box $boxLegend (line 215)

boxLegend

  • access: public
Box $boxTagsX (line 175)

boxTagsX

  • access: public
Box $boxTagsY (line 183)

boxTagsY

  • access: public
Box $boxTitle (line 167)

boxTitle

  • access: public
Curve $curves = array() (line 223)

Detailled curves datas

  • var: array
  • access: public
integer $decimal = DECIMAL_NUMBER (line 249)

Number of decimals.

  • access: public
array $display = array(
'box' => true,
'tagsX' => true,
'tagsY' => true,
'stepX' => true,
'stepY' => true,
'minorStepY' => true,
'legend' => true,
'labelX' => true,
'labelY' => true,
'title' => true,
'gridX' => true,
'gridY' => true,
'limits' => true,
'w3link' => true)
(line 398)

display

You can't access directly this variable using

  1. $object->display['box'false;
see SvgGrapher::setDisplay() for more details.

  • access: protected
integer $dpiResolution = DEFAULT_DPI_RESOLUTION (line 255)

Screen resolution.

  • access: public
float $factorY = 0 (line 319)

Coefficient pixel/data to the ordinate axe.

  • access: public
int $gridLineX = 0 (line 357)

Number of lines to the abscisses grid

  • access: public
integer $gridLineXDelta = GRID_LINES_X_DELTA (line 275)

Number of pixel between each line of the abscisse grid.

  • access: public
int $gridLineY = GRID_LINES_Y (line 386)

Number of line to the grid of the Y axe

  • access: public
integer $gridLineYDelta = GRID_LINES_Y_DELTA (line 281)

Number of pixel between each line of the ordinate grid.

  • access: public
string $labelX = DEFAULT_LABEL_X (line 325)

Label X value.

  • access: public
string $labelY = DEFAULT_LABEL_Y (line 331)

Y label value.

  • access: public
int $labelYRotation = -90 (line 368)

Y label rotation

  • access: public
array $limitsLines = array(
'low' => array('value' => 0, 'color'=>'#FF0000'),'median'=>array('value'=>0,'color'=>'#00FF00'),'high'=>array('value'=>0,'color'=>'#FF0000'),)
(line 420)

limitsLines

  • access: public
integer $max = 0 (line 313)

Max value to calculate the scale.

This value is not calculated, you must fixe it if the max value is not the "real" max value passed in the curve data.

  • access: public
integer $min = 0 (line 303)

Min value to calculate the scale.

This value is not calculated, you must fixe it if the min value is not the "real" min value passed in the curve data.

  • access: public
integer $minorStepY = 8 (line 374)

Y minor step

  • access: public
mixed $minorStepYDelta = MINOR_STEP_Y_DELTA (line 345)

minorStepYDelta

  • access: public
float $nicerLookXOffset = NICER_LOOK_X_OFFSET (line 262)

Space between graph and abscisse tags.

default: 5% of the width, limit to 15.

  • access: public
float $nicerLookYOffset = NICER_LOOK_Y_OFFSET (line 269)

Space between graph and ordinate tags.

default: 5% of the width, limit to 15.

  • access: public
float $plotOffsetX = PLOT_OFFSET_X (line 287)

Padding of the first point from the abscisse.

  • access: public
float $plotOffsetY = PLOT_OFFSET_Y (line 293)

Padding of the first point from the ordinate.

  • access: public
array $range = array('min' => 0, 'max' => 0, 'delta' => 0) (line 430)

Limits of the data. (calculed with the internal findrange plugin)

  • access: public
array $rendererCallBacks = array(
'tagsX' => NULL,
'tagsY' => NULL)
(line 464)

rendererCallBacks

Call back functions used in SvgDocumentRenderer to do operations on tags.

  • access: public
integer $resolution = RESOLUTION_ENDING_ONE_ZERO (line 243)

Round level.

  • access: public
DefsElement $svgDefs = NULL (line 130)

Defs elements of the svg document

  • access: public
SvgElement $svgDocument = NULL (line 112)

Main svg document

  • access: public
mixed $svgDom (line 105)

svgDom

  • access: public
FragmentElement $svgEcma = NULL (line 136)

CDATA section of the svg document

  • access: public
GElement $svgGraphPane = NULL (line 142)

Graph section of the svg document

  • access: public
GElement $svgLegend = NULL (line 124)

Document's legend

  • access: public
GElement $svgTitles = NULL (line 118)

Titles of the svg document

  • access: public
GElement $svgToolTips = NULL (line 148)

Group element to curve tooltips

  • access: public
mixed $tagsX = array() (line 229)

Abscisse indications.

var array

  • access: public
array $tagsY = array() (line 237)

tagsY

  • access: public
mixed $tagXGapFrequency = 1 (line 362)

Frequency of the abscisses tags

  • access: public
integer $tagXRotation = -30 (line 351)

Rotation angle (degree) for the abscisse tags

  • access: public
integer $tagYRotation = 0 (line 380)

Rotation of the Y tags

  • access: public
string $title = DEFAULT_TITLE (line 337)

Graph title.

  • access: public
bool $_needUpdate = true (line 440)

_needUpdate

true if boxes position and scale need to be recalulated

  • access: private
Methods
static exceptionHandler (line 545)

Exception handler.

static void exceptionHandler (object $exception)
  • object $exception: objet Exception
static singleton (line 528)

Get the current instance (singleton) of the class, or make a new instance.

static SvgGrapher singleton ([float $width = 0], [float $height = 0])
  • float $width: document width (only for new instance)
  • float $height: document height (only for new instance)
Constructor __construct (line 479)

Constructor.

  • access: public
void __construct ([float $width = 400], [float $height = 300], [bool $setEHOn = false])
  • float $width: width width
  • float $height: document height
  • bool $setEHOn: true to set exception handler on
addCurve (line 812)

Add a curve to the graph.

  • access: public
boolean addCurve (mixed $name, [array $params = array()], string $color)
  • mixed $name: Curve identifier.
  • array $params: params to Curve object
  • string $color: Curve color
drawHLine (line 883)

Draw an horizontal line.

  • access: public
void drawHLine (integer $value, [string $color = NULL], [ $id = NULL])
  • integer $value: ordinate of the line.
  • string $color: line color.
  • $id
drawSVG (line 970)

Draw the svg or save it in file.

  • access: public
void drawSVG ([string $filename = NULL], [string $specifyCSS = NULL], [boolean $prettyXML = false])
  • string $filename: file name to save svg in file.
  • boolean $prettyXML: true to render pretty xml (unused if filename is specified).
  • string $specifyCSS: href to a CSS file.
drawVLine (line 911)

Draw a vertical line (run checkChange before draw line).

  • access: public
void drawVLine (integer $value, [string $color = NULL], [ $id = NULL])
  • integer $value: Tag name where draw the line.
  • string $color: line color.
  • $id
dumpSVG (line 949)

Write the svg in plain-text (to debug)

  • access: public
void dumpSVG ([string $specifyCSS = NULL], [ $prettyXML = false])
  • string $specifyCSS: href to a CSS file.
  • $prettyXML
genGraph (line 847)

Build the graph.

  • access: public
void genGraph ()
setDisplay (line 1023)

setDisplay

set the display property

$value can be:

  • boolean: all the elements of the $display array take the value
  • array of string: the elements listed in the array take the value true
  • array of keys / values: for each element of the array, the elements of
the $display array with the key take the value
  • string: the elements of the $display$ array take the value true
examples:
  1.  $o new SvgGrapher();
  2.  
  3.  $o->display false;
  4.  // all the elements in $display take the value false
  5.  
  6.  $o->display legend;
  7.  // $o->display['legend'] = true
  8.  
  9.  $o->display array('stepX''stepY');
  10.  // $o->display['stepX'] = true;
  11.  // $o->display['stepY'] = true;
  12.  
  13.  $o->display array('labelX'=>false'labelY'=>true'title'=>true);
  14.  // $o->display['labelX'] = false;
  15.  // $o->display['labelY'] = true;
  16.  // $o->display['title'] = true;

  • access: public
void setDisplay (mixed $value)
  • mixed $value
_calculateBoxProperties (line 632)

_calculateBoxProperties

boxes positions:

  • title on the document's top
  • legend on the document's right and on the title's bottom
  • graph pane under the title on the legend's left
  • X tags on the left of the graph pane
  • Y tags on the bottom of the graph pane
  • X label on the left of the X tags
  • Y label on the bottom of the X tags

  • access: private
void _calculateBoxProperties ()
_importCoreFunctions (line 598)

Import the core functions founded in internal directory.

  • access: private
boolean _importCoreFunctions ()
__get (line 581)

__get

  • access: public
void __get (mixed $property)
  • mixed $property
__set (line 562)

__set

  • access: public
void __set (mixed $property, mixed $value)
  • mixed $property
  • mixed $value

Documentation generated on Tue, 23 Oct 2007 11:32:14 +0200 by phpDocumentor 1.4.0