Login   Register  
PHP Classes
elePHPant
Icontem

File: test02.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Herman Veluwenkamp  >  svgGraph  >  test02.php  >  Download  
File: test02.php
Role: Example script
Content type: text/plain
Description: Sample bar graph.
Class: svgGraph
Generate SVG graphs.
Author: By
Last change:
Date: 2002-06-04 23:08
Size: 1,970 bytes
 

Contents

Class file image Download
<?php
error_reporting
(0);

include 
'svgGraph.php';
include 
'svgGraph1.php';

$graph = new svgGraph1;
$graph->graphicWidth      400;
$graph->graphicHeight     300;
$graph->plotWidth         300;
$graph->plotHeight        200;
$graph->plotOffsetX       70;
$graph->plotOffsetY       50;
$graph->numGridlinesY     6;
$graph->numTicksY         6;

$graph->innerPaddingX     4;
$graph->innerPaddingY     4;
$graph->outerPadding      10;

$graph->offsetGridlinesX  0.5// shift so that bars are inside plot area

$graph->decimalPlacesY    2;

$graph->title             'Sample Bar Graph';
$graph->styleTitle        'font-family: sans-serif; font-size: 12pt;';

$graph->labelX            'Day of the Week';
$graph->styleLabelX       'font-family: sans-serif; font-size: 10pt;';
$graph->labelY            'Some Parameters';
$graph->styleLabelY       'font-family: sans-serif; font-size: 10pt;';

$graph->dataX             = array('Fri''Mon''Tue''Wed''Thu''Fri');
$graph->dataY['alpha']    = array(8.6107.9403.6703.6706.9408.650);
$graph->dataY['beta']     = array(1.4563.0015.1452.0501.9981.678);
$graph->dataY['gamma']    = array(4.8964.5004.1903.0502.8883.678);

$graph->styleTagsX        'font-family: monospace; font-size: 8pt;';
$graph->styleTagsY        'font-family: monospace; font-size: 8pt;';

$graph->format['alpha']   = array(
  
'style' => 'fill:#F00''barWidth' => 0.25'barOffset' => -0.5);

$graph->format['beta']    = array(
  
'style' => 'fill:#0F0''barWidth' => 0.25'barOffset' => 0);

$graph->format['gamma']   = array(
  
'style' => 'fill:#00F''barWidth' => 0.25'barOffset' => 0.5);


$graph->init()        or die($graph->error);
$graph->drawGraph();
$graph->bar('gamma')  or die($graph->error);
$graph->bar('beta')   or die($graph->error);
$graph->bar('alpha')  or die($graph->error);

$graph->outputSVG();
?>