Location: PHPKode > scripts > DbGraph > dbgraph/linegraph.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.linegraph.php";

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

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

$graph = new LineGraph();

/** Data added for line graph pass value of findingsId
***/
$findingsId=$_REQUEST['fId'];
$query =mysql_query("SELECT id, val FROM graph_tbl ");
if(mysql_num_rows($query) > 0)
{
	while ($row=mysql_fetch_array($query)) {
		$data[$row['id']] = $row['val'];
	}
}

// below array used in design graph
$line['color']='#ff5500';
$line['background-color']='#ff8833';
$graphval['padding-left']=60;
$graphval['padding-top']=10;
$graphval['padding-right']=10;
$graphval['padding-bottom']=40;
$graphval['background-color']='#384C6A';
$graphval['background-transparent']='no';
$graphval['border-width']=0;
$graphval['area-height']=200;
$graphval['area-width']=300;
$graphval['title-color']='#fff';
$graphval['transparency']=50;
$axis['step-size']=0;
$axis['y-step-mode']='dynamic';
$axis['gridlines']='yes';
$axis['scale-color']='#fff';
$axis['border-color']='#7184A5';
$axis['background-color']='#56657F';
$axis['deepness']=1;
$scale['x-round']=0;
$scale['y-round']=1;
$axis['y-step']=5;
$graphArray['data'] = $data;
$graphArray['line'] = $line;
$graphArray['graph'] = $graphval;
$graphArray['axis'] = $axis;
$graphArray['scale'] = $scale;

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

?>
Return current item: DbGraph