public function display()
 {
     //graph generation
     $chart = new HorizontalBarChart(800, 4500);
     $dataSet = new XYDataSet();
     foreach ($this->data as $key => $datum) {
         $dataSet->addPoint(new Point($datum['client_ip'], $datum['frequency']));
     }
     $chart->setDataSet($dataSet);
     $chart->getPlot()->setGraphPadding(new Padding(5, 30, 20, 140));
     $chart->getPlot()->setLogoFileName("");
     //clear the image logo
     $chart->setTitle("");
     //clear the image title
     $chart->render("front-end/images/client_request_horizontal_bar_plot.png");
     //graph generation
     $session = SessionFactory::create();
     $selectedDate = $session->get("selected-date");
     $dom = DOMHandlerFactory::create();
     $dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
     $selectedDate = $session->get("selected-date");
     $title = "<h3>Bar Graph IP requests for the day: " . $selectedDate . " </h3>";
     $dom->whereIdIs("body-title")->insertNode($title);
     $graph = '<div style="text-align: center;">
     			<img 
     				src="front-end/images/client_request_horizontal_bar_plot.png" 
     				alt="" border="0">
     			</div>';
     $dom->whereIdIs("squidDataContainer")->insertNode($graph);
     $dom->display();
 }
예제 #2
0
//MOST CONNECTIONS PER DAY
//-----------------------------------------------------------------------------------------------------------------
$db_query = "SELECT COUNT(*), date_time\n  FROM connections\n  GROUP BY DAYOFYEAR(date_time)\n  ORDER BY COUNT(*) DESC\n  LIMIT 20 ";
$rows = R::getAll($db_query);
if (count($rows)) {
    //We create a new horizontal bar chart and initialize the dataset
    $chart = new HorizontalBarChart(600, 300);
    $dataSet = new XYDataSet();
    //For every row returned from the database we add a new point to the dataset
    foreach ($rows as $row) {
        $dataSet->addPoint(new Point(date('d-m-Y', strtotime($row['date_time'])), $row['COUNT(*)']));
    }
    //$dataSet->addPoint(new Point(date('l, d-m-Y', strtotime($row['date_time'])), $row['COUNT(*)']));
    //We set the horizontal chart's dataset and render the graph
    $chart->setDataSet($dataSet);
    $chart->setTitle("Most connections per day (Top 20)");
    $chart->getPlot()->setGraphPadding(new Padding(5, 30, 50, 75));
    //top, right, bottom, left | defaults: 5, 30, 50, 50
    $chart->render("generated-graphs/most_connections_per_day.png");
}
//-----------------------------------------------------------------------------------------------------------------
//CONNECTIONS PER DAY
//-----------------------------------------------------------------------------------------------------------------
$db_query = "SELECT COUNT(*), date_time\n  FROM connections\n  GROUP BY DAYOFYEAR(date_time)\n  ORDER BY date_time ASC";
$rows = R::getAll($db_query);
if (count($rows)) {
    //We create a new line chart and initialize the dataset
    $chart = new LineChart(600, 300);
    $dataSet = new XYDataSet();
    //This graph gets messed up for large DBs, so here is a simple way to limit some of the input
    $counter = 1;
예제 #3
0
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
/**
 * Horizontal bar chart demonstration
 *
 */
include "../libchart/classes/libchart.php";
$chart = new HorizontalBarChart(600, 170);
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("Produto", 50));
$dataSet->addPoint(new Point("/wiki/Web_Browser", 75));
$dataSet->addPoint(new Point("/wiki/World_Wide_Web", 122));
$chart->setDataSet($dataSet);
$chart->getPlot()->setGraphPadding(new Padding(5, 30, 20, 140));
$chart->setTitle("Most visited pages for www.example.com");
$chart->render("generated/demo2.png");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Libchart horizontal bars demonstration</title>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
</head>
<body>
	<img alt="Horizontal bars chart"  src="generated/demo2.png" style="border: 1px solid gray;"/>
