Fixed Y-axis label decimals

This commit is contained in:
fermin831 2018-04-17 11:54:52 +02:00
parent bc251e58df
commit 4d78256937
3 changed files with 10 additions and 8 deletions

View File

@ -1930,6 +1930,8 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
} }
} }
// Get only two decimals
formatted =round_with_decimals(formatted, 100)
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

@ -1494,14 +1494,6 @@ function print_phases_donut (recipient, phases) {
} }
} }
function round_with_decimals (value, multiplier = 1) {
if ((value * multiplier) == 0) return 0;
if ((value * multiplier) >= 1) {
return Math.round(value * multiplier) / multiplier;
}
return round_with_decimals (value, multiplier * 10);
}
function progress_bar_d3 (recipient, percentile, width, height, color, unit, label, label_color) { function progress_bar_d3 (recipient, percentile, width, height, color, unit, label, label_color) {
var startPercent = 0; var startPercent = 0;
var endPercent = parseInt(percentile) / 100; var endPercent = parseInt(percentile) / 100;

View File

@ -1552,3 +1552,11 @@ function paint_graph_status(min_w, max_w, min_c, max_c, inverse_w, inverse_c, er
} }
} }
function round_with_decimals (value, multiplier = 1) {
if ((value * multiplier) == 0) return 0;
if ((value * multiplier) >= 1) {
return Math.round(value * multiplier) / multiplier;
}
return round_with_decimals (value, multiplier * 10);
}