Jump to content

[SOLVED] graphs using php


Gazz1982

Recommended Posts

I have created a graph using the below code.

 

<?include("phpgraphlib.php");

$graph=new PHPGraphLib(400,300);

$data=array("1"=>20, "2"=>198, "3"=>70, "4"=>90);

$graph->addData($data);

$graph->setTitle("Definitions");

$graph->setGradient("red", "maroon");

$graph->setBarOutlineColor("black");

$graph->setTextColor("blue");

$graph->createGraph();

// Closing connection

mysql_close($link);

?>

 

This is called from a html page using

 

<img src="bar_graph.php" />

 

I have a database using mysql, how would i link this into the graph?

ie from $data=array("1"=>20, "2"=>198, "3"=>70, "4"=>90); to $data=array("1"=$a, "2"=$b, "3"=>$c, "4"=>$d);

 

in this case the $a/b/c and d would be called from a query

 

I tried the above $data=array... but it didn't work any ideas?

 

Gary

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.