From 556dc7384ab32aefc58b57996491dff9e6091ced Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Tue, 10 May 2016 10:20:54 +0200 Subject: [PATCH] (dashboard, widgets) optional number of measures in traffic_graphs.widget.php --- src/www/widgets/widgets/traffic_graphs.widget.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/www/widgets/widgets/traffic_graphs.widget.php b/src/www/widgets/widgets/traffic_graphs.widget.php index 0ad0c43e2..0691b6624 100644 --- a/src/www/widgets/widgets/traffic_graphs.widget.php +++ b/src/www/widgets/widgets/traffic_graphs.widget.php @@ -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);