kopia lustrzana https://github.com/magicbug/Cloudlog
Added Column Chart to Stats showing QSOs per Year
rodzic
3141300186
commit
60cde054ae
|
@ -36,6 +36,8 @@ class Statistics extends CI_Controller {
|
|||
$data['page_title'] = "Statistics";
|
||||
|
||||
$data['total_digi'] = $this->logbook_model->total_digi();
|
||||
|
||||
$data['totals_year'] = $this->logbook_model->totals_year();
|
||||
|
||||
$data['page_title'] = "Statistics";
|
||||
|
||||
|
|
|
@ -309,15 +309,23 @@ class Logbook_model extends CI_Model {
|
|||
return $query;
|
||||
}
|
||||
|
||||
function get_todays_qsos() {
|
||||
function get_todays_qsos() {
|
||||
$morning = date('Y-m-d 00:00:00');
|
||||
$night = date('Y-m-d 23:59:59');
|
||||
$query = $this->db->query('SELECT * FROM '.$this->config->item('table_name').' WHERE COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
|
||||
return $query;
|
||||
}
|
||||
|
||||
$morning = date('Y-m-d 00:00:00');
|
||||
$night = date('Y-m-d 23:59:59');
|
||||
$query = $this->db->query('SELECT * FROM '.$this->config->item('table_name').' WHERE COL_TIME_ON between \''.$morning.'\' AND \''.$night.'\'');
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
function totals_year() {
|
||||
$query = $this->db->query('
|
||||
SELECT DATE_FORMAT(COL_TIME_ON, \'%Y\') as \'year\',
|
||||
COUNT(COL_PRIMARY_KEY) as \'total\'
|
||||
FROM '.$this->config->item('table_name').'
|
||||
GROUP BY DATE_FORMAT(COL_TIME_ON, \'%Y\')
|
||||
');
|
||||
return $query;
|
||||
}
|
||||
|
||||
/* Return total number of qsos */
|
||||
function total_qsos() {
|
||||
$query = $this->db->query('SELECT COUNT( * ) as count FROM '.$this->config->item('table_name').'');
|
||||
|
|
|
@ -73,6 +73,27 @@
|
|||
}
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
google.setOnLoadCallback(barchart);
|
||||
function barchart() {
|
||||
var data = google.visualization.arrayToDataTable([
|
||||
['Year', 'QSO'],
|
||||
<?php foreach($totals_year->result() as $qso_numbers) { ?>
|
||||
['<?php echo $qso_numbers->year; ?>', <?php echo $qso_numbers->total; ?>],
|
||||
<?php } ?>
|
||||
]);
|
||||
|
||||
var options = {
|
||||
title: 'Total QSOs Per Year',
|
||||
vAxis: {title: 'QSOs', titleTextStyle: {color: 'black'}},
|
||||
hAxis: {title: 'Year', titleTextStyle: {color: 'black'}}
|
||||
|
||||
};
|
||||
|
||||
var chart = new google.visualization.ColumnChart(document.getElementById('totals_year'));
|
||||
chart.draw(data, options);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div id="container">
|
||||
|
||||
|
@ -85,7 +106,8 @@
|
|||
</ul>
|
||||
|
||||
<div class="pill-content">
|
||||
<div class="active" id="home"><div id="modechart_div"></div> <div id="bandchart_div"></div></div>
|
||||
<div class="active" id="home">
|
||||
<div id="totals_year" style="width: 900px; height: 500px;"></div><div id="modechart_div"></div> <div id="bandchart_div"></div></div>
|
||||
<div id="space"><div id="satchart_div"></div></div>
|
||||
</div>
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue