Location: PHPKode > scripts > DbGraph > dbgraph/3dbargraph.php
<?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();

?>
Return current item: DbGraph