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'])
&& (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 {
if (strpos($key, 'baseline') !== false) {
if ($value['unit']) {

View File

@ -1361,7 +1361,7 @@ function graphic_combined_module(
$data_module_graph['module_id'] = $agent_module_id;
$data_module_graph['unit'] = $module_data['unit'];
// stract data
// Stract data.
$array_data_module = grafico_modulo_sparse_data(
$agent_module_id,
$date_array,
@ -1372,15 +1372,17 @@ 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) {
if ($v[1] != false) {
$array_data[$key]['data'][$k][1] = ($v[1] * $params_combined['weight_list'][$i]);
}
}
}
}
$max = $array_data['sum'.$i]['max'];
$min = $array_data['sum'.$i]['min'];