Fixed values legend charts sparse

This commit is contained in:
Daniel Barbero Martin 2020-05-26 14:44:52 +02:00
parent e3803ac934
commit f2f1eaf58e
2 changed files with 15 additions and 1 deletions

View File

@ -3718,6 +3718,14 @@ function series_type_graph_array($data, $show_elements_graph)
} }
} }
if ((int) $value['min'] === PHP_INT_MAX) {
$value['min'] = 0;
}
if ((int) $value['max'] === (-PHP_INT_MAX)) {
$value['max'] = 0;
}
$data_return['legend'][$key] .= __('Min:').remove_right_zeros( $data_return['legend'][$key] .= __('Min:').remove_right_zeros(
number_format( number_format(
$value['min'], $value['min'],

View File

@ -3009,7 +3009,7 @@ function number_format(number, force_integer, unit, short_data, divisor) {
var decimals = 2; var decimals = 2;
if (unit == "KB") { if (unit == "KB") {
return number + unit; return Math.round(number * decimals) + unit;
} }
// Set maximum decimal precision to 99 in case short_data is not set. // Set maximum decimal precision to 99 in case short_data is not set.
@ -3038,6 +3038,12 @@ function number_format(number, force_integer, unit, short_data, divisor) {
if (divisor) { if (divisor) {
number = Math.round(number * decimals) / decimals; number = Math.round(number * decimals) / decimals;
} else {
number = Math.round(number * decimals);
}
if (isNaN(number)) {
number = 0;
} }
return number + " " + shorts[pos] + unit; return number + " " + shorts[pos] + unit;