output fra function til bestemt frame
Hej! jeg har en function i en seperat function fil der danner en masse output, i dette tilfælde en graf. Jeg ville gerne have at dette output kunne diregeres over i et bestem frame, (mit site er bygget op i html frames)her er functionen
function makeMemoryGraph($hostid,$dateTfrom, $dateTend) {
include ("/var/www/html/jpgraph-1.20.2/src/jpgraph.php");
include ("/var/www/html/jpgraph-1.20.2/src/jpgraph_line.php");
//date format should be in form yyyy-mm-dd tt:mm:ss
$sql = "SELECT * FROM `forbrug`
WHERE datotid between '$dateTfrom'
and '$dateTend'
and host_id=$hostid";
opendb();
// Some data
$sqlresult = mysql_query($sql)or die(mysql_error());
while($row = mysql_fetch_array($sqlresult))
{
$ydata[] = $row['Used_Mem'];
$edatax = $row['datotid'];
$datax[]="$edatax";
}
closedb();
$graph = new Graph(900, 500,"auto");
$graph->SetScale( "textlin");
$graph->SetMargin(70, 5, 10, 130);
$graph->title->Set("Brugt memory",'center');
$graph->title->SetFont(FF_VERDANA,FS_NORMAL,18);
$graph->xaxis->SetTitle("Dato tidspunkt", 'center');
$graph->xaxis->title->SetFont(FF_ARIAL,FS_NORMAL,16);
$graph->xaxis->SetTextTickInterval(50);
$graph->xaxis->SetLabelmargin(1);
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(90);
$graph->yaxis->title->SetFont(FF_ARIAL,FS_NORMAL,16);
//$graph->yaxis->SetTitle("Memory forbrug");
//$graph->yaxis->SetTitleMargin(30);
// Setup month on X-scale
// Create a bar pot
$lineplot =new LinePlot($ydata);
$lineplot ->SetColor("blue");
// Add the plot to the graph
$graph->Add( $lineplot);
// Display the graph
$graph->Stroke();
}
?>
Den bliver kaldt fra venstre frame phpfil på følgende måde
if (isset($_POST["sid"])) {
unset($_POST['sid']);
makeMemoryGraph($hostid, $dateTfrom, $dateTend);
}