public function display() { /*CHART*/ $chart = new VerticalBarChart(4500, 350); $dataSet = new XYDataSet(); foreach ($this->data as $key => $datum) { $dataSet->addPoint(new Point($datum['client_ip'], $datum['frequency'])); } $chart->setDataSet($dataSet); $chart->getPlot()->setLogoFileName(""); //clear the image logo $chart->setTitle(""); //clear the image title $chart->render("front-end/images/client_request_vertical_bar_plot.png"); /*CHART*/ $session = SessionFactory::create(); $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_vertical_bar_plot.png" alt="" border="0"> </div>'; $dom->whereIdIs("squidDataContainer")->insertNode($graph); $dom->display(); }
$dataSet = new XYDataSet(); $chart->setTitle("Site-wide Click-thru Activity"); $result = pod_query($sql_click_ALL); while ($row = mysql_fetch_assoc($result)) { $chart_points[substr($row['MN'], 0, 3) . ' ' . $row['Y']] = $row['C']; } foreach ($source_points as $key => $val) { $dataSet->addPoint(new Point($key, $chart_points[$key])); } $chart->setDataSet($dataSet); // make sure our directory exists $chart->render("{$img_dst_logo}/chart_click_ALL.png"); $chart_points = $source_points; $chart = new VerticalBarChart(570, 300); $dataSet = new XYDataSet(); $chart->setTitle("Site-wide Profile Views"); $result = pod_query($sql_profile_view_ALL); while ($row = mysql_fetch_assoc($result)) { $chart_points[substr($row['MN'], 0, 3) . ' ' . $row['Y']] = $row['C']; } foreach ($source_points as $key => $val) { $dataSet->addPoint(new Point($key, $chart_points[$key])); } $chart->setDataSet($dataSet); // make sure our directory exists $chart->render("{$img_dst_logo}/chart_profile_view_ALL.png"); $chart_points = $source_points; } ?> <p><img src="<?php
$serie2->addPoint(new Point("{$month} 22, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "22", $year), 2))); $serie2->addPoint(new Point("{$month} 23, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "23", $year), 2))); $serie2->addPoint(new Point("{$month} 24, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "24", $year), 2))); $serie2->addPoint(new Point("{$month} 25, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "25", $year), 2))); $serie2->addPoint(new Point("{$month} 26, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "26", $year), 2))); $serie2->addPoint(new Point("{$month} 27, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "27", $year), 2))); $serie2->addPoint(new Point("{$month} 28, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "28", $year), 2))); $serie2->addPoint(new Point("{$month} 29, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "29", $year), 2))); $serie2->addPoint(new Point("{$month} 30, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "30", $year), 2))); $serie2->addPoint(new Point("{$month} 31, {$year}", number_format($ro->getPxRevenueDaily_ipd($month, "31", $year), 2))); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("OPD", $serie1); $dataSet->addSerie("IPD", $serie2); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.35); $chart->setTitle("Registration Census for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRegistration.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>Registration Census for <?php echo $month; echo $year; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="/COCONUT/graphicalReport/chartList/monthlyRegistration.png" style="border: 1px solid gray;"/> </body>
case 8: $points += 2; break; case 9: $points += 1; break; } $summary[$points] += $count; } $dataSet = new XYDataSet(); foreach ($summary as $index => $count) { $dataSet->addPoint(new Point(number_format($index / 10, 1), $count)); } $chart = new VerticalBarChart(800, 400); $chart->setDataSet($dataSet); $chart->setTitle(gettext("assignment") . " " . $i); $chart->render(EXAM_ORGANIZATION_TEMP_DIR . $key . "assignment" . $i . ".png"); } for ($i = 1; $i <= $assignments; $i++) { switch (($i - 1) % 3) { case 0: $pdf->AddPage(); $y = 30; break; case 1: $y = 110; break; case 2: $y = 190; break; }
//CONNECTIONS BY DESTINATION PORTS //----------------------------------------------------------------------------------------------------------------- $db_query = "SELECT dest_port, COUNT(dest_port), proto\n FROM connections\n GROUP BY dest_port\n ORDER BY COUNT(dest_port) DESC "; $rows = R::getAll($db_query); if (count($rows)) { //We create a new vertical bar chart,a new pie chart and initialize the dataset $chart = new VerticalBarChart(600, 300); $pie_chart = new PieChart(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['dest_port'] . " / " . $row['proto'], $row['COUNT(dest_port)'])); } //We set the bar chart's dataset and render the graph $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();
public function printTop10Urls() { $db_query = "SELECT url, COUNT(url) AS count\n FROM connections\n WHERE url <> ''\n GROUP BY url\n ORDER BY COUNT(url) 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 VerticalBarChart(600, 300); $dataSet = new XYDataSet(); //We create a skeleton for the table $counter = 1; echo '<h3>Top 10 urls</h3>'; echo '<p>The following table displays the top 10 urls used by attackers.</p>'; echo '<p><a href="include/export.php?type=Urls">CSV of all urls</a><p>'; echo '<table><thead>'; echo '<tr class="dark">'; echo '<th>ID</th>'; echo '<th>Url</th>'; echo '<th>Count</th>'; echo '</tr></thead><tbody>'; //For every row returned from the database we add a new point to the dataset, //and create a new table row with the data as columns foreach ($rows as $row) { $dataSet->addPoint(new Point($row['url'], $row['count'])); echo '<tr class="light word-break">'; echo '<td>' . $counter . '</td>'; echo '<td>' . xss_clean($row['url']) . '</td>'; echo '<td>' . $row['count'] . '</td>'; echo '</tr>'; $counter++; } //Close tbody and table element, it's ready. echo '</tbody></table>'; //We set the bar chart's dataset and render the graph $chart->setDataSet($dataSet); $chart->setTitle(TOP_10_URLS); //For this particular graph we need to set the corrent padding $chart->getPlot()->setGraphPadding(new Padding(5, 40, 120, 50)); //top, right, bottom, left | defaults: 5, 30, 50, 50 $chart->render("generated-graphs/top10_urls.png"); echo '<p>This vertical bar chart visualizes the top 10 urls used by attackers.</p>'; echo '<img src="generated-graphs/top10_urls.png">'; echo '<hr /><br />'; } }
* */ /* * Vertical bar chart demonstration * */ include "../libchart/classes/libchart.php"; $chart = new VerticalBarChart(); $dataSet = new XYDataSet(); $dataSet->addPoint(new Point("Jan 2005", 273)); $dataSet->addPoint(new Point("Feb 2005", 421)); $dataSet->addPoint(new Point("March 2005", 642)); $dataSet->addPoint(new Point("April 2005", 800)); $dataSet->addPoint(new Point("May 2005", 1200)); $dataSet->addPoint(new Point("June 2005", 1500)); $dataSet->addPoint(new Point("July 2005", 2600)); $chart->setDataSet($dataSet); $chart->setTitle("Monthly usage for www.example.com"); $chart->render("generated/demo1.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 vertical bars demonstration</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Vertical bars chart" src="generated/demo1.png" style="border: 1px solid gray;"/> </body> </html>
<?php require_once 'libchart/classes/libchart.php'; use models\Order; $chart = new VerticalBarChart(); $dataSet = new XYDataSet(); foreach (Order::sumTotalOrder() as $row) { $dataSet->addPoint(new Point("{$row['order_year']} - {$row['order_month']}", $row['sum_total'])); } $chart->setDataSet($dataSet); $chart->setTitle("Chart for Orders"); $chart->render("assets/img_public/OrderGraph.png");
$serie2->addPoint(new Point("{$month} 22, {$year}", $ro->getMonthlySenior($month, "22", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 23, {$year}", $ro->getMonthlySenior($month, "23", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 24, {$year}", $ro->getMonthlySenior($month, "24", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 25, {$year}", $ro->getMonthlySenior($month, "25", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 26, {$year}", $ro->getMonthlySenior($month, "26", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 27, {$year}", $ro->getMonthlySenior($month, "27", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 28, {$year}", $ro->getMonthlySenior($month, "28", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 29, {$year}", $ro->getMonthlySenior($month, "29", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 30, {$year}", $ro->getMonthlySenior($month, "30", $year, "OPD"))); $serie2->addPoint(new Point("{$month} 31, {$year}", $ro->getMonthlySenior($month, "31", $year, "OPD"))); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("IPD Senior", $serie1); $dataSet->addSerie("OPD Senior", $serie2); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.65); $chart->setTitle("Senior Census for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlySenior.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>Senior Census for <?php echo $month; echo $year; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="/COCONUT/graphicalReport/chartList/monthlySenior.png" style="border: 1px solid gray;"/> </body>
$admin .= '<img alt="Statistik OS" src="os.png"/>'; $admin .= '<img alt="Sering di Kunjungi" src="mostvisited.png"/>'; $admin .= '<img alt="Berdasarkan Hari" src="hari.png"/>'; /*******************************/ $chart9 = new VerticalBarChart(1000, 300); $dataSet9 = new XYDataSet(); for ($a = 0; $a <= 23; $a++) { $query9 = "SELECT ip,jam,count(jam) as jumlahjam FROM `statistiksitus` WHERE dateflag BETWEEN '{$_POST['DariTanggal']}' AND '{$_POST['SampaiTanggal']}' and jam='{$a}'"; $hasil9 = mysql_query($query9); $data9 = mysql_fetch_assoc($hasil9); $jam = $data9['jam']; $jumlahjam = $data9['jumlahjam']; $dataSet9->addPoint(new Point("{$a}", $jumlahjam)); } $chart9->setDataSet($dataSet9); $chart9->setTitle("Most visited Hours"); $chart9->render("mosthours.png"); $admin .= '<img alt="Jumlah Kunjungan Jam" src="mosthours.png"/>'; /************************/ $dataSet5 = new XYSeriesDataSet(); $dataSet5->addSerie("Kunjungan", $serie1); $dataSet5->addSerie("Halaman", $serie2); $dataSet5->addSerie("Hits", $serie3); $chart5->setDataSet($dataSet5); $chart5->getPlot()->setGraphCaptionRatio(0.65); $chart5->setTitle("Statistik Kunjungan Tanggal"); $chart5->render("jumlahkunjungan.png"); $admin .= '<img alt="Jumlah Kunjungan" src="jumlahkunjungan.png"/>'; $query8 = "SELECT dateflag,count(distinct(ip)) AS kunjungan,count(distinct(filename)) AS filename,count(*) AS hits FROM statistiksitus WHERE dateflag BETWEEN '{$_POST['DariTanggal']}' AND '{$_POST['SampaiTanggal']}'group by dateflag asc"; $hasil8 = mysql_query($query8); $admin .= '
public function printTop10FailedInput() { $db_query = "SELECT input, COUNT(input)\n FROM input\n WHERE success = 0\n GROUP BY input\n ORDER BY COUNT(input) 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 VerticalBarChart(600, 300); $dataSet = new XYDataSet(); //We create a skeleton for the table $counter = 1; echo '<h3>Top 10 failed input</h3>'; echo '<p>The following table displays the top 10 failed commands entered by attackers in the honeypot system.</p>'; echo '<p><a href="include/export.php?type=FailedInput">CSV of all failed commands</a><p>'; echo '<table><thead>'; echo '<tr class="dark">'; echo '<th>ID</th>'; echo '<th>Input (fail)</th>'; echo '<th>Count</th>'; echo '</tr></thead><tbody>'; //For every row returned from the database we add a new point to the dataset, //and create a new table row with the data as columns foreach ($rows as $row) { $dataSet->addPoint(new Point($row['input'], $row['COUNT(input)'])); echo '<tr class="light word-break">'; echo '<td>' . $counter . '</td>'; echo '<td>' . xss_clean($row['input']) . '</td>'; echo '<td>' . $row['COUNT(input)'] . '</td>'; echo '</tr>'; $counter++; } //Close tbody and table element, it's ready. echo '</tbody></table>'; //We set the bar chart's dataset and render the graph $chart->setDataSet($dataSet); $chart->setTitle(TOP_10_FAILED_INPUT); //For this particular graph we need to set the corrent padding $chart->getPlot()->setGraphPadding(new Padding(5, 40, 120, 50)); //top, right, bottom, left | defaults: 5, 30, 50, 50 $chart->render(DIR_ROOT . "/generated-graphs/top10_failed_input.png"); echo '<p>This vertical bar chart visualizes the top 10 failed commands entered by attackers in the honeypot system.</p>'; echo '<img src="generated-graphs/top10_failed_input.png">'; echo '<hr /><br />'; } }
<tr> <th>Modules</th> <th>Text Time (in seconds)</th> <th>Multimedia Time (in seconds)</th> </tr> <tr> <td>Download Time</td> <td>' . $totalTextDownloadTime . '</td> <td>' . $total . '</td> </tr> </table> '; } } else { echo '<h1>Upload both the Files ie Text and Multimedia and then Refresh the Page</h1>'; } $chart = new VerticalBarChart(850, 450); $dataSet1 = new XYDataSet(); $dataSet1->addPoint(new Point("DownloadTime", $total)); $dataSet2 = new XYDataSet(); $dataSet2->addPoint(new Point("DownloadTime", $totalTextDownloadTime)); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Multimedia Download", $dataSet1); $dataSet->addSerie("Text Download", $dataSet2); $chart->setDataSet($dataSet); $chart->setTitle("Graphical Analysis : Downloading"); $chart->render("generated/compareDownload.png"); echo ' <br /><br /> <center><img src="generated/compareDownload.png" height="442" width="542" /></center> ';
public function createShellshockAttacksFromSameIP() { $db_query = "SELECT source_ip, COUNT(source_ip) AS count\n FROM connections\n WHERE is_shellshock = 'true'\n GROUP BY source_ip\n ORDER BY COUNT(source_ip) DESC\n LIMIT 20 "; $rows = R::getAll($db_query); if (count($rows)) { //We create a new vertical bar chart and initialize the dataset $chart = new VerticalBarChart(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['source_ip'], $row['count'])); } //We set the bar chart's dataset and render the graph $chart->setDataSet($dataSet); $chart->setTitle(SHELLSHOCK_ATTACKS_FROM_SAME_IP); //For this particular graph we need to set the corrent padding $chart->getPlot()->setGraphPadding(new Padding(5, 45, 80, 50)); //top, right, bottom, left | defaults: 5, 30, 50, 50 $chart->render("generated-graphs/shellshocks_attacks_from_same_ip.png"); } }
<div class="box box-primary"> <div class="box-header"><i class="fa fa-bar-chart-o"></i><h3 class="box-title">Nombre d'heures de réservation par jour pour le mois de <?php echo getMonth($month); ?> </h3></div> <div class="box-body"> <?php for ($i = 1; $i <= $nb_jour; ++$i) { $result = getStatResaByDay($year . '-' . $month . '-' . $i, $epn); //debug($result['duree']); $dataSet3->addPoint(new Point($i, $result['duree'])); $maxBound[$i] = $result['duree']; } $maxValue = ceil(max($maxBound) / 60); $chart3->setDataSet($dataSet3); $chart3->setTitle("Detail des heures pour " . getMonth($month) . " " . $year . " "); $chart3->getPlot()->getPalette()->setBarColor(array(new Color(128, 195, 28))); $chart3->getPlot()->setLabelGenerator(new TimeLabelGenerator()); // arrondir la valeur maximale supérieure $chart3->getBound()->setUpperBound($maxValue * 60); // $chart3->getTics()->quantizeTics(12); $chart3->render("img/chart/" . $year . "/" . $namepn . "_resa-Mensuelle-" . $month . ".png"); ?> <!-- rendu du graphique sous forme d'image--> <img src="img/chart/<?php echo $year; ?> /<?php echo $namepn; ?> _resa-Mensuelle-<?php
$rCallclose4day = GetRows("tab_chiamate WHERE data_att <= '" . date('Y-m-d') . "' AND n_call != 'Pianificata' AND id_stato_call = '1'" . " group by data_att", "", "data_att", $db, 1, "count(id_chiamata) as c_day, data_att"); /*$max_day = count($rCall4day); $diff = $max_day - count($rCallclose4day); */ $dataSet = new XYSeriesDataSet(); $call4day = new XYDataSet(); $callclose4day = new XYDataSet(); foreach ($rCall4day as $key => $field) { $call4day->addPoint(new Point(Inverti_Data($field['data_att']), $field['c_day'])); $callclose4day->addPoint(new Point(Inverti_Data($rCallclose4day[$key]['data_att']), $rCallclose4day[$key]['c_day'])); $tot_call += $field['c_day']; $tot_closed_call += $rCallclose4day[$key]['c_day']; } echo "Chiamate totali Gestite: <label>{$tot_call}</label>, " . "Giorni di attività: <label>" . count($rCall4day) . "</label>, " . "Media chiamate giornaliere ricevute: <label>" . round($tot_call / count($rCall4day), 2) . "</label>, " . "Media chiamate giornaliere chiuse: <label>" . round($tot_closed_call / count($rCall4day), 2) . "</label><br />"; $dataSet->addSerie("Chiamate ricevute per giorno", $call4day); $dataSet->addSerie("Chiamate chiuse per giorno", $callclose4day); $chart->setTitle("Statistiche Chiamate Ricevute/Chiuse per giorno"); $chart->setDataSet($dataSet); $chart->render(ChartPath); echo '<img src="' . ChartPath . '" alt="chart" />'; break; case "2": $chart = new PieChart(ChartWidth, ChartHeight); $chart->getPlot()->setGraphPadding(new Padding("5", "5", "30", "110")); $chart->setTitle("Chiamate chiuse per tecnico"); $Stats = GetRows("view_call WHERE data_att <= '" . date('Y-m-d') . "' AND n_call != 'Pianificata' AND id_stato_call = '1'" . " group by tecnico", "", "tecnico", $db, 1, "count(id_chiamata) as c_day, tecnico"); $dataSet = new XYDataSet(); foreach ($Stats as $key => $field) { $dataSet->addPoint(new Point($field['tecnico'] . " (" . $field['c_day'] . ")", $field['c_day'])); } $chart->setDataSet($dataSet); $chart->render(ChartPath);
$serie4->addPoint(new Point("{$month} 28, {$year}", $ro->getGenderDaily($month, "28", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 29, {$year}", $ro->getGenderDaily($month, "29", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 30, {$year}", $ro->getGenderDaily($month, "30", $year, "female", "IPD"))); $serie4->addPoint(new Point("{$month} 31, {$year}", $ro->getGenderDaily($month, "31", $year, "female", "IPD"))); $opdMale = $ro->getGenderDaily($month, "01", $year, "male", "OPD") + $ro->getGenderDaily($month, "02", $year, "male", "OPD") + $ro->getGenderDaily($month, "03", $year, "male", "OPD") + $ro->getGenderDaily($month, "04", $year, "male", "OPD") + $ro->getGenderDaily($month, "05", $year, "male", "OPD") + $ro->getGenderDaily($month, "06", $year, "male", "OPD") + $ro->getGenderDaily($month, "07", $year, "male", "OPD") + $ro->getGenderDaily($month, "08", $year, "male", "OPD") + $ro->getGenderDaily($month, "09", $year, "male", "OPD") + $ro->getGenderDaily($month, "10", $year, "male", "OPD") + $ro->getGenderDaily($month, "11", $year, "male", "OPD") + $ro->getGenderDaily($month, "12", $year, "male", "OPD") + $ro->getGenderDaily($month, "13", $year, "male", "OPD") + $ro->getGenderDaily($month, "14", $year, "male", "OPD") + $ro->getGenderDaily($month, "15", $year, "male", "OPD") + $ro->getGenderDaily($month, "16", $year, "male", "OPD") + $ro->getGenderDaily($month, "17", $year, "male", "OPD") + $ro->getGenderDaily($month, "18", $year, "male", "OPD") + $ro->getGenderDaily($month, "19", $year, "male", "OPD") + $ro->getGenderDaily($month, "20", $year, "male", "OPD") + $ro->getGenderDaily($month, "21", $year, "male", "OPD") + $ro->getGenderDaily($month, "22", $year, "male", "OPD") + $ro->getGenderDaily($month, "23", $year, "male", "OPD") + $ro->getGenderDaily($month, "24", $year, "male", "OPD") + $ro->getGenderDaily($month, "25", $year, "male", "OPD") + $ro->getGenderDaily($month, "26", $year, "male", "OPD") + $ro->getGenderDaily($month, "27", $year, "male", "OPD") + $ro->getGenderDaily($month, "28", $year, "male", "OPD") + $ro->getGenderDaily($month, "29", $year, "male", "OPD") + $ro->getGenderDaily($month, "30", $year, "male", "OPD") + $ro->getGenderDaily($month, "31", $year, "male", "OPD"); $opdFemale = $ro->getGenderDaily($month, "01", $year, "female", "OPD") + $ro->getGenderDaily($month, "02", $year, "female", "OPD") + $ro->getGenderDaily($month, "03", $year, "female", "OPD") + $ro->getGenderDaily($month, "04", $year, "female", "OPD") + $ro->getGenderDaily($month, "05", $year, "female", "OPD") + $ro->getGenderDaily($month, "06", $year, "female", "OPD") + $ro->getGenderDaily($month, "07", $year, "female", "OPD") + $ro->getGenderDaily($month, "08", $year, "female", "OPD") + $ro->getGenderDaily($month, "09", $year, "female", "OPD") + $ro->getGenderDaily($month, "10", $year, "female", "OPD") + $ro->getGenderDaily($month, "11", $year, "female", "OPD") + $ro->getGenderDaily($month, "12", $year, "female", "OPD") + $ro->getGenderDaily($month, "13", $year, "female", "OPD") + $ro->getGenderDaily($month, "14", $year, "female", "OPD") + $ro->getGenderDaily($month, "15", $year, "female", "OPD") + $ro->getGenderDaily($month, "16", $year, "female", "OPD") + $ro->getGenderDaily($month, "17", $year, "female", "OPD") + $ro->getGenderDaily($month, "18", $year, "female", "OPD") + $ro->getGenderDaily($month, "19", $year, "female", "OPD") + $ro->getGenderDaily($month, "20", $year, "female", "OPD") + $ro->getGenderDaily($month, "21", $year, "female", "OPD") + $ro->getGenderDaily($month, "22", $year, "female", "OPD") + $ro->getGenderDaily($month, "23", $year, "female", "OPD") + $ro->getGenderDaily($month, "24", $year, "female", "OPD") + $ro->getGenderDaily($month, "25", $year, "female", "OPD") + $ro->getGenderDaily($month, "26", $year, "female", "OPD") + $ro->getGenderDaily($month, "27", $year, "female", "OPD") + $ro->getGenderDaily($month, "28", $year, "female", "OPD") + $ro->getGenderDaily($month, "29", $year, "female", "OPD") + $ro->getGenderDaily($month, "30", $year, "female", "OPD") + $ro->getGenderDaily($month, "31", $year, "female", "OPD"); $ipdMale = $ro->getGenderDaily($month, "01", $year, "male", "IPD") + $ro->getGenderDaily($month, "02", $year, "male", "IPD") + $ro->getGenderDaily($month, "03", $year, "male", "IPD") + $ro->getGenderDaily($month, "04", $year, "male", "IPD") + $ro->getGenderDaily($month, "05", $year, "male", "IPD") + $ro->getGenderDaily($month, "06", $year, "male", "IPD") + $ro->getGenderDaily($month, "07", $year, "male", "IPD") + $ro->getGenderDaily($month, "08", $year, "male", "IPD") + $ro->getGenderDaily($month, "09", $year, "male", "IPD") + $ro->getGenderDaily($month, "10", $year, "male", "IPD") + $ro->getGenderDaily($month, "11", $year, "male", "IPD") + $ro->getGenderDaily($month, "12", $year, "male", "IPD") + $ro->getGenderDaily($month, "13", $year, "male", "IPD") + $ro->getGenderDaily($month, "14", $year, "male", "IPD") + $ro->getGenderDaily($month, "15", $year, "male", "IPD") + $ro->getGenderDaily($month, "16", $year, "male", "IPD") + $ro->getGenderDaily($month, "17", $year, "male", "IPD") + $ro->getGenderDaily($month, "18", $year, "male", "IPD") + $ro->getGenderDaily($month, "19", $year, "male", "IPD") + $ro->getGenderDaily($month, "20", $year, "male", "IPD") + $ro->getGenderDaily($month, "21", $year, "male", "IPD") + $ro->getGenderDaily($month, "22", $year, "male", "IPD") + $ro->getGenderDaily($month, "23", $year, "male", "IPD") + $ro->getGenderDaily($month, "24", $year, "male", "IPD") + $ro->getGenderDaily($month, "25", $year, "male", "IPD") + $ro->getGenderDaily($month, "26", $year, "male", "IPD") + $ro->getGenderDaily($month, "27", $year, "male", "IPD") + $ro->getGenderDaily($month, "28", $year, "male", "IPD") + $ro->getGenderDaily($month, "29", $year, "male", "IPD") + $ro->getGenderDaily($month, "30", $year, "male", "IPD") + $ro->getGenderDaily($month, "31", $year, "male", "IPD"); $ipdFemale = $ro->getGenderDaily($month, "01", $year, "female", "IPD") + $ro->getGenderDaily($month, "02", $year, "female", "IPD") + $ro->getGenderDaily($month, "03", $year, "female", "IPD") + $ro->getGenderDaily($month, "04", $year, "female", "IPD") + $ro->getGenderDaily($month, "05", $year, "female", "IPD") + $ro->getGenderDaily($month, "06", $year, "female", "IPD") + $ro->getGenderDaily($month, "07", $year, "female", "IPD") + $ro->getGenderDaily($month, "08", $year, "female", "IPD") + $ro->getGenderDaily($month, "09", $year, "female", "IPD") + $ro->getGenderDaily($month, "10", $year, "female", "IPD") + $ro->getGenderDaily($month, "11", $year, "female", "IPD") + $ro->getGenderDaily($month, "12", $year, "female", "IPD") + $ro->getGenderDaily($month, "13", $year, "female", "IPD") + $ro->getGenderDaily($month, "14", $year, "female", "IPD") + $ro->getGenderDaily($month, "15", $year, "female", "IPD") + $ro->getGenderDaily($month, "16", $year, "female", "IPD") + $ro->getGenderDaily($month, "17", $year, "female", "IPD") + $ro->getGenderDaily($month, "18", $year, "female", "IPD") + $ro->getGenderDaily($month, "19", $year, "female", "IPD") + $ro->getGenderDaily($month, "20", $year, "female", "IPD") + $ro->getGenderDaily($month, "21", $year, "female", "IPD") + $ro->getGenderDaily($month, "22", $year, "female", "IPD") + $ro->getGenderDaily($month, "23", $year, "female", "IPD") + $ro->getGenderDaily($month, "24", $year, "female", "IPD") + $ro->getGenderDaily($month, "25", $year, "female", "IPD") + $ro->getGenderDaily($month, "26", $year, "female", "IPD") + $ro->getGenderDaily($month, "27", $year, "female", "IPD") + $ro->getGenderDaily($month, "28", $year, "female", "IPD") + $ro->getGenderDaily($month, "29", $year, "female", "IPD") + $ro->getGenderDaily($month, "30", $year, "female", "IPD") + $ro->getGenderDaily($month, "31", $year, "female", "IPD"); $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("OPD Male (" . $opdMale . ")", $serie1); $dataSet->addSerie("OPD Female (" . $opdFemale . ")", $serie2); $dataSet->addSerie("IPD Male (" . $ipdMale . ") ", $serie3); $dataSet->addSerie("IPD Female (" . $ipdFemale . ")", $serie4); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.65); $chart->setTitle("Gender Census for {$month} {$year}"); $chart->render("../../../COCONUT/graphicalReport/chartList/monthlyRegistration.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>Registration Census for <?php echo $month; echo $year; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" /> </head> <body> <img alt="Line chart" src="/COCONUT/graphicalReport/chartList/monthlyRegistration.png" style="border: 1px solid gray;"/> </body>
while ($row1 = mysql_fetch_array($res)) { $query1 = "SELECT type FROM neev.product WHERE pid=" . $row1['pid']; try { $res2 = mysql_query($query1); if ($res2 === FALSE) { die(mysql_error()); // TODO: better error handling } } catch (PDOException $ex) { die("Failed to run query: " . $ex->getMessage()); } $row2 = mysql_fetch_array($res2); $dataSet->addPoint(new Point($row2['type'], $row1['s'])); } $chart->setDataSet($dataSet); $chart->setTitle("Productwise sale"); $chart->render("generated/prod1.png"); ?> <img alt="Vertical bars chart" src="generated/prod1.png" style="border: 1px solid gray;"/> <?php } ?> </div><!-- end sales report --> </div><!-- /.sales-pane --> <div class="tab-pane" id="emp"> <!-- emp pane--> <div class="templatemo-content-container"> <form action="" method="post" > <b> Get Product Table <b/>:
/** * Función que genera las gráficas de ls intentos realizados * por los alumnos para pasar y no pasar los test. Se muestra * en el panel del profesor. * */ public function generarGraficaVerticalAlumnosIntentos() { $alumnos_tabla = TableRegistry::get("Alumnos"); $alumnos = $alumnos_tabla->find('all'); $intentos_pasa_test = false; $intentos_no_pasa_test = false; $chart_pasa_test = new \VerticalBarChart(800, 350); $dataSet_pasa_test = new \XYDataSet(); $this->__añadirIntervalosIntentosEjeX($dataSet_pasa_test); $chart_no_pasa_test = new \VerticalBarChart(800, 350); $dataSet_no_pasa_test = new \XYDataSet(); $this->__añadirIntervalosIntentosEjeX($dataSet_no_pasa_test); if (file_exists("img/" . $_SESSION["lti_idTarea"] . "-prof-intentos_noPasaTest.png")) { unlink("img/" . $_SESSION["lti_idTarea"] . "-prof-intentos_noPasaTest.png"); } foreach ($alumnos as $alumno) { $intentos_tabla = TableRegistry::get("Intentos"); $intentos_alumno = $intentos_tabla->find('all')->where(['tarea_id' => $_SESSION["lti_idTarea"], 'alumno_id' => $alumno->id]); if (!$intentos_alumno->isEmpty()) { $num_intentos_realizados = 0; $test_pasados = false; foreach ($intentos_alumno as $intento) { $num_intentos_realizados++; if ($intento->resultado == 1) { // Test pasados $intentos_pasa_test = true; $test_pasados = true; $intervalo = $this->__obtenerIntervaloIntento($num_intentos_realizados); $point = $dataSet_pasa_test->getPointWithX($intervalo); $point->setY($point->getY() + 1); break; } } if (!$test_pasados) { // Test no pasados $intentos_no_pasa_test = true; $intervalo = $this->__obtenerIntervaloIntento($num_intentos_realizados); $point = $dataSet_no_pasa_test->getPointWithX($intervalo); $point->setY($point->getY() + 1); } } } if ($intentos_pasa_test) { $chart_pasa_test->setDataSet($dataSet_pasa_test); $chart_pasa_test->setTitle("Número de alumnos que han realizado X intentos para pasar los test"); $chart_pasa_test->render("img/" . $_SESSION["lti_idTarea"] . "-prof-intentos_pasaTest_intervalos.png"); } if ($intentos_no_pasa_test) { $chart_no_pasa_test->setDataSet($dataSet_no_pasa_test); $chart_no_pasa_test->setTitle("Número de alumnos que han realizado X intentos sin conseguir pasar los test"); $chart_no_pasa_test->render("img/" . $_SESSION["lti_idTarea"] . "-prof-intentos_noPasaTest_intervalos.png"); } }
} else { // error opening the file. } $total = $read[0] + $read[1] + $read[2] + $read[3]; $pp = ($total - $read[3]) / $total; $pp = $pp * 100; include "libchart/libchart/classes/libchart.php"; $chart = new VerticalBarChart(700, 500); $dataSet = new XYDataSet(); $dataSet->addPoint(new Point("FCD", $read[0])); $dataSet->addPoint(new Point("First Class", $read[1])); $dataSet->addPoint(new Point("Second Class", $read[2])); $dataSet->addPoint(new Point("Fail", $read[3])); $chart->setDataSet($dataSet); //$chart->setUpperBound ( 120) ; $chart->setTitle("Maharaja institute of Technology, EC Branch, 8th Sem"); $chart->render("demo1.png"); // Creating the new document... $phpWord = new \PhpOffice\PhpWord\PhpWord(); $phpWord->addParagraphStyle('tStyle', array('align' => 'center', 'spaceAfter' => 100)); $phpWord->addParagraphStyle('nStyle', array('align' => 'justify')); $phpWord->addFontStyle('tFont', array('name' => 'Times New Roman', 'bold' => true, 'italic' => true, 'size' => 24, 'allCaps' => true)); $phpWord->addFontStyle('hFont', array('name' => 'Times New Roman', 'bold' => false, 'italic' => false, 'size' => 10, 'allCaps' => true)); $phpWord->addFontStyle('aFont', array('name' => 'Times New Roman', 'bold' => true, 'italic' => false, 'size' => 9)); $phpWord->addFontStyle('aFonti', array('name' => 'Times New Roman', 'bold' => true, 'italic' => true, 'size' => 9)); $phpWord->addFontStyle('nFont', array('name' => 'Times New Roman', 'bold' => false, 'italic' => false, 'size' => 10)); $phpWord->addNumberingStyle('multilevel', array('type' => 'multilevel', 'levels' => array(array('format' => 'upperRoman', 'text' => '%1.', 'left' => 360, 'hanging' => 360, 'tabPos' => 360), array('format' => 'upperLetter', 'text' => '%2.', 'left' => 720, 'hanging' => 360, 'tabPos' => 720)))); //Title $section = $phpWord->addSection(); $section->addText(htmlspecialchars("Maharaja Institute of Techonology"), 'tFont', 'tStyle'); $section->addTextBreak($lineSpace);
} return $a['hours'] < $b['hours'] ? -1 : 1; } usort($matches, 'cmp'); $chart = new VerticalBarChart(1400, 550); $dataSet = new XYDataSet(); // $chart->getPlot()->setGraphPadding(new Padding(5, 25, 10, 25)); // add a data point for each month foreach ($matches as $matchesPerHour) { $dataSet->addPoint(new Point($matchesPerHour['hours'], $matchesPerHour['matches'])); } $chart->setDataSet($dataSet); // compute oldest date in a nice formatting for chart $oldestMonth = substr($oldTimestamp, 5, 2); $oldestMonth .= '/' . substr($oldTimestamp, 0, 4); $chart->setTitle('Official GU Matches Per Hour (UTC) [ ' . $oldestDate . ' - ' . $oldestMonth . ' ]'); // FIXME: Where should the graph be saved? $chart->render(dirname(__FILE__) . '/img/matchesPerHourBar.png'); $chart = new LineChart(1400, 550); $dataSet = new XYDataSet(); // $chart->getPlot()->setGraphPadding(new Padding(5, 25, 10, 25)); // add a data point for each month foreach ($matches as $matchesPerHour) { $dataSet->addPoint(new Point($matchesPerHour['hours'], $matchesPerHour['matches'])); } $chart->setDataSet($dataSet); // compute oldest date in a nice formatting for chart $oldestMonth = substr($oldTimestamp, 5, 2); $oldestMonth .= '/' . substr($oldTimestamp, 0, 4); $chart->setTitle('Official GU Matches Per Hour (UTC) [ ' . $oldestDate . ' - ' . $oldestMonth . ' ]'); // FIXME: Where should the graph be saved?
</tr> <tr> <td>Cloud Storage</td> <td>' . $totalTimeForCloudStorage . '</td> </tr> <tr> <td>Display Contents</td> <td>' . $totalDisplayTime . '</td> </tr> <tr> <th>Total Time</th> <th>' . $totalTimeIndexing . '</th> </tr> </table> '; $chart = new VerticalBarChart(1200, 500); $dataSet = new XYDataSet(); $dataSet->addPoint(new Point("File Upload", $totalTimetoUploadFiles)); $dataSet->addPoint(new Point("Reading File", $totalTimetoReadFiles)); $dataSet->addPoint(new Point("Encryption", $totalTimeForEncryption)); $dataSet->addPoint(new Point("Keyword Extraction", $totalTimeForKeywordGeneration)); $dataSet->addPoint(new Point("Database <br>Computations", $totalDatabaseTime)); $dataSet->addPoint(new Point("Cloud Storage", $totalTimeForCloudStorage)); $dataSet->addPoint(new Point("Display Contents", $totalDisplayTime)); $chart->setDataSet($dataSet); $chart->setTitle("Graphical Analysis"); $chart->render("generated/multimediaIndex.png"); echo ' <br /><br /> <center><img src="generated/multimediaIndex.png" /></center> ';
public function printShockpotGeoData() { $db_query = "SELECT source_ip, COUNT(source_ip) AS count\n FROM connections\n GROUP BY source_ip\n ORDER BY COUNT(source_ip) DESC\n LIMIT 10 "; $rows = R::getAll($db_query); if (count($rows)) { //We create a new vertical bar chart, a new pie chart and initialize the dataset $verticalChart = new VerticalBarChart(600, 300); $pieChart = new PieChart(600, 300); $dataSet = new XYDataSet(); //We create a "intensity" pie chart as well along with a dataset $intensityPieChart = new PieChart(600, 300); $intensityDataSet = new XYDataSet(); //We create a new Google Map and initialize its columns, //where the decoded geolocation data will be entered in the format //of Lat(number), Lon(number) and IP(string) $gMapTop10 = new QMapGoogleGraph(); $gMapTop10->addColumns(array(array('number', 'Lat'), array('number', 'Lon'), array('string', 'IP'))); //We create a new Intensity Map and initialize its columns, //where the decoded geolocation data will be entered in the format //of Country(2 letter string), #Probes(number) $intensityMap = new QIntensitymapGoogleGraph(); $intensityMap->addDrawProperties(array("title" => 'IntensityMap')); $intensityMap->addColumns(array(array('string', '', 'Country'), array('number', '#Probes', 'a'))); //We create a temporary table in the database where we will store the IPs along with their #probes //and the corresponding country code, otherwise the Intensity Map won't work, because we need to //GROUP BY country code and SUM the #Probers per country $temp_table = 'CREATE TEMPORARY TABLE temp_ip (ip TEXT, counter INTEGER, country TEXT)'; R::exec($temp_table); //We create a dummy counter to use for the markers' tooltip inside Google Map like: IP 3/10 //We use the same counter for the IP <table> as well $counter = 1; //We create a skeleton for the table echo '<p>The following table displays the top 10 IP addresses connected to the system (ordered by volume of connections).</p>'; echo '<table><thead>'; echo '<tr class="dark">'; echo '<th>ID</th>'; echo '<th>IP Address</th>'; echo '<th>Probes</th>'; echo '<th>City</th>'; echo '<th>Region</th>'; echo '<th>Country Name</th>'; echo '<th>Code</th>'; echo '<th>Latitude</th>'; echo '<th>Longitude</th>'; echo '<th>Hostname</th>'; echo '<th colspan="9">IP Lookup</th>'; echo '</tr></thead><tbody>'; //We need to add data on the correct Map columns. The columns are always 0 or 1 or 2 for every repetition //so we can hardcode it into our code, but we need a way to automatically increase the row index. So we //create a dummy index variable to be increased after every repetition (as many db results we have) $col = 0; //For every row returned from the database... foreach ($rows as $row) { //We create a new GeoDataObject which geolocates the IP address $geodata = new GeoDataObject($this, $row['source_ip']); //We prepare the label for our vertical bar chart and add the point $label = $row['source_ip'] . " - " . $geodata->countryCode; $dataSet->addPoint(new Point($label, $row['count'])); //We next prepare the marker's tooltip inside Google Map $tooltip = "<strong>TOP {$counter}/10:</strong> " . $row['source_ip'] . "<br />" . "<strong>Probes:</strong> " . $row['count'] . "<br />" . "<strong>City:</strong> " . $geodata->city . "<br />" . "<strong>Region:</strong> " . $geodata->region . "<br />" . "<strong>Country:</strong> " . $geodata->countryName . "<br />" . "<strong>Latitude:</strong> " . $geodata->latitude . "<br />" . "<strong>Longitude:</strong> " . $geodata->longitude . "<br />"; //And add the marker to the map $gMapTop10->setValues(array(array($col, 0, (double) $geodata->latitude), array($col, 1, (double) $geodata->longitude), array($col, 2, $tooltip))); //We prepare the data that will be inserted in our temporary table $ip = $row['source_ip']; $ip_count = $row['count']; $country_code = $geodata->countryCode; $country_query = "INSERT INTO temp_ip VALUES('{$ip}', '{$ip_count}', '{$country_code}')"; R::exec($country_query); //For every row returned from the database we create a new table row with the data as columns echo '<tr class="light">'; echo '<td>' . $counter . '</td>'; echo '<td>' . $row['source_ip'] . '</td>'; echo '<td>' . $row['count'] . '</td>'; echo '<td>' . $geodata->city . '</td>'; echo '<td>' . $geodata->region . '</td>'; echo '<td>' . $geodata->countryName . '</td>'; echo '<td>' . $geodata->countryCode . '</td>'; echo '<td>' . $geodata->latitude . '</td>'; echo '<td>' . $geodata->longitude . '</td>'; echo '<td>' . get_host($row['source_ip']) . '</td>'; echo '<td class="icon"><a href="http://www.dshield.org/ipinfo.html?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/dshield.ico"/></a></td>'; echo '<td class="icon"><a href="http://www.ipvoid.com/scan/' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/ipvoid.ico"/></a></td>'; echo '<td class="icon"><a href="http://www.robtex.com/ip/' . $row['source_ip'] . '.html" target="_blank"><img class="icon" src="images/robtex.ico"/></a></td>'; echo '<td class="icon"><a href="http://www.fortiguard.com/ip_rep/index.php?data=' . $row['source_ip'] . '&lookup=Lookup" target="_blank"><img class="icon" src="images/fortiguard.ico"/></a></td>'; echo '<td class="icon"><a href="http://labs.alienvault.com/labs/index.php/projects/open-source-ip-reputation-portal/information-about-ip/?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/alienvault.ico"/></a></td>'; echo '<td class="icon"><a href="http://www.reputationauthority.org/lookup.php?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/watchguard.ico"/></a></td>'; echo '<td class="icon"><a href="http://www.mcafee.com/threat-intelligence/ip/default.aspx?ip=' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/mcafee.ico"/></a></td>'; echo '<td class="icon"><a href="http://www.ip-adress.com/ip_tracer/' . $row['source_ip'] . '" target="_blank"><img class="icon" src="images/ip_tracer.png"/></a></td>'; echo '<td class="icon"><a href="https://www.virustotal.com/en/ip-address/' . $row['source_ip'] . '/information/" target="_blank"><img class="icon" src="images/virustotal.ico"/></a></td>'; echo '</tr>'; //Lastly, we increase the index used by maps to indicate the next row, //and the dummy counter that indicates the next IP index (out of 10) $col++; $counter++; } //Close tbody and table element, it's ready. echo '</tbody></table>'; echo '<hr /><br />'; //While still inside the if(count($rows)) clause (otherwise the dataSet will be empty), //we set the bar chart's dataset, render the graph and display it (we're inside html code!) $verticalChart->setDataSet($dataSet); $verticalChart->setTitle(NUMBER_OF_CONNECTIONS_PER_UNIQUE_IP_CC); //For this particular graph we need to set the corrent padding $verticalChart->getPlot()->setGraphPadding(new Padding(5, 50, 100, 50)); //top, right, bottom, left | defaults: 5, 30, 50, 50 $verticalChart->render("generated-graphs/connections_per_ip_geo.png"); echo '<p>The following vertical bar chart visualizes the top 10 IPs ordered by the number of connections to the system.' . '<br/>Notice the two-letter country code to after each IP get a quick view of the locations where the attacks are coming from.</p>'; echo '<img src="generated-graphs/connections_per_ip_geo.png">'; //We set the pie chart's dataset, render the graph and display it (we're inside html code!) $pieChart->setDataSet($dataSet); $pieChart->setTitle(NUMBER_OF_CONNECTIONS_PER_UNIQUE_IP_CC); $pieChart->render("generated-graphs/connections_per_ip_geo_pie.png"); echo '<p>The following pie chart visualizes the top 10 IPs ordered by the number of connections to the system.' . '<br/>Notice the two-letter country code to after each IP get a quick view of the locations where the attacks are coming from.</p>'; echo '<img src="generated-graphs/connections_per_ip_geo_pie.png">'; echo '<hr /><br />'; //Charts are ready, so is Google Map, let's render it below echo '<p>The following zoomable world map marks the geographic locations of the top 10 IPs according to their latitude and longitude values. ' . 'Click on them to get the full information available from the database.<p>'; //echo '<div align=center>'; echo $gMapTop10->render(); //echo '</div>'; echo '<br/><hr /><br />'; //Lastly, we prepare the data for the Intesity Map $db_query_map = "SELECT country, SUM(counter) AS sum\n FROM temp_ip\n GROUP BY country\n ORDER BY SUM(counter) DESC "; //LIMIT 10 "; $rows = R::getAll($db_query_map); if (count($rows)) { $col = 0; //Dummy row index //For every row returned from the database add the values to Intensity Map's table and intensityPieChart foreach ($rows as $row) { $countryProbes = $row['country'] . " - " . $row['sum']; $intensityDataSet->addPoint(new Point($countryProbes, $row['sum'])); $intensityMap->setValues(array(array($col, 0, (string) $row['country']), array($col, 1, (int) $row['sum']))); $col++; } } //Intensity Map is ready, render it echo '<p>The following Intensity Map shows the volume of attacks per country by summarising probes originating from the same nation, using the same IP or not.</p>'; echo $intensityMap->render(); echo '<br/>'; //We set the "intensity" pie chart's dataset, render the graph and display it (we're inside html code!) $intensityPieChart->setDataSet($intensityDataSet); $intensityPieChart->setTitle(NUMBER_OF_CONNECTIONS_PER_COUNTRY); $intensityPieChart->render("generated-graphs/connections_per_country_pie.png"); echo '<p>The following pie chart visualizes the volume of attacks per country by summarising probes originating from the same nation, using the same IP or not.</p>'; echo '<img src="generated-graphs/connections_per_country_pie.png">'; if (GEO_METHOD == 'LOCAL') { echo '<hr /><small><a href="http://www.maxmind.com">http://www.maxmind.com</a></small><br />'; } else { if (GEO_METHOD == 'GEOPLUGIN') { echo '<hr /><small><a href="http://www.geoplugin.com/geolocation/" target="_new">IP Geolocation</a> by <a href="http://www.geoplugin.com/" target="_new">geoPlugin</a></small><br />'; } else { //TODO } } } //END IF }
//Categories $nbcategories = CountCategories(); //donnes du graphique $chartCat = new VerticalBarChart(425, 300); $dataSetCat = new XYDataSet(); $y = $year; if ($nbcategories > 0) { for ($n = 1; $n <= $nbcategories; $n++) { $categories = mysqli_fetch_array(statSessionCategory($n, $y, $epn)); //debug($categories); $particip = round($categories['presents'] / $categories['inscrits'] * 100, 2) . " %"; $dataSetCat->addPoint(new Point($categories['label_categorie'], $particip)); } //creation du graphique $chartCat->setDataSet($dataSetCat); $chartCat->setTitle("Participation par categories en %"); $chartCat->getPlot()->getPalette()->setBarColor(array(new Color(1, 105, 201))); $chartCat->render("img/chart/" . $year . "/categorieSession.png"); } ?> <!-- Mettre en evidence frequentation participation --> <div class="box box-primary"> <div class="box-header"><i class="fa fa-bar-chart-o"></i><h3 class="box-title">Fréquentation des sessions (année <?php echo $year; ?> )</h3></div> <div class="box-body"> <table class="table"> <thead><tr>
$chartC->getPlot()->getPalette()->setBarColor(array(new Color(1, 105, 201))); $chartC->render("img/chart/" . $year . "/categorieAtelier.png"); } //GRAPHIQUE 2 : taux de presence par categorie sur l'année $chartC2 = new VerticalBarChart(449, 250); $dataSetC2 = new XYDataSet(); if ($nbcategories > 0) { for ($x = 1; $x <= $nbcategories; $x++) { $categorieT = mysqli_fetch_array(StatPresentsCat($year, $x, $epn)); //debug($categorieT); $tauxP = number_format($categorieT['NumP'] / $categorieT['NumI'] * 100, 2) . " %"; $dataSetC2->addPoint(new Point($categorieT['label_categorie'], $tauxP)); } //creation du graphique $chartC2->setDataSet($dataSetC2); $chartC2->setTitle("Taux de presence par categories sur l'annee"); $chartC2->getPlot()->getPalette()->setBarColor(array(new Color(1, 105, 201))); $chartC2->render("img/chart/" . $year . "/categorieB.png"); } ?> <img src="img/chart/<?php echo $year; ?> /categorieAtelier.png"> <img src="img/chart/<?php echo $year; ?> /categorieB.png"> </div></div> <!-- Classement des ateliesr : les adhérents par classe d'âge-->
// assume year has always 4 digits // e.g. 2005 $curTimestamp = substr($curTimestamp, 0, 4); // $curTimestamp is oldest year, if $oldestYear is not set if (strlen($oldestYear) === 0) { $oldestYear = $curTimestamp; } if (!isset($matches[$curTimestamp]['year'])) { $matches[$curTimestamp]['year'] = $curTimestamp; } if (strcmp($curTimestamp, $oldTimestamp) === 0) { // if we are still in the same month: 1 more match in the month $matches[$curTimestamp]['matches']++; } else { // otherwise initialise with 1 (at least one match at that month) $matches[$curTimestamp]['matches'] = '1'; } // done with this month $oldTimestamp = $curTimestamp; } $chart = new VerticalBarChart(450, 250); $dataSet = new XYDataSet(); /* $chart->getPlot()->setGraphPadding(new Padding(0, 15, 25, 50)); */ // add a data point for each month foreach ($matches as $matchesPerYear) { $dataSet->addPoint(new Point($matchesPerYear['year'], $matchesPerYear['matches'])); } $chart->setDataSet($dataSet); $chart->setTitle('Official GU Matches [ ' . $oldestYear . ' - ' . date('Y') . ' ]'); // FIXME: Where should the graph be saved? $chart->render(dirname(__FILE__) . '/img/yearBar.png');
$sql4 = "select ifnull(sum(soluong*dongia),0) from chitietddh where maddh in (" . $madh . ")"; $chay4 = mysql_query($sql4); $r4 = mysql_fetch_row($chay4); $col1 = $col1 + $r4[0]; } $serie1->addPoint(new Point("{$date_min}", $col1)); $serie2->addPoint(new Point("{$date_min}", $col2)); $timestamp1 = strtotime(date("Y-m-d", strtotime($date_min)) . " + 1 year"); $date_min = date('Y-m-d', $timestamp1); } $dataSet = new XYSeriesDataSet(); $dataSet->addSerie("Doanh thu", $serie1); $dataSet->addSerie("Hóa đơn", $serie2); $chart->setDataSet($dataSet); $chart->getPlot()->setGraphCaptionRatio(0.65); $chart->setTitle("THỐNG KÊ DOANH THU"); $chart->render("demo7.png"); } ?> <div align="center"><img alt="Line chart" src="demo7.png" style="border: 1px solid gray;"/></div> <?php } $chay = mysql_query($sql); $tong = mysql_num_rows($chay); $sql1 = "select ifnull(sum(soluong*dongia),0) from chitietddh where maddh in (" . $sql . ")"; $chay1 = mysql_query($sql1); $r = mysql_fetch_row($chay1); $doanhthu = $r[0]; ?> <table width="750" border="0" cellpadding="0" cellspacing="0" align="center">
$direccionTincer += 1; } else { $direccionLaCuesta += 1; } } /// $paradas[] = $json[$i]->nextStop; $servicio[] = $json[$i]->service; $tiempo[] = $json[$i]->remainingMinutes; if ($json[$i]->remainingMinutes > $tiempoMax) { $tiempoMax = $json[$i]->remainingMinutes; } } $chart = new VerticalBarChart(); $dataSet = new XYDataSet(); for ($i = 0; $i < count($tiempo); $i++) { $dataSet->addPoint(new Point($paradas[$i] . '-' . $servicio[$i], $tiempo[$i])); } // addDataSet(array($tiempo[$i])); $chart->setDataSet($dataSet); $chart->setTitle("Tiempo restante por parada - tranvía"); $chart->render("grafico.png"); ?> <html> <head> <title>Libchart vertical bars demonstration</title> </head> <body> <img alt="grafico de barras" src="grafico.png" style="border: 1px solid gray;"/> </body> </html>
private function roleMainShow() { $roleEname = get_role_ename($_SESSION[C('USER_AUTH_KEY')]); $employeeId = get_employeeid($_SESSION[C('USER_AUTH_KEY')]); $this->assign('roleEname', $roleEname); if ($roleEname == "customCenterWorker") { $OrderBase = D('OrderBase'); $List = array(); $postCodeNameList = $OrderBase->table(array('tb_order_base' => 'order_base'))->join('tb_magazine magazine on magazine.postCode = order_base.postCode')->join('tb_employee_newspaper employee_newspaper on employee_newspaper.postCode = order_base.postCode')->Distinct('order_base.postCode')->field('magazine.postCode, magazine.name')->where("employee_newspaper.personID = '" . get_employeeid($_SESSION[C('USER_AUTH_KEY')]) . "'")->order('employee_newspaper.operatingFrequency desc')->select(); foreach ($postCodeNameList as $key => $vo) { $List[$key]['postCodeName'] = $vo['name']; $map['postCode'] = $vo['postCode']; $List[$key]['orderNum'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); $map['postCode'] = $vo['postCode']; $map['isChecked'] = array('eq', '0'); $List[$key]['sumUnChecked'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); $map['postCode'] = $vo['postCode']; $map['isChecked'] = array('eq', '1'); $List[$key]['sumChecked'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); $map['postCode'] = $vo['postCode']; $map['isSend'] = array('eq', '0'); $List[$key]['sumUnSend'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); $map['postCode'] = $vo['postCode']; $map['isSend'] = array('eq', '1'); $List[$key]['sumSend'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); } $this->assign('List', $List); } else { if ($roleEname == 'logisticsAssigner') { $OrderBase = D('OrderBase'); $List = array(); $postCodeNameList = $OrderBase->table(array('tb_order_base' => 'order_base'))->join('tb_magazine magazine on magazine.postCode = order_base.postCode')->join('tb_employee_newspaper employee_newspaper on employee_newspaper.postCode = order_base.postCode')->Distinct('order_base.postCode')->field('magazine.postCode, magazine.name')->where("employee_newspaper.personID = '" . get_employeeid($_SESSION[C('USER_AUTH_KEY')]) . "'")->order('employee_newspaper.operatingFrequency desc')->select(); foreach ($postCodeNameList as $key => $vo) { $List[$key]['postCodeName'] = $vo['name']; $map['postCode'] = $vo['postCode']; $map['isReceive'] = array('eq', '1'); $List[$key]['sumReceive'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); $map['postCode'] = $vo['postCode']; $map['isReceive'] = array('eq', '0'); $List[$key]['sumUnReceive'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); $map['postCode'] = $vo['postCode']; $map['isTrans'] = array('eq', '1'); $List[$key]['sumTrans'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); $map['postCode'] = $vo['postCode']; $map['isTrans'] = array('eq', '0'); $List[$key]['sumUnTrans'] = $OrderBase->where($map)->Distinct('contractID')->count('contractID'); unset($map); $PostGoods = D("PostGoods"); $map['order_base.postCode'] = $vo['postCode']; $map['post_goods.isCheckOut'] = array('eq', '1'); $List[$key]['sumCheckOut'] = $PostGoods->table(array('tb_post_goods' => 'post_goods'))->join('tb_order_flow_details order_flow_details on order_flow_details.id = post_goods.orderFlowID')->join('tb_order_base order_base on order_base.id = order_flow_details.orderID')->where($map)->count('post_goods.id'); unset($map); $PostGoods = D("PostGoods"); $map['order_base.postCode'] = $vo['postCode']; $map['post_goods.isCheckOut'] = array('eq', '0'); $List[$key]['sumUnCheckOut'] = $PostGoods->table(array('tb_post_goods' => 'post_goods'))->join('tb_order_flow_details order_flow_details on order_flow_details.id = post_goods.orderFlowID')->join('tb_order_base order_base on order_base.id = order_flow_details.orderID')->where($map)->count('post_goods.id'); unset($map); unset($map); } $this->assign('List', $List); } else { if ($roleEname == 'businessManager') { import("LibChart"); $Magazine = D('Magazine'); $OrderBase = D('OrderBase'); $List = array(); $year = date('Y'); $month = date('m'); $map = array(); $MagazineList = $Magazine->getMagazineListByEmId($employeeId); $MagazineCount = 0; $monthAdd = $month + 1; if ($MagazineList) { foreach ($MagazineList as $key => $MagazineVo) { /* 单期订单的数量 */ $orderSingleNum = 0; /* 多期订单的数量 */ $orderMonthNum = 0; /** * 算法:通过查找判断单期中的订单是否在 本月内 统计其数量 某一报刊 某一个人 */ $map['postCode'] = $MagazineVo['postCode']; $map['employeeID'] = $employeeId; $map['isSingle'] = 1; $map['orderYear'] = $year; $map['orderTime'] = array('between', strtotime("{$year}-{$month}-1 00:00:00") . ',' . strtotime("{$year}-{$monthAdd}-1 00:00:00")); $orderSingleNum = $OrderBase->where($map)->sum('orderNum'); unset($map); if (empty($orderSingleNum)) { $orderSingleNum = 0; } $map['orderYear'] = $year; $map['orderTime'] = array('between', strtotime("{$year}-{$month}-1 00:00:00") . ',' . strtotime("{$year}-{$monthAdd}-1 00:00:00")); $map['postCode'] = $MagazineVo['postCode']; $map['employeeID'] = $employeeId; $orderNumList = $OrderBase->where($map)->field('beginOrderDate, endOrderDate, orderNum')->select(); unset($map); if ($orderNumList) { foreach ($orderNumList as $orderNumVo) { $intervalMonths = $orderNumVo['endOrderDate'] - $orderNumVo['beginOrderDate'] + 1; $orderMonthNum += $orderNumVo['orderNum'] * $intervalMonths; } } $MagazineNum = $orderMonthNum + $orderSingleNum; $MagazineName = $MagazineVo['name']; if (empty($MagazineNum) || $MagazineNum == 0) { continue; } else { $List[$MagazineCount]['MagazineName'] = $MagazineName; $List[$MagazineCount]['MagazineNum'] = $MagazineNum; $MagazineCount++; } } $chart = new VerticalBarChart(600, 300); $dataSet = new XYDataSet(); $index = 1; $picUrlPath = array(); foreach ($List as $key => $vo) { /* 每行显示10个报刊,多余10个报刊,显示下一个图片 */ if ($key % 10 == 0 && $key != 0) { $chart->setDataSet($dataSet); $chart->setTitle("当月报刊的销售情况:"); $chart->render("./Public/Generated/" . $roleEname . "_" . $EmployeeId . "_" . $index . ".png"); $picUrlPath[] = "__PUBLIC__/Generated/" . $roleEname . "_" . $EmployeeId . "_" . $index . ".png"; $dataSet = new XYDataSet(); $index++; } $dataSet->addPoint(new Point($vo['MagazineName'], $vo['MagazineNum'])); } $chart->setDataSet($dataSet); $chart->setTitle("当月报刊的销售情况:"); $chart->render("./Public/Generated/" . $roleEname . "_" . $EmployeeId . "_" . $index . ".png"); $picUrlPath[] = "__PUBLIC__/Generated/" . $roleEname . "_" . $EmployeeId . "_" . $index . ".png"; $this->assign('picUrlPath', $picUrlPath); /* 只保存没提交的订单的数量 */ unset($map); $map['isChecked'] = 2; $map['employeeID'] = $employeeId; $orderSaveNotCommitNum = $OrderBase->where($map)->sum('orderNum'); $this->assign('orderSaveNotCommitNum', $orderSaveNotCommitNum); } } } } }
function _simpleChart($proposals, $criterias, $reportType) { $countryDao =& DAORegistry::getDAO('CountryDAO'); $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO'); $this->setupTemplate(); $journal =& Request::getJournal(); $measurement = Request::getUserVar('measurement'); $chartOptions = Request::getUserVar('chartOptions'); import('classes.lib.libchart.classes.libchart'); if ($reportType == 1) { $pieChart = new PieChart(); } elseif ($reportType == 2) { $pieChart = new VerticalBarChart(); } $dataSet = new XYDataSet(); $dataSetArray = array(); $keyNA = Locale::translate('editor.reports.notApplicable'); $keyN = Locale::translate('editor.reports.nationwide'); $keyWHS = Locale::translate('editor.reports.chart.withoutHumanSubjects'); if ($measurement == 0) { $endTitle = Locale::translate('common.bySomebody') . ' ' . Locale::translate('editor.reports.measurement.proposalNmbre'); } else { $endTitle = Locale::translate('common.bySomebody') . ' ' . Locale::translate('editor.reports.measurement.cumulatedBudget'); } foreach ($proposals as $proposal) { if ($measurement == 0) { $toSumUp = (int) 1; } else { $toSumUp = (int) $proposal->getTotalBudget(); } $proposalDetails = $proposal->getProposalDetails(); $riskAssessment = $proposal->getRiskAssessment(); if ($chartOptions == 'studentResearch') { if ($proposalDetails->getStudentResearch() == PROPOSAL_DETAIL_YES) { $studentResearchInfo = $proposalDetails->getStudentResearchInfo(); $key = Locale::translate($studentResearchInfo->getDegreeKey()); if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); } else { if (array_key_exists($keyNA, $dataSetArray)) { $dataSetArray[$keyNA] = $dataSetArray[$keyNA] + $toSumUp; } else { $dataSetArray[$keyNA] = (int) $toSumUp; } } } elseif ($chartOptions == 'kii') { $key = $proposalDetails->getKeyImplInstitutionAcronym(); if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); } elseif ($chartOptions == 'multiCountry') { if ($proposalDetails->getMultiCountryResearch() == PROPOSAL_DETAIL_YES) { $countries = $proposalDetails->getCountries(); $countries = explode(',', $countries); foreach ($countries as $country) { $key = $countryDao->getCountry($country); if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); } } else { if (array_key_exists($keyNA, $dataSetArray)) { $dataSetArray[$keyNA] = $dataSetArray[$keyNA] + $toSumUp; } else { $dataSetArray[$keyNA] = (int) $toSumUp; } } } elseif ($chartOptions == 'nationwide') { if ($proposalDetails->getNationwide() != PROPOSAL_DETAIL_YES) { $geoAreas = $proposalDetails->getGeoAreasArray(); foreach ($geoAreas as $geoArea) { $extraField =& $extraFieldDao->getExtraField($geoArea); $key = isset($extraField) ? $extraField->getLocalizedExtraFieldName() : '-'; if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); unset($extraField); } } else { if (array_key_exists($keyN, $dataSetArray)) { $dataSetArray[$keyN] = $dataSetArray[$keyN] + $toSumUp; } else { $dataSetArray[$keyN] = (int) $toSumUp; } } } elseif ($chartOptions == 'proposalTypes') { if ($proposalDetails->getHumanSubjects() == PROPOSAL_DETAIL_YES) { $proposalTypes = $proposalDetails->getProposalTypesArray(); foreach ($proposalTypes as $proposalType) { $extraField =& $extraFieldDao->getExtraField($proposalType); $key = isset($extraField) ? $extraField->getLocalizedExtraFieldName() : '-'; if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); unset($extraField); } } else { if (array_key_exists($keyWHS, $dataSetArray)) { $dataSetArray[$keyWHS] = $dataSetArray[$keyWHS] + $toSumUp; } else { $dataSetArray[$keyWHS] = (int) $toSumUp; } } } elseif ($chartOptions == 'researchDomains') { $researchDomains = $proposalDetails->getResearchDomainsArray(); foreach ($researchDomains as $researchDomain) { $extraField =& $extraFieldDao->getExtraField($researchDomain); $key = isset($extraField) ? $extraField->getLocalizedExtraFieldName() : '-'; if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); unset($extraField); } } elseif ($chartOptions == 'researchFields') { $researchFields = $proposalDetails->getResearchFieldsArray(); foreach ($researchFields as $researchField) { $extraField =& $extraFieldDao->getExtraField($researchField); $key = isset($extraField) ? $extraField->getLocalizedExtraFieldName() : '-'; if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); unset($extraField); } } elseif ($chartOptions == 'dataCollection') { $key = Locale::translate($proposalDetails->getDataCollectionKey()); if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); } elseif ($chartOptions == 'exportHumanTissue') { if ($riskAssessment->getBioSamples() == RISK_ASSESSMENT_YES) { $key = Locale::translate($riskAssessment->getYesNoKey($riskAssessment->getExportHumanTissue())); if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); } else { if (array_key_exists($keyNA, $dataSetArray)) { $dataSetArray[$keyNA] = $dataSetArray[$keyNA] + $toSumUp; } else { $dataSetArray[$keyNA] = (int) $toSumUp; } } } elseif ($chartOptions == 'exportReason') { if ($riskAssessment->getBioSamples() == RISK_ASSESSMENT_YES && $riskAssessment->getExportHumanTissue() == RISK_ASSESSMENT_YES) { $key = Locale::translate($riskAssessment->getExportReasonKey()); if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); } else { if (array_key_exists($keyNA, $dataSetArray)) { $dataSetArray[$keyNA] = $dataSetArray[$keyNA] + $toSumUp; } else { $dataSetArray[$keyNA] = (int) $toSumUp; } } } else { $key = Locale::translate($riskAssessment->getYesNoKey($riskAssessment->{$chartOptions}())); if (array_key_exists($key, $dataSetArray)) { $dataSetArray[$key] = $dataSetArray[$key] + $toSumUp; } else { $dataSetArray[$key] = (int) $toSumUp; } unset($key); } } switch ($chartOptions) { case 'studentResearch': $pieChart->setTitle(Locale::translate('proposal.studentInitiatedResearch') . ' ' . $endTitle); break; case 'kii': $pieChart->setTitle(Locale::translate('proposal.keyImplInstitution') . ' ' . $endTitle); break; case 'multiCountry': $pieChart->setTitle(Locale::translate('proposal.multiCountryResearch') . ' ' . $endTitle); break; case 'nationwide': $pieChart->setTitle(Locale::translate('proposal.nationwide') . ' ' . $endTitle); break; case 'proposalTypes': $pieChart->setTitle(Locale::translate('proposal.proposalType') . ' ' . $endTitle); break; case 'researchDomains': $pieChart->setTitle(Locale::translate('proposal.researchDomains') . ' ' . $endTitle); break; case 'researchFields': $pieChart->setTitle(Locale::translate('proposal.researchField') . ' ' . $endTitle); break; case 'dataCollection': $pieChart->setTitle(Locale::translate('proposal.dataCollection') . ' ' . $endTitle); break; case 'getIdentityRevealed': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.subjects") . ' - ' . Locale::translate('proposal.identityRevealedAbb') . ' ' . $endTitle); break; case 'getUnableToConsent': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.subjects") . ' - ' . Locale::translate('proposal.unableToConsentAbb') . ' ' . $endTitle); break; case 'getUnder18': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.subjects") . ' - ' . Locale::translate('proposal.under18Abb') . ' ' . $endTitle); break; case 'getDependentRelationship': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.subjects") . ' - ' . Locale::translate('proposal.dependentRelationshipAbb') . ' ' . $endTitle); break; case 'getEthnicMinority': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.subjects") . ' - ' . Locale::translate('proposal.ethnicMinorityAbb') . ' ' . $endTitle); break; case 'getImpairment': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.subjects") . ' - ' . Locale::translate('proposal.impairmentAbb') . ' ' . $endTitle); break; case 'getPregnant': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.subjects") . ' - ' . Locale::translate('proposal.pregnantAbb') . ' ' . $endTitle); break; case 'getNewTreatment': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.newTreatmentAbb') . ' ' . $endTitle); break; case 'getBioSamples': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.bioSamplesAbb') . ' ' . $endTitle); break; case 'exportHumanTissue': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.exportHumanTissueAbb') . ' ' . $endTitle); break; case 'exportReason': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.exportReason') . ' ' . $endTitle); break; case 'getRadiation': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.radiationAbb') . ' ' . $endTitle); break; case 'getDistress': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.distressAbb') . ' ' . $endTitle); break; case 'getInducements': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.inducementsAbb') . ' ' . $endTitle); break; case 'getSensitiveInfo': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.sensitiveInfoAbb') . ' ' . $endTitle); break; case 'getReproTechnology': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.reproTechnologyAbb') . ' ' . $endTitle); break; case 'getGenetic': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.geneticsAbb') . ' ' . $endTitle); break; case 'getStemCell': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.stemCellAbb') . ' ' . $endTitle); break; case 'getBiosafety': $pieChart->setTitle(Locale::translate("editor.reports.riskAssessment.researchIncludes") . ' - ' . Locale::translate('proposal.biosafetyAbb') . ' ' . $endTitle); break; } foreach ($dataSetArray as $key => $value) { $dataSet->addPoint(new Point($key . ' (' . $value . ')', $value)); } $pieChart->setDataSet($dataSet); $pieChart->render("classes/lib/libchart/images/" . $journal->getLocalizedInitials() . '-' . Locale::translate('editor.reports.chart') . ".png"); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign('chartLocation', "/classes/lib/libchart/images/" . $journal->getLocalizedInitials() . '-' . Locale::translate('editor.reports.chart') . ".png"); $templateMgr->assign('criterias', $criterias); $templateMgr->display('sectionEditor/reports/showChart.tpl'); }
public function createSuccessfulLoginsFromSameIP() { $db_query = "SELECT sessions.ip, COUNT(sessions.ip)\n FROM sessions INNER JOIN auth ON sessions.id = auth.session\n WHERE auth.success = 1\n GROUP BY sessions.ip\n ORDER BY COUNT(sessions.ip) DESC\n LIMIT 20 "; $rows = R::getAll($db_query); if (count($rows)) { //We create a new vertical bar chart and initialize the dataset $chart = new VerticalBarChart(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['ip'], $row['COUNT(sessions.ip)'])); } //We set the bar chart's dataset and render the graph $chart->setDataSet($dataSet); $chart->setTitle(SUCCESSFUL_LOGINS_FROM_SAME_IP); //For this particular graph we need to set the corrent padding $chart->getPlot()->setGraphPadding(new Padding(5, 45, 80, 50)); //top, right, bottom, left | defaults: 5, 30, 50, 50 $chart->render(DIR_ROOT . "/generated-graphs/logins_from_same_ip.png"); } }