fixed legend max 10 modules for chart

This commit is contained in:
daniel 2020-07-13 10:02:56 +02:00 committed by Daniel Rodriguez
parent 313607efdf
commit c0661fc1b7
3 changed files with 30 additions and 32 deletions

View File

@ -190,8 +190,20 @@ if ($editGraph) {
$weights = implode(',', $weight_array);
}
$count_module_array = count($module_array);
if ($count_module_array > 10) {
ui_print_warning_message(
__(
'The maximum number of items in a chart is 10. You have %s elements, only first 10 will be displayed.',
$count_module_array
)
);
}
// Modules table.
if (count($module_array) > 0) {
if ($count_module_array > 0) {
echo "<table width='100%' cellpadding=4 cellpadding=4 class='databox filters'>";
echo '<tr>
<th>'.__('P.').'</th>
@ -202,7 +214,7 @@ if (count($module_array) > 0) {
<th>'.__('Delete').'</th>
<th>'.__('Sort').'</th>';
$color = 0;
for ($a = 0; $a < count($module_array); $a++) {
for ($a = 0; $a < $count_module_array; $a++) {
// Calculate table line color.
if ($color == 1) {
$tdcolor = 'datos';

View File

@ -1483,6 +1483,11 @@ function graphic_combined_module(
continue;
}
// Only 10 item for chart.
if ($i > 9) {
break;
}
if (is_metaconsole()) {
$server = metaconsole_get_connection_by_id(
$agent_module_id['server']
@ -1839,15 +1844,12 @@ function graphic_combined_module(
}
}
if ($automatic_custom_graph_meta) {
$module = $module_item['module'];
} else {
$module = $module_item;
}
$module = $module_item['module'];
$search_in_history_db = db_search_in_history_db($datelimit);
$temp[$module] = io_safe_output(modules_get_agentmodule($module));
$temp[$module] = io_safe_output(
modules_get_agentmodule($module)
);
$query_last_value = sprintf(
'
SELECT datos
@ -1975,12 +1977,7 @@ function graphic_combined_module(
}
}
if ($automatic_custom_graph_meta) {
$module = $module_item['module'];
} else {
$module = $module_item;
}
$module = $module_item['module'];
$temp[$module] = modules_get_agentmodule($module);
$query_last_value = sprintf(
'
@ -2102,12 +2099,7 @@ function graphic_combined_module(
}
}
if ($automatic_custom_graph_meta === true) {
$module = $module_item['module'];
} else {
$module = $module_item;
}
$module = $module_item['module'];
$module_data = modules_get_agentmodule($module);
$query_last_value = sprintf(
'SELECT datos
@ -2243,16 +2235,10 @@ function graphic_combined_module(
}
}
if ($automatic_custom_graph_meta) {
$module = $module_item['module'];
} else {
$module = $module_item;
}
$module = $module_item['module'];
$data_module = modules_get_agentmodule($module);
$query_last_value = sprintf(
'
SELECT datos
'SELECT datos
FROM tagente_datos
WHERE id_agente_modulo = %d
AND utimestamp > %d

View File

@ -2432,7 +2432,7 @@ function pandoraFlotArea(
if (!value[x]) {
x = x + 1;
}
if (value[x].min) {
if (typeof value[x].min !== "undefined" && value[x].min) {
min_y_array = format_unit_yaxes(value[x].min);
min_y = min_y_array["y"];
min_bigger = min_y_array["unit"];
@ -2441,7 +2441,7 @@ function pandoraFlotArea(
min_bigger = "";
}
if (value[x].max) {
if (typeof value[x].max !== "undefined" && value[x].max) {
max_y_array = format_unit_yaxes(value[x].max);
max_y = max_y_array["y"];
max_bigger = max_y_array["unit"];
@ -2450,7 +2450,7 @@ function pandoraFlotArea(
max_bigger = "";
}
if (value[x].avg) {
if (typeof value[x].avg !== "undefined" && value[x].avg) {
avg_y_array = format_unit_yaxes(value[x].avg);
avg_y = avg_y_array["y"];
avg_bigger = avg_y_array["unit"];