Dan_Mason Posted October 22, 2008 Share Posted October 22, 2008 Having alot of problems when using PHPlot with MySQL. I am trying to display a graph which will change when the information in the MySQL database is changed. I already know how to display a graph with static information in it. This is the code i have so far <?php //Include phplot.php require_once 'C:Appserv/www/PHPlot/phplot/PHPlot.php' //Plot new phplot image $plot = new PHPlot (); //Set plot and data type $plot->SetPlotType('lines'); $plot->SetDataType('text-data'); //Select testdb and assign data to variable $data $r = mysql_query($db, 'SELECT * from sales'); if (!$r) exit(); $data = array(); $n_rows = mysql_num_rows($r); for ($i = 0; $i < $n_rows; $i++) $data[] = mysql_fetch_row($r, $i); ... $plot->SetDataValues($data); //Set the look of the graph $plot->SetXDataLabelPos('none'); $plot->SetLineWidths(3); $plot->SetDrawXGrid(True); //Draw the graph $plot->DrawGraph(); Some of this code was taken from examples, so i dont fully understand the Syntax, but i have the general idea. Can Anyone help? Link to comment https://forums.phpfreaks.com/topic/129563-phplot-problems/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.