Merge branch 'ent-1793-Etiquetas-de-las-graficas-con-decimales' into 'develop'

Fixed Y-axis label decimals

See merge request artica/pandorafms!1429
This commit is contained in:
vgilc 2018-04-17 16:23:12 +02:00
commit 981fa839b5
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>';
}

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) {
var startPercent = 0;
var endPercent = parseInt(percentile) / 100;

View File

@ -1551,4 +1551,12 @@ 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);
}