Gazz1982 Posted July 22, 2007 Share Posted July 22, 2007 I have managed to create a graph plot but no bars are being displayed, im not sure what i have done wrong - is it to do with the jpgraph.php and jpgraph_bar.php location? heres the code <?php include ("E:/web/jpgraph-1.21b/src/jpgraph.php"); include ("E:/web/jpgraph-1.21b/src/jpgraph_bar.php"); // Connecting, selecting database $db = mysql_connect('127.0.0.1', 'root', '') or die(mysql_error()); mysql_select_db("gary",$db) or die(mysql_error()); // Performing SQL query $query = "SELECT count(*) FROM answer"; $result = mysql_query($query) or die('Query failed: ' . mysql_error()); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $data[] = $row[1]; $leg[] = $row[0]; } $graph = new Graph(550,550,"auto"); $graph->SetScale("textint"); $graph->img->SetMargin(50,30,50,50); //$graph->AdjBackgroundImage(0.4,0.7,-1); //setting BG type //$graph->SetBackgroundImage("linux_pez.png",BGIMG_FILLFRAME); //adding image //$graph->SetShadow(); $graph->xaxis->SetTickLabels($leg); $bplot = new BarPlot($data); $bplot->SetFillColor("lightgreen"); // Fill color $bplot->value->Show(); $bplot->value->SetFont(FF_ARIAL,FS_BOLD); $bplot->value->SetAngle(45); $bplot->value->SetColor("black","navy"); $graph->Add($bplot); $graph->Stroke(); // Closing connection mysql_close($link); ?> Link to comment https://forums.phpfreaks.com/topic/61250-jpgraph-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.