</body>
</html>
 /**
  * Función que genera las gráficas con las medias globales
  * de los intentos y violaciones. Se muestra en el panel
  * del profesor.
  * 
  */
 public function generarGraficaMedias()
 {
     $chart = new \HorizontalBarChart(800, 350);
     $dataSet = new \XYDataSet();
     $this->__calcularMediaIntentos();
     $this->__calcularMediaViolaciones();
     if ($_SESSION["media_intentos_no_pasa_test"] != false) {
         $dataSet->addPoint(new \Point("Intentos sin pasar los test", $_SESSION["media_intentos_no_pasa_test"]));
     }
     if ($_SESSION["media_intentos_pasa_test"] != false) {
         $dataSet->addPoint(new \Point("Intentos para pasar los test", $_SESSION["media_intentos_pasa_test"]));
     }
     if ($_SESSION["media_violaciones"] != false) {
         $dataSet->addPoint(new \Point("Violaciones de código", $_SESSION["media_violaciones"]));
     }
     if ($_SESSION["media_intentos_no_pasa_test"] != false || $_SESSION["media_intentos_pasa_test"] != false || $_SESSION["media_violaciones"] != false) {
         $chart->setDataSet($dataSet);
         $chart->getPlot()->setGraphPadding(new \Padding(5, 30, 20, 140));
         $chart->setTitle("MEDIAS");
         $chart->render("img/" . $_SESSION["lti_idTarea"] . "-prof-medias.png");
     }
 }
 */
include "../libchart/classes/libchart.php";
$chart = new HorizontalBarChart(450, 250);
$serie1 = new XYDataSet();
$serie1->addPoint(new Point("18-24", 22));
$serie1->addPoint(new Point("25-34", 17));
$serie1->addPoint(new Point("35-44", 20));
$serie1->addPoint(new Point("45-54", 25));
$serie2 = new XYDataSet();
$serie2->addPoint(new Point("18-24", 13));
$serie2->addPoint(new Point("25-34", 18));
$serie2->addPoint(new Point("35-44", 23));
$serie2->addPoint(new Point("45-54", 22));
$dataSet = new XYSeriesDataSet();
$dataSet->addSerie("Male", $serie1);
$dataSet->addSerie("Female", $serie2);
$chart->setDataSet($dataSet);
$chart->setTitle("Firefox vs IE users: Age");
$chart->render("generated/demo8.png");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>Libchart line demonstration</title>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
</head>
<body>
	<img alt="Line chart" src="generated/demo8.png" style="border: 1px solid gray;"/>
