added graph_precision for the float in static_graph and percentile item

Former-commit-id: 7fda14add9bcb0d9c0a425caad752364e29b309c
This commit is contained in:
Daniel Maya 2019-05-06 17:12:00 +02:00
parent 759c175d4f
commit b57adb38a5
2 changed files with 2 additions and 6 deletions

View File

@ -222,12 +222,8 @@ final class Percentile extends Item
); );
} }
// Cast to float.
$moduleValue = (float) $moduleValue;
// Store the module value. // Store the module value.
$data['value'] = $moduleValue; $data['value'] = (float) \number_format((float) $moduleValue, (int) $config['graph_precision'], '.', '');
$unit = \modules_get_unit($moduleId); $unit = \modules_get_unit($moduleId);
if (empty($unit) === false) { if (empty($unit) === false) {
$data['unit'] = \io_safe_output($unit); $data['unit'] = \io_safe_output($unit);

View File

@ -226,7 +226,7 @@ final class StaticGraph extends Item
|| ($isBooleanModule && $showLastValueTooltip !== 'default') || ($isBooleanModule && $showLastValueTooltip !== 'default')
) { ) {
if (\is_numeric($value)) { if (\is_numeric($value)) {
$imgTitle .= __('Last value: ').remove_right_zeros($value); $imgTitle .= __('Last value: ').remove_right_zeros(number_format((float) $value, (int) $config['graph_precision']));
} else { } else {
$imgTitle .= __('Last value: ').$value; $imgTitle .= __('Last value: ').$value;
} }