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();
 }
 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");
     }
 }
Esempio n. 3
0
 * 
 * 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 "../../../COCONUT/libchart/libchart/classes/libchart.php";
$chart = new VerticalBarChart(8000, 600);
$ro = new database1();
$serie1 = new XYDataSet();
$serie1->addPoint(new Point("{$month} 1, {$year}", number_format($ro->getPxRevenueDaily_opd($month, "01", $year), 2)));
$serie1->addPoint(new Point("{$month} 2, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "02", $year), 2)));
$serie1->addPoint(new Point("{$month} 3, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "03", $year), 2)));
$serie1->addPoint(new Point("{$month} 4, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "04", $year), 2)));
$serie1->addPoint(new Point("{$month} 5, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "05", $year), 2)));
$serie1->addPoint(new Point("{$month} 6, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "06", $year), 2)));
$serie1->addPoint(new Point("{$month} 7, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "07", $year), 2)));
$serie1->addPoint(new Point("{$month} 8, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "08", $year), 2)));
$serie1->addPoint(new Point("{$month} 9, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "09", $year), 2)));
$serie1->addPoint(new Point("{$month} 10, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "10", $year), 2)));
$serie1->addPoint(new Point("{$month} 11, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "11", $year), 2)));
$serie1->addPoint(new Point("{$month} 12, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "12", $year), 2)));
$serie1->addPoint(new Point("{$month} 13, {$year} ", number_format($ro->getPxRevenueDaily_opd($month, "13", $year), 2)));
                $points -= 2;
                break;
            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;
Esempio n. 5
0
    $chart->getPlot()->setGraphPadding(new Padding(5, 40, 75, 50));
    //top, right, bottom, left | defaults: 5, 30, 50, 50
    $chart->render("generated-graphs/icmp_connections_per_ip.png");
    //We set the pie chart's dataset and render the graph
    $pie_chart->setDataSet($dataSet);
    $pie_chart->setTitle("Number of ICMP connections per unique IP (Top 10)");
    $pie_chart->render("generated-graphs/icmp_connections_per_ip_pie.png");
}
//-----------------------------------------------------------------------------------------------------------------
//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");
}
 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 />';
     }
 }
 * 
 * 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/>.
 * 
 */
/*
 * 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>
Esempio n. 8
0
<?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");
 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></div>




 <div class="row"><div class="col-md-12"><!-- row 2 -->

<!--// Affichage du tableau de resultat par mois et stat journalieres-->

<?php 
$nb_jour = date("t", mktime(0, 0, 0, $month, 1, $year));
//$nb_jour=date('j');
//insertion du graph libchart
$chart3 = new VerticalBarChart(900, 300);
$dataSet3 = new XYDataSet();
?>
<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&eacute;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'];
}
Esempio n. 13
0
>
				Chiamate per Provincia
			</option>
		</select>
	</form>

<?php 
require_once "{$root}/Function/libchart/classes/libchart.php";
require_once "{$root}/Function/DataTime.php";
//Padding::Padding  ($top, $right, $bottom, $left)
define("ChartPath", "tmp/chart.png");
define("ChartWidth", 1000);
define("ChartHeight", 400);
switch ($_POST['id_chart']) {
    case "1":
        $chart = new VerticalBarChart(ChartWidth, ChartHeight);
        $rCall4day = GetRows("tab_chiamate WHERE data_att <= '" . date('Y-m-d') . "' AND n_call != 'Pianificata'" . " group by data_att", "", "data_att", $db, 1, "count(id_chiamata) as c_day, data_att");
        $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);
    $chart_points = $source_points;
    $chart = new VerticalBarChart(570, 300);
    $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;
}
?>
Esempio n. 15
0
 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();
         }
     }
     switch ($chartOptions) {
     }
     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');
 }
Esempio n. 16
0
 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);
                 }
             }
         }
     }
 }
Esempio n. 17
0
                 <div class="tab-pane"  id="sales">   <!-- sales pane-->
				  <div class="templatemo-content-container">

						<?php 
$query1 = "SELECT pid, SUM(qty) as s FROM neev.order group by pid";
try {
    $res = mysql_query($query1);
    if ($res === FALSE) {
        die(mysql_error());
        // TODO: better error handling
    }
} catch (PDOException $ex) {
    die("Failed to run query: " . $ex->getMessage());
}
include "libchart/libchart/classes/libchart.php";
$chart = new VerticalBarChart(500, 250);
if (mysql_num_rows($res) > 0) {
    $dataSet = new XYDataSet();
    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']));
Esempio n. 18
0
 $hasil7 = mysql_query($query7);
 while ($data7 = mysql_fetch_assoc($hasil7)) {
     $hits = $data7['hits'];
     $date = $data7['dateflag'];
     $bulan = substr($date, 5, 2);
     $tgl = substr($date, 8, 2);
     $dateflag = $tgl . '-' . $bulan;
     $serie3->addPoint(new Point("{$dateflag}", $hits));
 }
 /*********************************************************/
 $admin .= '<img alt="Statistik Browser"  src="browser.png"/>';
 $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();
 /**
  * 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");
     }
 }
Esempio n. 20
0
$id = 0;
$handle = fopen("Result.txt", "r");
if ($handle) {
    while (($line = fgets($handle)) !== false) {
        // process the line read.
        $read[$id++] = $line;
    }
    fclose($handle);
} 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));
			</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>
		';
Esempio n. 22
0
        $matches[$curTimestamp]['hours'] = $curTimestamp;
    } else {
        // if we are still in the same day: 1 more match in the day
        $matches[$curTimestamp]['matches']++;
    }
}
// sort matches, beginning with soonest hour of day
function cmp($a, $b)
{
    if ($a['hours'] == $b['hours']) {
        return 0;
    }
    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();
" class="statBarPourcentGreen">&nbsp;<?php 
    echo getPourcent($toutsession['presents'], $toutsession['inscrits']);
    ?>
</div></div>
    </div><div class="clear"></div>
	
</div><!-- /.box-body-->
</div><!-- /.box -->


<?php 
    //liste des catégories croiser avec l'année $categorie, $year frequentation depuis année 0
    //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");
    }
 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
 }
Esempio n. 25
0
    // 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');
//Donnes du graphique
$nbcategories = CountCategories();
if ($nbcategories > 0) {
    for ($n = 1; $n <= $nbcategories; $n++) {
        $categories = mysqli_fetch_array(statAtelierCategorie($year, $n, $epn));
        //debug($categories);
        $dataSetC->addPoint(new Point($categories['label_categorie'], $categories['npCat']));
    }
    //creation du graphique
    $chartC->setDataSet($dataSetC);
    $chartC->setTitle("Nombre d'ateliers par categories sur l'annee");
    $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");
}
?>
        if ($json[$i]->direction == 1) {
            //direccion
            $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;"/>
Esempio n. 28
0
     $chart->setTitle("THỐNG KÊ DOANH THU");
     $chart->render("demo7.png");
 }
 if ($_POST["luachon"] == "nam") {
     $nam = $_POST["nam"];
     $nam1 = $_POST["nam1"];
     $date_min = "{$nam}-1-1";
     $date_max = "{$nam1}-12-31";
     $sql = "select maddh from dondathang where ngaydat between '{$nam}-1-1' and '{$nam1}-12-31' and trangthai=1";
     $sql2 = "SELECT TIMESTAMPDIFF(YEAR, '{$nam}-1-1', '{$nam1}-12-31')";
     $chay2 = mysql_query($sql2);
     $r2 = mysql_fetch_row($chay2);
     $days = $r2[0];
     $date_min = date($date_min);
     $date_max = date($date_max);
     $chart = new VerticalBarChart();
     $serie1 = new XYDataSet();
     $serie2 = new XYDataSet();
     for ($i = 0; $i <= $days; $i++) {
         $col1 = 0;
         $sql3 = "select maddh from dondathang where year(ngaydat)=year('{$date_min}') and trangthai=1";
         $chay3 = mysql_query($sql3);
         $col2 = mysql_num_rows($chay3);
         while ($ketqua3 = mysql_fetch_array($chay3)) {
             $madh = $ketqua3[0];
             $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));
Esempio n. 29
0
 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');
 }
Esempio n. 30
0
 * 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/>.
 * 
 */
/*
 * Vertical bar chart demonstration
 *
 */
include "../libchart/classes/libchart.php";
include "../../db_conn.php";
page_protect();
$chart = new VerticalBarChart(900, 300);
$dataSet = new XYDataSet();
$thisday = date('d') - 1;
$dateconvert = date('Y-m-d', strtotime("-" . $thisday . " days"));
for ($j = 1; $j < 31; $j++) {
    $date = date('Y-m-d', strtotime("-" . $j . " days"));
    $query = "select total from revisit_p_reg where register_on='{$date}'";
    //echo $query;
    $result = mysqli_query($con, $query);
    $i = 0;
    if (mysqli_affected_rows($con) != 0) {
        while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
            $i = $row['total'] + $i;
        }
    }
    $dataSet->addPoint(new Point($date, $i));