</body>
</html>
예제 #6
0
 $dataSet2->addPoint(new Point("BlackBerry ({$getos13})", $getos13));
 $dataSet2->addPoint(new Point("Mobile ({$getos14})", $getos14));
 $chart2->setDataSet($dataSet2);
 $chart2->setTitle("Jenis OS");
 $chart2->render("/os.png");
 $chart3 = new HorizontalBarChart();
 $dataSet3 = new XYDataSet();
 $query = "SELECT ip,filename,count(filename) as jumlahfilename FROM `statistiksitus` WHERE dateflag BETWEEN '{$_POST['DariTanggal']}' AND '{$_POST['SampaiTanggal']}' group by filename ORDER BY `jumlahfilename`  desc limit 6";
 $hasil = mysql_query($query);
 while ($data = mysql_fetch_assoc($hasil)) {
     $filename = $data['filename'];
     $jumlahfilename = $data['jumlahfilename'];
     $dataSet3->addPoint(new Point("{$filename}", $jumlahfilename));
 }
 $chart3->setDataSet($dataSet3);
 $chart3->setTitle("Most visited pages");
 $chart3->render("mostvisited.png");
 $gethari1 = gethari("1");
 $gethari2 = gethari("2");
 $gethari3 = gethari("3");
 $gethari4 = gethari("4");
 $gethari5 = gethari("5");
 $gethari6 = gethari("6");
 $gethari0 = gethari("0");
 $chart4 = new PieChart(400);
 $dataSet4 = new XYDataSet();
 $dataSet4->addPoint(new Point("Senin ({$gethari1})", $gethari1));
 $dataSet4->addPoint(new Point("Selasa ({$gethari2})", $gethari2));
 $dataSet4->addPoint(new Point("Rabu ({$gethari3})", $gethari3));
 $dataSet4->addPoint(new Point("Kamis ({$gethari4})", $gethari4));
 $dataSet4->addPoint(new Point("Jumat ({$gethari5})", $gethari5));
    $dataSet1->addPoint(new Point("Database", $totalDatabaseTimeMM));
    $dataSet1->addPoint(new Point("Cloud", $totalTimeForCloudStorageMM));
    $dataSet1->addPoint(new Point("Display", $totalDisplayTimeMM));
    $dataSet2 = new XYDataSet();
    $dataSet2->addPoint(new Point("FileUpload", $totalTimetoUploadFilesText));
    $dataSet2->addPoint(new Point("ReadingFile", $totalTimetoReadFilesText));
    $dataSet2->addPoint(new Point("Encryption", $totalTimeForEncryptionText));
    $dataSet2->addPoint(new Point("Keyword", $totalTimeForKeywordGenerationText));
    $dataSet2->addPoint(new Point("Database", $totalDatabaseTimeText));
    $dataSet2->addPoint(new Point("Cloud", $totalTimeForCloudStorageText));
    $dataSet2->addPoint(new Point("Display", $totalDisplayTimeText));
    $dataSet = new XYSeriesDataSet();
    $dataSet->addSerie("Multimedia Index", $dataSet1);
    $dataSet->addSerie("Text Index", $dataSet2);
    $chart->setDataSet($dataSet);
    $chart->setTitle("Graphical Analysis : Indexing");
    $chart->render("generated/compareIndex.png");
    echo '
			<br /><br />
			<center><img src="generated/compareIndex.png" /></center>
			';
    echo '
			<h1>Time Analysis : Encrypted Text vs. Encrypted Multimedia Searching</h1>
			<table align="center" cellpadding="10" cellspacing="10" border="1">
				<tr>
					<th>Modules</th>
					<th>Text Time (in seconds)</th>
					<th>Multimedia Time (in seconds)</th>
				</tr>
				<tr>
					<td>Untrusted Cloud Search</td>
 public function createMostProbesPerDay()
 {
     $db_query = "SELECT COUNT(connection), date_trunc('day', timestamp) AS date\n          FROM connections\n          GROUP BY date\n          ORDER BY COUNT(connection) DESC\n          LIMIT 20 ";
     $rows = R::getAll($db_query);
     if (count($rows)) {
         //We create a new horizontal bar chart and initialize the dataset
         $chart = new HorizontalBarChart(600, 300);
         $dataSet = new XYDataSet();
         //For every row returned from the database we add a new point to the dataset
         foreach ($rows as $row) {
             $dataSet->addPoint(new Point(date('d-m-Y', strtotime($row['date'])), $row['count']));
             //$dataSet->addPoint(new Point(date('l, d-m-Y', strtotime($row['timestamp'])), $row['COUNT(session)']));
         }
         //We set the horizontal chart's dataset and render the graph
         $chart->setDataSet($dataSet);
         $chart->setTitle(MOST_PROBES_PER_DAY);
         $chart->getPlot()->setGraphPadding(new Padding(5, 30, 50, 75));
         //top, right, bottom, left | defaults: 5, 30, 50, 50
         $chart->render("generated-graphs/most_probes_per_day.png");
     }
 }
