Merge branch 'ent-3894-Bug-Feature-labels-weigh-en-graficas' into 'develop'

fixed error labels graphs and weight in chart

See merge request artica/pandorafms!2401

Former-commit-id: f70c0c55a7159d235ca30f1a2cd42d66205eaa7a
This commit is contained in:
Alejandro Fraguas 2019-05-10 12:52:39 +02:00
commit 0f3ff09b82
2 changed files with 13 additions and 5 deletions

View File

@ -3545,7 +3545,13 @@ function series_type_graph_array($data, $show_elements_graph)
&& is_array($show_elements_graph['labels']) && is_array($show_elements_graph['labels'])
&& (count($show_elements_graph['labels']) > 0) && (count($show_elements_graph['labels']) > 0)
) { ) {
$name_legend = $data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']].' '; if ($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 = $show_elements_graph['labels'][$value['agent_module_id']].': ';
$data_return['legend'][$key] = $show_elements_graph['labels'][$value['agent_module_id']].': ';
}
} else { } else {
if (strpos($key, 'baseline') !== false) { if (strpos($key, 'baseline') !== false) {
if ($value['unit']) { if ($value['unit']) {

View File

@ -1361,7 +1361,7 @@ function graphic_combined_module(
$data_module_graph['module_id'] = $agent_module_id; $data_module_graph['module_id'] = $agent_module_id;
$data_module_graph['unit'] = $module_data['unit']; $data_module_graph['unit'] = $module_data['unit'];
// stract data // Stract data.
$array_data_module = grafico_modulo_sparse_data( $array_data_module = grafico_modulo_sparse_data(
$agent_module_id, $agent_module_id,
$date_array, $date_array,
@ -1372,12 +1372,14 @@ function graphic_combined_module(
$series_suffix = $i; $series_suffix = $i;
// convert to array graph and weight // Convert to array graph and weight.
foreach ($array_data_module as $key => $value) { foreach ($array_data_module as $key => $value) {
$array_data[$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) { 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]);
}
} }
} }
} }