jpgraph + php script intet output og ingen fejl beskeder
hej, jeg kan ikke få mit script her til at vise en graf. Det er taget ud fra en toturial.GD libray er installeret og ser ud til at fungere fint.
<?php
include ("jpgraph-1.20.2/src/jpgraph.php");
include ("jpgraph-1.20.2/src/jpgraph_bar.php");
mysql_connect("localhost", "mysql","");// or die(mysql_error());
mysql_select_db("KAPA"); //die(mysql_error());
$query="SELECT ho.hostname, ho.os, ho.cpu, fo.datotid, fo.iowait, fo.cpu_idle, fo.Used_Mem, ho.mem - fo.Used_Mem AS FreeMem, fo.Used_swap, ho.swapkapacitet - fo.Used_swap AS freeswap
FROM Hosts AS ho, forbrug AS fo
WHERE ho.id = fo.host_id
AND host_id =5
AND forbrug_id < 100 ";
//$sql = mysql_query("select * from forbrug where host_id=1")die(mysql_error());
$sql = mysql_query($query); //die(mysql_error());
while($row = mysql_fetch_array($sql))
{
$dato[] = $row['datotid'];
$freeMem[] = $row['Used_Mem'];
}
$graph = new Graph(250,150,"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($dato);
$bplot = new BarPlot($freeMem);
$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);
?>
Jeg forstår det ikke, der koomer ingen fejl beskeder eller noget bare en blank side.
