Set better visual style for show top-n widgets

This commit is contained in:
José González 2022-04-29 12:36:01 +02:00
parent 1bdb0af99c
commit 46e39e9f68
1 changed files with 10 additions and 2 deletions

View File

@ -454,11 +454,17 @@ class TopNWidget extends Widget
}
$data_hbar = [];
$valueMax = 0;
$valueMin = 0;
foreach ($modules as $module) {
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
$item_name = '';
$item_name = $module['aliasAgent'].' - '.$module['nameModule'];
$data_hbar[$item_name]['g'] = $module[$display];
// Calculation of max-min values for show in graph.
$calc = (ceil((5 * (float) $module[$display]) / 100) + $module[$display]);
// Set of max-min values for graph.
$valueMax = ((int) $module[$display] >= $valueMax) ? $calc : $valueMax;
$valueMin = ((int) $module[$display] <= $valueMin) ? $calc : $valueMin;
}
$height = (count($data_hbar) * 25 + 35);
@ -480,7 +486,9 @@ class TopNWidget extends Widget
1,
$config['homeurl'],
'white',
'black'
'black',
$valueMin,
$valueMax
);
$output .= '</div>';