PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Omar Ortiz   cSpeedometer   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example file
Class: cSpeedometer
Render a speed meter as image or HTML5 canvas
Author: By
Last change: add svg and canvas with gradient effect examples
Date: 11 years ago
Size: 1,567 bytes
 

Contents

Class file image Download
<?
require_once("cSpeedometer.php");
$colors = array(BORDER => "black",SPD_MARK=>"darkRed");
$sp1 = new cSpeedometer(250, $colors);
$sp1->setValue(87);
$sp1->setGZone(90,100);
$sp1->setYZone(65,90);
$sp1->setRZone(0,65);
$sp1->getImage("PNG","sp1");
$colors = array(BCKGND => "gray",BORDER => "darkGray");
$sp2 = new cSpeedometer(250,$colors);
$sp2->setMaxValue(50);
$sp2->setValue(44);
$sp2->setGZone(35,50);
$sp2->setYZone(25,35);
$sp2->setRZone(0,25);
$sp2->getImage("GIF","sp2");
$sp3 = new cSpeedometer(250);
$sp3->setMaxValue(100);
$sp3->setMinValue(0);
$sp3->setValue(65);
$sp3->setGZone(80,100);
$sp3->setYZone(40,80);
$sp3->setRZone(0,40);
$colors = array(BORDER => "darkBlue",SPD_MARK=>"darkGreen",SPEED=>"green",SPD_IND=>"black");
$sp4 = new cSpeedometer(250,$colors);
$sp4->setMaxValue(25);
$sp4->setValue(9);
$sp4->setGZone(0,5);
$sp4->setYZone(5,15);
$sp4->setRZone(15,25);
$sp4->getImage("JPG","sp4");
?>
<!DOCTYPE html>
<html>
<body>
<h1>Examples</h1>
<table width='100%' border='1'>
<tr><td colspan="2" align="center">Help Desk Status</td></tr>
<tr><td align='center'><img src='./tmp/sp1.png'><br>% Closed Tickets on Time (PNG)</td>
<td align='center'><img src='./tmp/sp2.gif'><br>Avg. of Daily Closed Tickets (GIF)</td></tr>
<tr><td align='center'><? echo $sp3->getSVG("sp3", 0); echo $sp3->getCanvas("sp3c", 0, true);?><br>Avg. of Days to Close a Ticket (HTML5 SVG & CANVAS)</td>
<td align='center'><img src='./tmp/sp4.jpg'><br>Tickets Exceeded Time in the Month (JPG)</td></tr>
</table>
</body>
</html>