PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Er. Rochak Chauhan   Data to Graph   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example file
Class: Data to Graph
Generate bar charts from arrays of data
Author: By
Last change:
Date: 18 years ago
Size: 649 bytes
 

Contents

Class file image Download
<?php
   
/**
     * Example script
     *
     */
    // initialize data
   
$x = 'Sale';
   
$y = "Years";
   
   
$x_dataArray = array(
                       
"4091",
                       
"1311",
                       
"2491",
                       
"9091",
                       
"2091"
                       
);
   
$y_dataArray = array(
                       
"1960",
                       
"1970",
                       
"1980",
                       
"1990",
                       
"2000"
                       
);
                       
   
// actual code using CodeToGraph Class (PHP 5 ONLY)
   
try {
        require_once(
"DataToGraph.inc.php");
       
$dataToGraph = new DataToGraph($x, $y, $x_dataArray, $y_dataArray);
       
$imageCode = $dataToGraph->displayImage(800, 600);
       
        echo
$imageCode;
    }
    catch (
Exception $e) {
        echo
$e->getMessage();
    }
   
?>