(dashboard, widgets) optional number of measures in traffic_graphs.widget.php

This commit is contained in:
Ad Schellevis 2016-05-10 10:20:54 +02:00
parent 8decc7a38f
commit 556dc7384a

View File

@ -38,11 +38,14 @@
var traffic_graph_widget_chart_out = null;
var traffic_graph_widget_chart_data_out = null;
function traffic_widget_update(sender, data)
function traffic_widget_update(sender, data, max_measures)
{
// push new measurement, keep a maximum of 100 measures in
if (max_measures == undefined) {
max_measures = 100;
}
// push new measurement, keep a maximum of max_measures measures in
traffic_graph_widget_data.push(data);
if (traffic_graph_widget_data.length > 100) {
if (traffic_graph_widget_data.length > max_measures) {
traffic_graph_widget_data.shift();
} else if (traffic_graph_widget_data.length == 1) {
traffic_graph_widget_data.push(data);