예제 #9
0
    // }
    $result2 = mysql_query("select id_libro from prestamos where id_profesor='{$idP}'", $link);
    while ($row = mysql_fetch_array($result2)) {
        $id = $row['id_libro'];
        $cantLibros = $cantLibros + 1;
        //   echo "<a href='JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');'>Open a popup window</a>";
        //   <a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>
        //   echo "<tr><td>$id</td><td>$ti</td><td>$aut</td><td>$an</td><td>$edi</td><td>$gen</td><td>$nump</td><td>$stat</td></tr>";
    }
    $dataset->addPoint(new Point("{$nomm}", $cantLibros));
    $cantLibros = 0;
}
//echo"</table>";
$chart2->setDataSet($dataset);
$chart2->getPlot()->setGraphPadding(new Padding(10, 100, 50, 200));
$chart2->setTitle("Libros por profesor");
$chart2->render("generated/GraficaLibros.jpg");
echo "<img src='generated/GraficaLibros.jpg' style='border 1px solid gray'/>";
mysql_free_result($result);
mysql_close($link);
?>
	
  </div>
	
      <br class="clear" />
    </div>
  </div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col4">
  <div id="footer">
            $serieMardi->addPoint(new Point("11h-12h", $nTH2));
            $serieMardi->addPoint(new Point("12h-14h", $nTH3));
        }
        $serieMardi->addPoint(new Point("14h-15h", $nTH4));
        $serieMardi->addPoint(new Point("15h-16h", $nTH5));
        $serieMardi->addPoint(new Point("16h-17h", $nTH6));
        $serieMardi->addPoint(new Point("17h-18h", $nTH7));
        if ($d == 2) {
            $serieMardi->addPoint(new Point("18-19h30", $nTH8));
        }
        $dataSetMardi->addSerie($y, $serieMardi);
        $chartMardi->setDataSet($dataSetMardi);
        //debug($nTH4);
    }
    $chartMardi->getPlot()->getPalette()->setBarColor(array(new Color(144, 213, 236), new Color(229, 87, 91), new Color(167, 119, 229)));
    $chartMardi->setTitle("Répartition de la fréquentation sur le " . getDay($d) . " en %");
    $chartMardi->render("img/chart/" . $year . "/resa-horaire-" . getDay($d) . ".png");
}
//affichage des charts
echo ' <ul class="nav nav-tabs">';
for ($d = 2; $d < 7; ++$d) {
    if ($d == 2) {
        $class = "active";
    } else {
        $class = "";
    }
    echo '<li class="' . $class . '"><a href="#tab_' . $d . '" data-toggle="tab">' . getDay($d) . '</a></li>';
}
?>
                  
    <li class="pull-right"><a href="#" class="text-muted"><i class="fa fa-gear"></i></a></li>
예제 #11
0
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
/**
 * Horizontal bar chart demonstration
 *
 */
include "../CMS/libchart-1.2.1/libchart/classes/libchart.php";
$chart = new HorizontalBarChart(350, 350);
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("J", 12250));
$dataSet->addPoint(new Point("F", 500));
$dataSet->addPoint(new Point("M", 50));
$dataSet->addPoint(new Point("A", 75));
$dataSet->addPoint(new Point("M", 122));
$chart->setDataSet($dataSet);
$chart->getPlot()->setGraphPadding(new Padding(5, 30, 20, 20));
$chart->setTitle("Random Crap");
$chart->render("img/demo2.png");
예제 #12
0
 public function createTop10SSHClients()
 {
     $db_query = "SELECT clients.version, COUNT(client)\n          FROM sessions INNER JOIN clients ON sessions.client = clients.id\n          GROUP BY sessions.client\n          ORDER BY COUNT(client) DESC\n          LIMIT 10";
     $rows = R::getAll($db_query);
     if (count($rows)) {
         //We create a new vertical bar chart and initialize the dataset
         $chart = new HorizontalBarChart(600, 300);
         $dataSet = new XYDataSet();
         //For every row returned from the database we add a new point to the dataset
         foreach ($rows as $row) {
             $dataSet->addPoint(new Point($row['version'] . " ", $row['COUNT(client)']));
         }
         //We set the bar chart's dataset and render the graph
         $chart->setDataSet($dataSet);
         $chart->setTitle(TOP_10_SSH_CLIENTS);
         //For this particular graph we need to set the corrent padding
         $chart->getPlot()->setGraphPadding(new Padding(5, 30, 50, 245));
         //top, right, bottom, left | defaults: 5, 30, 50, 50
         //$chart->getPlot()->setGraphPadding(new Padding(5, 80, 140, 50)); //top, right, bottom, left | defaults: 5, 30, 50, 50
         $chart->render(DIR_ROOT . "/generated-graphs/top10_ssh_clients.png");
     }
 }