From 5664c72f8b68644c8a650c26b4616a4c4d064acf Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 5 Sep 2017 16:23:21 +0200 Subject: [PATCH] Added option to short data or not --- pandora_console/include/graphs/flot/pandora.flot.js | 11 ++++++++--- pandora_console/include/graphs/functions_flot.php | 13 ++++++++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index b3b0f9f4b4..f3124a3c5b 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -835,7 +835,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, alert_ids, legend_alerts, yellow_threshold, red_threshold, force_integer, separator, separator2, yellow_up, red_up, yellow_inverse, red_inverse, - series_suffix_str, dashboard, vconsole, xaxisname,background_color,legend_color) { + series_suffix_str, dashboard, vconsole, xaxisname,background_color,legend_color, + short_data) { var threshold = true; var thresholded = false; @@ -1714,7 +1715,6 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, y = y / 1000000; } else if (y < -1000) { - console.log('entra por negativo'); how_bigger = "K"; y = y / 1000; } @@ -1880,7 +1880,12 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, function yFormatter(v, axis) { axis.datamin = 0; - var formatted = number_format(v, force_integer, ""); + if (short_data) { + var formatted = number_format(v, force_integer, ""); + } + else { + var formatted = v; + } return '
'+formatted+'
'; } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 4eebbfe3a2..319e69cab0 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -489,6 +489,16 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, // Trick to get translated string from javascript $return .= html_print_input_hidden('unknown_text', __('Unknown'), true); + + if (!isset($config["short_module_graph_data"])) + $config["short_module_graph_data"] = true; + + if ($config["short_module_graph_data"]) { + $short_data = true; + } + else { + $short_data = false; + } // Javascript code $return .= "";