Fixed labels in automatic combined graphs

Former-commit-id: f91777c30da55edc43d021b87cda2c0105626f64
This commit is contained in:
samucarc 2019-03-05 18:06:50 +01:00
parent 7d88af625e
commit 00eb2766a9
3 changed files with 8 additions and 8 deletions

View File

@ -3529,15 +3529,11 @@ function series_type_graph_array($data, $show_elements_graph)
break;
}
if (isset($show_elements_graph['labels'])
if (isset($show_elements_graph['labels'][$value['agent_module_id']])
&& is_array($show_elements_graph['labels'])
&& (count($show_elements_graph['labels']) > 0)
) {
if ($value['unit']) {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].' / '.__('Unit ').' '.$value['unit'].': ';
} else {
$name_legend = $data_return['legend'][$key] = $value['agent_alias'].' / '.$value['module_name'].': ';
}
$name_legend = $data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']].' ';
} else {
if (strpos($key, 'baseline') !== false) {
if ($value['unit']) {

View File

@ -1222,11 +1222,11 @@ function graphic_combined_module(
foreach ($sources as $source) {
array_push($modules, $source['id_agent_module']);
array_push($weights, $source['weight']);
if ($source['label'] != '') {
if ($source['label'] != '' || $params_combined['labels']) {
$item['type'] = 'custom_graph';
$item['id_agent'] = agents_get_module_id($source['id_agent_module']);
$item['id_agent_module'] = $source['id_agent_module'];
$labels[$source['id_agent_module']] = reporting_label_macro($item, $source['label']);
$labels[$source['id_agent_module']] = ($source['label'] != '') ? reporting_label_macro($item, $source['label']) : reporting_label_macro($item, $params_combined['labels']);
}
}
}

View File

@ -4384,6 +4384,9 @@ function reporting_value($report, $content, $type, $pdf=false)
$return['description'] = $content['description'];
$return['date'] = reporting_get_date_text($report, $content);
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
$return['agents'] = [$content['id_agent']];
$return['id_agent'] = $content['id_agent'];
$return['id_agent_module'] = $content['id_agent_module'];
$return['agent_name'] = $agent_name;
$return['module_name'] = $module_name;
@ -7072,6 +7075,7 @@ function reporting_custom_graph(
'modules_series' => $graphs[0]['modules_series'],
'id_graph' => $id_graph,
'type_report' => $type_report,
'labels' => $content['style']['label'],
];
$return['chart'] = graphic_combined_module(