2809 |
rexy |
1 |
<?php
|
|
|
2 |
/* Smarty version 3.1.34-dev-7, created on 2020-04-11 17:23:34
|
|
|
3 |
from '/var/www/html/acc/manager/vnstat/templates/module_graph_js.tpl' */
|
|
|
4 |
|
|
|
5 |
/* @var Smarty_Internal_Template $_smarty_tpl */
|
|
|
6 |
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
|
|
|
7 |
'version' => '3.1.34-dev-7',
|
|
|
8 |
'unifunc' => 'content_5e91ef06853392_40488972',
|
|
|
9 |
'has_nocache_code' => false,
|
|
|
10 |
'file_dependency' =>
|
|
|
11 |
array (
|
|
|
12 |
'0d0c6b8d28b17c4ffaf65435e1e6cc17f87d6e6d' =>
|
|
|
13 |
array (
|
|
|
14 |
|
|
|
15 |
1 => 1586598464,
|
|
|
16 |
2 => 'file',
|
|
|
17 |
),
|
|
|
18 |
),
|
|
|
19 |
'includes' =>
|
|
|
20 |
array (
|
|
|
21 |
),
|
|
|
22 |
),false)) {
|
|
|
23 |
function content_5e91ef06853392_40488972 (Smarty_Internal_Template $_smarty_tpl) {
|
|
|
24 |
?> <?php echo '<script'; ?>
|
|
|
25 |
type="text/javascript">
|
|
|
26 |
google.charts.load('current', { packages: [ 'bar' ] });
|
|
|
27 |
google.charts.load("current", { packages: [ 'corechart' ] });
|
|
|
28 |
|
|
|
29 |
google.charts.setOnLoadCallback(drawHourlyChart);
|
|
|
30 |
google.charts.setOnLoadCallback(drawDailyChart);
|
|
|
31 |
google.charts.setOnLoadCallback(drawMonthlyChart);
|
|
|
32 |
|
|
|
33 |
function drawHourlyChart()
|
|
|
34 |
{
|
|
|
35 |
var data = new google.visualization.DataTable();
|
|
|
36 |
|
|
|
37 |
data.addColumn('date', 'Hour');
|
|
|
38 |
data.addColumn('number', 'Traffic In');
|
|
|
39 |
data.addColumn('number', 'Traffic Out');
|
|
|
40 |
data.addColumn('number', 'Total Traffic');
|
|
|
41 |
|
|
|
42 |
data.addRows([
|
|
|
43 |
<?php
|
|
|
44 |
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['hourlyGraphData']->value, 'value', false, 'key');
|
|
|
45 |
$_smarty_tpl->tpl_vars['value']->do_else = true;
|
|
|
46 |
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['key']->value => $_smarty_tpl->tpl_vars['value']->value) {
|
|
|
47 |
$_smarty_tpl->tpl_vars['value']->do_else = false;
|
|
|
48 |
?>
|
|
|
49 |
[new <?php echo $_smarty_tpl->tpl_vars['value']->value['label'];?>
|
|
|
50 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['rx'];?>
|
|
|
51 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['tx'];?>
|
|
|
52 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['total'];?>
|
|
|
53 |
],
|
|
|
54 |
<?php
|
|
|
55 |
}
|
|
|
56 |
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|
|
57 |
]);
|
|
|
58 |
|
|
|
59 |
let options = {
|
|
|
60 |
title: 'Hourly Network Traffic',
|
|
|
61 |
orientation: 'horizontal',
|
|
|
62 |
legend: { position: 'right' },
|
|
|
63 |
explorer: {
|
|
|
64 |
axis: 'horizontal',
|
|
|
65 |
maxZoomIn: 4.0,
|
|
|
66 |
maxZoomOut: 3.0
|
|
|
67 |
},
|
|
|
68 |
vAxis: {
|
|
|
69 |
title: 'Data',
|
|
|
70 |
format: '##.## <?php echo $_smarty_tpl->tpl_vars['hourlyLargestPrefix']->value;?>
|
|
|
71 |
'
|
|
|
72 |
},
|
|
|
73 |
hAxis: {
|
|
|
74 |
title: 'Hour',
|
|
|
75 |
format: 'HH:mm',
|
|
|
76 |
direction: -1,
|
|
|
77 |
ticks: [
|
|
|
78 |
<?php
|
|
|
79 |
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['hourlyGraphData']->value, 'value', false, 'key');
|
|
|
80 |
$_smarty_tpl->tpl_vars['value']->do_else = true;
|
|
|
81 |
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['key']->value => $_smarty_tpl->tpl_vars['value']->value) {
|
|
|
82 |
$_smarty_tpl->tpl_vars['value']->do_else = false;
|
|
|
83 |
?>
|
|
|
84 |
new <?php echo $_smarty_tpl->tpl_vars['value']->value['label'];?>
|
|
|
85 |
,
|
|
|
86 |
<?php
|
|
|
87 |
}
|
|
|
88 |
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|
|
89 |
]
|
|
|
90 |
}
|
|
|
91 |
};
|
|
|
92 |
|
|
|
93 |
var formatDate = new google.visualization.DateFormat({ pattern: 'dd/MM/yyyy HH:mm' });
|
|
|
94 |
formatDate.format(data, 0);
|
|
|
95 |
|
|
|
96 |
var formatNumber = new google.visualization.NumberFormat({ pattern: '##.## <?php echo $_smarty_tpl->tpl_vars['hourlyLargestPrefix']->value;?>
|
|
|
97 |
' });
|
|
|
98 |
formatNumber.format(data, 1);
|
|
|
99 |
formatNumber.format(data, 2);
|
|
|
100 |
formatNumber.format(data, 3);
|
|
|
101 |
|
|
|
102 |
let chart = new google.visualization.BarChart(document.getElementById('hourlyNetworkTrafficGraph'));
|
|
|
103 |
chart.draw(data, google.charts.Bar.convertOptions(options));
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
function drawDailyChart()
|
|
|
107 |
{
|
|
|
108 |
var data = new google.visualization.DataTable();
|
|
|
109 |
|
|
|
110 |
data.addColumn('date', 'Day');
|
|
|
111 |
data.addColumn('number', 'Traffic In');
|
|
|
112 |
data.addColumn('number', 'Traffic Out');
|
|
|
113 |
data.addColumn('number', 'Total Traffic');
|
|
|
114 |
|
|
|
115 |
data.addRows([
|
|
|
116 |
<?php
|
|
|
117 |
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['dailyGraphData']->value, 'value', false, 'key');
|
|
|
118 |
$_smarty_tpl->tpl_vars['value']->do_else = true;
|
|
|
119 |
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['key']->value => $_smarty_tpl->tpl_vars['value']->value) {
|
|
|
120 |
$_smarty_tpl->tpl_vars['value']->do_else = false;
|
|
|
121 |
?>
|
|
|
122 |
[new <?php echo $_smarty_tpl->tpl_vars['value']->value['label'];?>
|
|
|
123 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['rx'];?>
|
|
|
124 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['tx'];?>
|
|
|
125 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['total'];?>
|
|
|
126 |
],
|
|
|
127 |
<?php
|
|
|
128 |
}
|
|
|
129 |
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|
|
130 |
]);
|
|
|
131 |
|
|
|
132 |
let options = {
|
|
|
133 |
title: 'Daily Network Traffic',
|
|
|
134 |
orientation: 'horizontal',
|
|
|
135 |
legend: { position: 'right' },
|
|
|
136 |
explorer: {
|
|
|
137 |
axis: 'horizontal',
|
|
|
138 |
maxZoomIn: 4.0,
|
|
|
139 |
maxZoomOut: 3.0
|
|
|
140 |
},
|
|
|
141 |
vAxis: {
|
|
|
142 |
title: 'Data',
|
|
|
143 |
format: '##.## <?php echo $_smarty_tpl->tpl_vars['dailyLargestPrefix']->value;?>
|
|
|
144 |
'
|
|
|
145 |
},
|
|
|
146 |
hAxis: {
|
|
|
147 |
title: 'Day',
|
|
|
148 |
format: 'dd/MM/YYYY',
|
|
|
149 |
direction: -1
|
|
|
150 |
}
|
|
|
151 |
};
|
|
|
152 |
|
|
|
153 |
var formatDate = new google.visualization.DateFormat({ pattern: 'dd/MM/yyyy' });
|
|
|
154 |
formatDate.format(data, 0);
|
|
|
155 |
|
|
|
156 |
var formatNumber = new google.visualization.NumberFormat({ pattern: '##.## <?php echo $_smarty_tpl->tpl_vars['dailyLargestPrefix']->value;?>
|
|
|
157 |
' });
|
|
|
158 |
formatNumber.format(data, 1);
|
|
|
159 |
formatNumber.format(data, 2);
|
|
|
160 |
formatNumber.format(data, 3);
|
|
|
161 |
|
|
|
162 |
let chart = new google.visualization.BarChart(document.getElementById('dailyNetworkTrafficGraph'));
|
|
|
163 |
chart.draw(data, google.charts.Bar.convertOptions(options));
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
function drawMonthlyChart()
|
|
|
167 |
{
|
|
|
168 |
var data = new google.visualization.DataTable();
|
|
|
169 |
|
|
|
170 |
data.addColumn('date', 'Month');
|
|
|
171 |
data.addColumn('number', 'Traffic In');
|
|
|
172 |
data.addColumn('number', 'Traffic Out');
|
|
|
173 |
data.addColumn('number', 'Total Traffic');
|
|
|
174 |
|
|
|
175 |
data.addRows([
|
|
|
176 |
<?php
|
|
|
177 |
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['monthlyGraphData']->value, 'value', false, 'key');
|
|
|
178 |
$_smarty_tpl->tpl_vars['value']->do_else = true;
|
|
|
179 |
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['key']->value => $_smarty_tpl->tpl_vars['value']->value) {
|
|
|
180 |
$_smarty_tpl->tpl_vars['value']->do_else = false;
|
|
|
181 |
?>
|
|
|
182 |
[new <?php echo $_smarty_tpl->tpl_vars['value']->value['label'];?>
|
|
|
183 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['rx'];?>
|
|
|
184 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['tx'];?>
|
|
|
185 |
, <?php echo $_smarty_tpl->tpl_vars['value']->value['total'];?>
|
|
|
186 |
],
|
|
|
187 |
<?php
|
|
|
188 |
}
|
|
|
189 |
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|
|
190 |
]);
|
|
|
191 |
|
|
|
192 |
let options = {
|
|
|
193 |
title: 'Monthly Network Traffic',
|
|
|
194 |
orientation: 'horizontal',
|
|
|
195 |
legend: { position: 'right' },
|
|
|
196 |
explorer: {
|
|
|
197 |
axis: 'horizontal',
|
|
|
198 |
maxZoomIn: 4.0,
|
|
|
199 |
maxZoomOut: 3.0
|
|
|
200 |
},
|
|
|
201 |
vAxis: {
|
|
|
202 |
title: 'Data',
|
|
|
203 |
format: '##.## <?php echo $_smarty_tpl->tpl_vars['monthlyLargestPrefix']->value;?>
|
|
|
204 |
'
|
|
|
205 |
},
|
|
|
206 |
hAxis: {
|
|
|
207 |
title: 'Month',
|
|
|
208 |
format: 'MMMM YYYY',
|
|
|
209 |
direction: -1
|
|
|
210 |
}
|
|
|
211 |
};
|
|
|
212 |
|
|
|
213 |
var formatDate = new google.visualization.DateFormat({ pattern: 'MMMM YYYY' });
|
|
|
214 |
formatDate.format(data, 0);
|
|
|
215 |
|
|
|
216 |
var formatNumber = new google.visualization.NumberFormat({ pattern: '##.## <?php echo $_smarty_tpl->tpl_vars['monthlyLargestPrefix']->value;?>
|
|
|
217 |
' });
|
|
|
218 |
formatNumber.format(data, 1);
|
|
|
219 |
formatNumber.format(data, 2);
|
|
|
220 |
formatNumber.format(data, 3);
|
|
|
221 |
|
|
|
222 |
let chart = new google.visualization.BarChart(document.getElementById('monthlyNetworkTrafficGraph'));
|
|
|
223 |
chart.draw(data, google.charts.Bar.convertOptions(options));
|
|
|
224 |
}
|
|
|
225 |
<?php echo '</script'; ?>
|
|
|
226 |
>
|
|
|
227 |
<?php }
|
|
|
228 |
}
|