Login   Register  
PHP Classes
elePHPant
Icontem

File: test01.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  >  test01.php  >  Download  
File: test01.php
Role: Example script
Content type: text/plain
Description: Line graph.
Class: svgGraph
Generate SVG graphs.
Author: By
Last change:
Date: 12 years ago
Size: 1,866 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;

$graph->decimalPlacesY    2;

$graph->title             'Sample Line 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' => 'stroke:#F00; stroke-width:4;');

$graph->format['beta']   = array(
  
'style' => 'stroke:#0F0; stroke-width:4;');

$graph->format['gamma']   = array(
  
'style' => 'stroke:#00F; stroke-width:4;');


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

$graph->outputSVG();
?>