Merge branch '1181-add-short-data-option-to-charts-dev' into 'develop'

Added option to short data or not

See merge request !785
This commit is contained in:
vgilc 2017-09-08 10:29:53 +02:00
commit 2689213fdf
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,
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 '<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
$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 .= "<script type='text/javascript'>";
@ -530,7 +540,8 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
" . json_encode($vconsole) . ",\n" .
"'$xaxisname', \n" .
"'$background_color', \n" .
"'$legend_color'
"'$legend_color', \n" .
"'$short_data'
);";
$return .= "});";
$return .= "</script>";