sistemazione grafici

This commit is contained in:
cmaffio
2016-03-21 17:25:22 +01:00
parent e766f020d5
commit c8739ece44

View File

@@ -1,18 +1,19 @@
<?php <?php
include_once ("../core/config.php"); include_once ("../core/config.php");
$UTENTE = login(); //$UTENTE = login();
//isadmin(); //isadmin();
include_once "../jpgraph/jpgraph.php"; include_once "../jpgraph/jpgraph.php";
include_once "../jpgraph/jpgraph_bar.php";
//include_once "../jpgraph/jpgraph_line.php"; //include_once "../jpgraph/jpgraph_line.php";
//include_once "../jpgraph/jpgraph_plotline.php"; //include_once "../jpgraph/jpgraph_plotline.php";
//include_once( "../jpgraph/jpgraph_date.php" ); //include_once( "../jpgraph/jpgraph_date.php" );
include_once "../jpgraph/jpgraph_bar.php";
//$ip = $dato['ip'];
if (isset ($_GET['ip'])) $ip = $_GET['ip']; if (isset ($_GET['ip'])) $ip = $_GET['ip'];
if (isset ($_GET['tempo'])) $tempo = $_GET['tempo']; if (isset ($_GET['tempo'])) $tempo = $_GET['tempo'];
switch ($tempo) { switch ($tempo) {
case 'DAY': case 'DAY':
$gruppo = "HOUR"; $gruppo = "HOUR";
@@ -80,6 +81,8 @@ while ( list ($tempo, $scritta, $inviati, $ricevuti) = mysql_fetch_array($res))
if (!isset ($tmp['inv'][$tempo]) ) $tmp['inv'][$tempo] = $inviati; if (!isset ($tmp['inv'][$tempo]) ) $tmp['inv'][$tempo] = $inviati;
if (!isset ($tmp['ric'][$tempo]) ) $tmp['ric'][$tempo] = $ricevuti; if (!isset ($tmp['ric'][$tempo]) ) $tmp['ric'][$tempo] = $ricevuti;
if (!isset ($tmp['tag'][$tempo]) ) $tmp['tag'][$tempo] = $scritta; if (!isset ($tmp['tag'][$tempo]) ) $tmp['tag'][$tempo] = $scritta;
if (!isset ($tmp['txtR'][$tempo]) ) $tmp['txtR'][$tempo] = "Ricevuti: $ricevuti";
if (!isset ($tmp['txtI'][$tempo]) ) $tmp['txtI'][$tempo] = "Inviati: $inviati";
}; };
//print_r($xdata); exit; //print_r($xdata); exit;
@@ -89,6 +92,9 @@ foreach ($xdata as $key => $val) {
$ydata['inv'][] = $tmp['inv'][$val]; $ydata['inv'][] = $tmp['inv'][$val];
$ydata['ric'][] = $tmp['ric'][$val]; $ydata['ric'][] = $tmp['ric'][$val];
$ydata['tag'][] = $tmp['tag'][$val]; $ydata['tag'][] = $tmp['tag'][$val];
$ydata['dst'][] = "#";
$ydata['txtR'][] = $tmp['txtR'][$val];
$ydata['txtI'][] = $tmp['txtI'][$val];
} }
//print_r($ydata); exit; //print_r($ydata); exit;
@@ -107,20 +113,20 @@ $g->legend->Pos(0.05,0.1);
$b1plot = new BarPlot ( $ydata['inv'] ); $b1plot = new BarPlot ( $ydata['inv'] );
$b2plot = new BarPlot ( $ydata['ric'] ); $b2plot = new BarPlot ( $ydata['ric'] );
$gbplot = new GroupBarPlot (array( $b1plot , $b2plot )); $gbplot = new GroupBarPlot (array( $b1plot , $b2plot ));
//$gbplot = new AccBarPlot (array( $b1plot , $b2plot ));
$g->Add ( $gbplot ); $g->Add ( $gbplot );
$b1plot->SetFillColor('red'); $b1plot->SetFillColor('red');
$b1plot->SetShadow('gray',0.8); $b1plot->SetShadow('gray',0.8);
$b1plot->SetLegend("Inviati"); $b1plot->SetLegend("Inviati");
$b1plot->SetCSIMTargets($ydata['dst'],$ydata['txtI']);
$b2plot->SetFillColor('blue'); $b2plot->SetFillColor('blue');
$b2plot->SetShadow('gray',0.8); $b2plot->SetShadow('gray',0.8);
$b2plot->SetLegend("Ricevuti"); $b2plot->SetLegend("Ricevuti");
$b2plot->SetCSIMTargets($ydata['dst'],$ydata['txtR']);
$g->xaxis->SetTickLabels($ydata['tag']); $g->xaxis->SetTickLabels($ydata['tag']);
//$g->StrokeCSIM('graph.php','');
$g->Stroke(); $g->Stroke();
?> ?>