From 3fcd854ae67c53fb29e32890343b7c6a30f79aa5 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Mon, 6 May 2019 16:43:59 +0200 Subject: [PATCH] fixed error labels graphs and weight in chart Former-commit-id: 52acfda4438417b711295ce8d335ea2748b1fa53 --- pandora_console/include/functions.php | 6 ++++-- pandora_console/include/functions_graph.php | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 0b9f71221b..4e3da87ebe 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3546,9 +3546,11 @@ function series_type_graph_array($data, $show_elements_graph) && (count($show_elements_graph['labels']) > 0) ) { if ($show_elements_graph['unit']) { - $name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$show_elements_graph['unit'].': '; + $name_legend = $show_elements_graph['labels'][$value['agent_module_id']].' / '.__('Unit ').' '.$show_elements_graph['unit'].': '; + $data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']].' / '.__('Unit ').' '.$show_elements_graph['unit'].': '; } else { - $name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': '; + $name_legend = $show_elements_graph['labels'][$value['agent_module_id']].': '; + $data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']].': '; } } else { if (strpos($key, 'baseline') !== false) { diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index de0a1bdd6f..1904dee80b 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1358,7 +1358,7 @@ function graphic_combined_module( $data_module_graph['c_inv'] = $module_data['critical_inverse']; $data_module_graph['module_id'] = $agent_module_id; - // stract data + // Stract data. $array_data_module = grafico_modulo_sparse_data( $agent_module_id, $date_array, @@ -1369,12 +1369,14 @@ function graphic_combined_module( $series_suffix = $i; - // convert to array graph and weight + // Convert to array graph and weight. foreach ($array_data_module as $key => $value) { $array_data[$key] = $value; - if ($params_combined['weight_list'][$i] > 1) { + if ($params_combined['weight_list'][$i] != 1) { foreach ($value['data'] as $k => $v) { - $array_data[$key]['data'][$k][1] = ($v[1] * $params_combined['weight_list'][$i]); + if ($v[1] != false) { + $array_data[$key]['data'][$k][1] = ($v[1] * $params_combined['weight_list'][$i]); + } } } }