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(); }
$chart->setDataSet($dataSet); $chart->setTitle("Number of connections by destination port"); $chart->render("generated-graphs/connections_by_dest_port.png"); //We set the pie chart's dataset and render the graph $pie_chart->setDataSet($dataSet); $pie_chart->setTitle("Number of connections by destination port"); $pie_chart->render("generated-graphs/connections_by_dest_port_pie.png"); } //----------------------------------------------------------------------------------------------------------------- //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
* * 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 "../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>
/** * 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"); } }
* * 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/>. * */ /** * Multiple horizontal bar chart demonstration. * */ 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("browser.png"); $chart2 = new PieChart(400); $dataSet2 = new XYDataSet(); $dataSet2->addPoint(new Point("Windows 8 ({$getos1})", $getos1)); $dataSet2->addPoint(new Point("Windows 7 ({$getos2})", $getos2)); $dataSet2->addPoint(new Point("Windows XP ({$getos4})", $getos4)); $dataSet2->addPoint(new Point("Mac OS X ({$getos5})", $getos5)); $dataSet2->addPoint(new Point("Linux ({$getos7})", $getos7)); $dataSet2->addPoint(new Point("iPhone ({$getos9})", $getos9)); $dataSet2->addPoint(new Point("Android ({$getos12})", $getos12)); $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");
<td>' . $totalTimeForCloudStorageText . '</td> <td>' . $totalTimeForCloudStorageMM . '</td> </tr> <tr> <td>Display Contents</td> <td>' . $totalDisplayTimeText . '</td> <td>' . $totalDisplayTimeMM . '</td> </tr> <tr> <th>Total Time</th> <th>' . $totalTimeIndexingText . '</th> <th>' . $totalTimeIndexingMM . '</th> </tr> </table> '; $chart = new HorizontalBarChart(650, 650); $dataSet1 = new XYDataSet(); $dataSet1->addPoint(new Point("FileUpload", $totalTimetoUploadFilesMM)); $dataSet1->addPoint(new Point("ReadFile", $totalTimetoReadFilesMM)); $dataSet1->addPoint(new Point("Encryption", $totalTimeForEncryptionMM)); $dataSet1->addPoint(new Point("Keyword", $totalTimeForKeywordGenerationMM)); $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));
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"); } }
function newPopup(url) { popupWindow = window.open( url,'popUpWindow','height=400,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes') } </script> <?php // $identif=$_GET['a']; $link = mysql_connect("mysql6.000webhost.com", "a5996766_hab", "blazing12"); mysql_select_db("a5996766_bib", $link); // echo "<p>$identif</p>"; // echo " Libros del profesor: "."<strong>".$_SESSION['k_username2']."</strong>"; echo "<br><br><br>"; include "libchart/classes/libchart.php"; // $chart2 = new VerticalBarChart(800,300); $chart2 = new HorizontalBarChart(800, 300); // $chart2 = new PieChart(800,300); $chart2->getConfig()->setUseMultipleColor(true); function colore() { return new Color(rand(0, 215), rand(0, 215), rand(0, 215)); } $chart2->getPlot()->getPalette()->setBarColor(array(colore(), colore(), colore(), colore(), colore(), colore(), colore(), colore(), colore(), colore(), colore(), colore(), colore(), colore(), colore())); //$chart2->getPlot()->getPalette()->setBarColor(array( //new Color(255, 0, 0), // new Color(255, 255, 255), // new Color(255, 125, 50), // new Color(255, 125, 0), // )); //$chart2 = new PieChart(800,300); //$chart2 = new LineChart(800,300);
<!-- Frequentation par tranche horaires et par semaine--> <h2 class="page-header">Répartition par tranche horaire journalières, année <?php echo $year; ?> </h2> <div class="col-md-6"> <div class="nav-tabs-custom"> <?php ///comptabiliser les connexions pour la journée choisie for ($d = 2; $d < 7; ++$d) { $nomjour = getJourEng($d); $nbPoste = getnbcomputperepn($epn); //initialisation graphiques $chartMardi = new HorizontalBarChart(440, 400); $dataSetMardi = new XYSeriesDataSet(); for ($i = 0; $i < 2; ++$i) { $y = $year - $i; $serieMardi = "serieMardi{$y}"; // series par années $serieMardi = new XYDataSet(); //debug($serieMardi); if ($y < $year) { $nombreSemaines = 52; } else { $nombreSemaines = date('W'); } if (isset($nomjour)) { $n0TH1 = statTrancheHour(600, 660, $nomjour, $y, $epn); //de 10h à 11h : h 600-659
$chart->render("mod/statistiksitus/browser.png"); $chart2 = new PieChart(400); $dataSet2 = new XYDataSet(); $dataSet2->addPoint(new Point("Windows 8 ({$getos1})", $getos1)); $dataSet2->addPoint(new Point("Windows 7 ({$getos2})", $getos2)); $dataSet2->addPoint(new Point("Windows XP ({$getos4})", $getos4)); $dataSet2->addPoint(new Point("Mac OS X ({$getos5})", $getos5)); $dataSet2->addPoint(new Point("Linux ({$getos7})", $getos7)); $dataSet2->addPoint(new Point("iPhone ({$getos9})", $getos9)); $dataSet2->addPoint(new Point("Android ({$getos12})", $getos12)); $dataSet2->addPoint(new Point("BlackBerry ({$getos13})", $getos13)); $dataSet2->addPoint(new Point("Mobile ({$getos14})", $getos14)); $chart2->setDataSet($dataSet2); $chart2->setTitle("Jenis OS"); $chart2->render("mod/statistiksitus/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("mod/statistiksitus/mostvisited.png"); $gethari1 = gethari("1"); $gethari2 = gethari("2"); $gethari3 = gethari("3"); $gethari4 = gethari("4");
* * 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");
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"); } }