1,11 → 1,80 |
<script type="text/javascript"> |
google.charts.load('current', { packages: [ 'bar' ] }); |
google.charts.load("current", { packages: [ 'corechart' ] }); |
|
|
google.charts.setOnLoadCallback(drawFiveChart); |
google.charts.setOnLoadCallback(drawHourlyChart); |
google.charts.setOnLoadCallback(drawDailyChart); |
google.charts.setOnLoadCallback(drawMonthlyChart); |
|
function drawFiveChart() |
{ |
{if $jsonVersion gt 1} |
var data = new google.visualization.DataTable(); |
|
data.addColumn('datetime', 'Time'); |
data.addColumn('number', 'Traffic In'); |
data.addColumn('number', 'Traffic Out'); |
data.addColumn('number', 'Total Traffic'); |
|
data.addRows([ |
{foreach from=$fiveGraphData key=key item=value} |
[new {$value.label}, {$value.rx}, {$value.tx}, {$value.total}], |
{/foreach} |
]); |
|
let endD = (new {$fiveGraphData[0]['label']}).getTime(); |
|
let options = { |
title: 'Five minute Network Traffic', |
orientation: 'horizontal', |
legend: { position: 'right' }, |
explorer: { |
axis: 'horizontal', |
zoomDelta: 1.1, |
maxZoomIn: 0.1, |
maxZoomOut: 10.0 |
}, |
vAxis: { |
format: '###.### {$fiveLargestPrefix}' |
{if $graph_type == 'log'} |
,scaleType: 'log', |
baseline: {$fiveBase} |
{/if} |
}, |
hAxis: { |
direction: -1, |
format: 'd/H:mm', |
{if $jsonVersion > 1} |
title: 'Day/Hour:Minute (Scroll to zoom, Drag to pan)', |
{else} |
title: 'Day/Hour:Minute', |
{/if} |
viewWindow: { |
min: 'Date('+(endD-7050000).toString()+')', |
max: 'Date('+(endD+150000).toString()+')' |
}, |
ticks: [ |
{foreach from=$fiveGraphData key=key item=value} |
new {$value.label}, |
{/foreach} |
] |
} |
}; |
|
var formatDate = new google.visualization.DateFormat({ pattern: 'dd/MM/yyyy HH:mm' }); |
formatDate.format(data, 0); |
|
var formatNumber = new google.visualization.NumberFormat({ pattern: '##.## {$fiveLargestPrefix}' }); |
formatNumber.format(data, 1); |
formatNumber.format(data, 2); |
formatNumber.format(data, 3); |
|
let chart = new google.visualization.BarChart(document.getElementById('fiveNetworkTrafficGraph')); |
chart.draw(data, google.charts.Bar.convertOptions(options)); |
{/if} |
} |
|
function drawHourlyChart() |
{ |
var data = new google.visualization.DataTable(); |
21,6 → 90,8 |
{/foreach} |
]); |
|
let endD = (new {$hourlyGraphData[0]['label']}).getTime(); |
|
let options = { |
title: 'Hourly Network Traffic', |
orientation: 'horizontal', |
27,17 → 98,29 |
legend: { position: 'right' }, |
explorer: { |
axis: 'horizontal', |
maxZoomIn: 4.0, |
maxZoomOut: 3.0 |
zoomDelta: 1.1, |
maxZoomIn: 0.1, |
maxZoomOut: 10.0 |
}, |
vAxis: { |
title: 'Data', |
format: '##.## {$hourlyLargestPrefix}' |
format: '###.### {$hourlyLargestPrefix}' |
{if $graph_type == 'log'} |
,scaleType: 'log', |
baseline: {$hourlyBase} |
{/if} |
}, |
hAxis: { |
title: 'Hour', |
format: 'HH:mm', |
{if $jsonVersion > 1} |
title: 'Day/Hour (Scroll to zoom, Drag to pan)', |
{else} |
title: 'Day/Hour', |
{/if} |
format: 'd/H', |
direction: -1, |
viewWindow: { |
min: 'Date('+(endD-84600000).toString()+')', |
max: 'Date('+(endD+1800000).toString()+')' |
}, |
ticks: [ |
{foreach from=$hourlyGraphData key=key item=value} |
new {$value.label}, |
72,7 → 155,9 |
[new {$value.label}, {$value.rx}, {$value.tx}, {$value.total}], |
{/foreach} |
]); |
|
|
let endD = (new {$dailyGraphData[0]['label']}).getTime(); |
|
let options = { |
title: 'Daily Network Traffic', |
orientation: 'horizontal', |
79,20 → 164,37 |
legend: { position: 'right' }, |
explorer: { |
axis: 'horizontal', |
maxZoomIn: 4.0, |
maxZoomOut: 3.0 |
zoomDelta: 1.1, |
maxZoomIn: 0.1, |
maxZoomOut: 10.0 |
}, |
vAxis: { |
title: 'Data', |
format: '##.## {$dailyLargestPrefix}' |
format: '###.### {$dailyLargestPrefix}' |
{if $graph_type == 'log'} |
,scaleType: 'log', |
baseline: {$dailyBase} |
{/if} |
}, |
hAxis: { |
title: 'Day', |
{if $jsonVersion > 1} |
title: 'Day (Scroll to zoom, Drag to pan)', |
{else} |
title: 'Day', |
{/if} |
format: 'dd/MM/YYYY', |
direction: -1 |
viewWindow: { |
min: 'Date('+(endD-2548800000).toString()+')', |
max: 'Date('+(endD+43200000).toString()+')' |
}, |
direction: -1, |
ticks: [ |
{foreach from=$dailyGraphData key=key item=value} |
new {$value.label}, |
{/foreach} |
] |
} |
}; |
|
|
var formatDate = new google.visualization.DateFormat({ pattern: 'dd/MM/yyyy' }); |
formatDate.format(data, 0); |
|
126,11 → 228,11 |
legend: { position: 'right' }, |
explorer: { |
axis: 'horizontal', |
maxZoomIn: 4.0, |
maxZoomOut: 3.0 |
zoomDelta: 1.1, |
maxZoomIn: 0.1, |
maxZoomOut: 10.0 |
}, |
vAxis: { |
title: 'Data', |
format: '##.## {$monthlyLargestPrefix}' |
}, |
hAxis: { |