Added option to short data or not

This commit is contained in:
Arturo Gonzalez 2017-09-05 16:23:21 +02:00
parent daca367320
commit 5664c72f8b
2 changed files with 20 additions and 4 deletions

View File

@ -835,7 +835,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
alert_ids, legend_alerts, yellow_threshold, red_threshold, alert_ids, legend_alerts, yellow_threshold, red_threshold,
force_integer, separator, separator2, force_integer, separator, separator2,
yellow_up, red_up, yellow_inverse, red_inverse, 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 threshold = true;
var thresholded = false; var thresholded = false;
@ -1714,7 +1715,6 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
y = y / 1000000; y = y / 1000000;
} }
else if (y < -1000) { else if (y < -1000) {
console.log('entra por negativo');
how_bigger = "K"; how_bigger = "K";
y = y / 1000; y = y / 1000;
} }
@ -1880,7 +1880,12 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
function yFormatter(v, axis) { function yFormatter(v, axis) {
axis.datamin = 0; 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 '<div class='+font+' style="font-size:'+font_size+'pt;">'+formatted+'</div>'; return '<div class='+font+' style="font-size:'+font_size+'pt;">'+formatted+'</div>';
} }

View File

@ -489,6 +489,16 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
// Trick to get translated string from javascript // Trick to get translated string from javascript
$return .= html_print_input_hidden('unknown_text', __('Unknown'), $return .= html_print_input_hidden('unknown_text', __('Unknown'),
true); 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 // Javascript code
$return .= "<script type='text/javascript'>"; $return .= "<script type='text/javascript'>";
@ -530,7 +540,8 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
" . json_encode($vconsole) . ",\n" . " . json_encode($vconsole) . ",\n" .
"'$xaxisname', \n" . "'$xaxisname', \n" .
"'$background_color', \n" . "'$background_color', \n" .
"'$legend_color' "'$legend_color', \n" .
"'$short_data'
);"; );";
$return .= "});"; $return .= "});";
$return .= "</script>"; $return .= "</script>";