Codice PHP:
<?php
include ("./jpgraph/jpgraph.php");
include ("./jpgraph/jpgraph_bar.php");
// Configurazione x il database
include("config.inc.php");
$db = mysql_connect($db_host, $db_user, $db_password);
if ($db == FALSE)
die ("Errore nella connessione. Verificare i parametri nel file config.inc.php");
mysql_select_db($db_name, $db)
or die ("Errore nella selezione del database. Verificare i parametri nel file config.inc.php");
$query = "SELECT data,minime,massime FROM meteo ORDER BY data DESC LIMIT 0,15";
$result = mysql_query($query, $db);
while ($row = mysql_fetch_array($result))
// Script originale
setlocale (LC_ALL, 'et_EE.ISO-8859-1');
$data1y=array(12,8,1,9,3,10,4);
$data2y=array(25,9,2,11,7,14,5);
// Create the graph. These two calls are always required
$graph = new Graph(310,200,"auto");
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40,30,20,40);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
// Create the grouped bar plot
$gbplot = new AccBarPlot(array($b1plot,$b2plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$graph->title->Set("Temperature minime e massime rilevate");
$graph->xaxis->title->Set("Giorni");
$graph->yaxis->title->Set("Temperatura");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
// Display the graph
$graph->Stroke();
mysql_close($db);
?>