PHP Classes

File: 3dbargraph.php

Recommend this page to a friend!
  Classes of Patel Shailesh   DbGraph   3dbargraph.php   Download  
File: 3dbargraph.php
Role: Example script
Content type: text/plain
Description: Bargraph script
Class: DbGraph
Generate line and 3D bar graphs
Author: By
Last change:
Date: 16 years ago
Size: 1,686 bytes
 

Contents

Class file image Download
<?php
/** *********************************************************************************************************************
 * This is main class of graph which can be generate a bar graph or line graph.
 * @author Shailesh Patel
 * @version 1.0
 * Date: 5th March.
 ** *********************************************************************************************************************
 */
include dirname(__FILE__) . "/class.3dbargraph.php";

$dbHost = 'localhost';
$dbUser = 'root';
$dbPass = '';
$dbName = 'graph';

mysql_connect($dbHost, $dbUser, $dbPass);
mysql_selectdb($dbName);

$graph = new Graph();

/** Data added for bar graph pass value of terapeakType and findingsId
* **/
$terapeaktype = $_REQUEST['tt'];
$findingsId = $_REQUEST['fId'];

$query =mysql_query("SELECT `name`,`val` FROM graph_tbl WHERE val > 50");
if(
mysql_num_rows($query) > 0 )
{
    while (
$row=mysql_fetch_array($query)) {
       
$combo=$row['val'];
       
$data[$row['name']] = $combo;
    }

   
$len=strlen(round($combo));
    for(
$i=1;$i<$len;$i++)
    {
       
$ax=$ax.'0';
    }
   
$yax='1'.$ax;
   
$axis['y-step']=$yax;
} else {
    return
0;
}
// below array used in design graph
$graphval['padding-left']=40;
$graphval['padding-top']=15;
$graphval['padding-right']=15;
$graphval['padding-bottom']=110;
$graphval['border-width']=0;
$graphval['area-height']=200;
$graphval['area-width']=300;
$graphval['transparency']=50;
$graphval['title-font']=5;
$scale['y-round']=1;

$graphArray['data'] = $data;
$graphArray['graph'] = $graphval;
$graphArray['axis'] = $axis;
$graphArray['scale'] = $scale;

$graph->__LoadGraphDefinitions($graphArray);
$graph->DrawGraph();

?>