Merge branch 'ent-13402-widget-basic-chart-esta-roto' into 'develop'

Ent 13402 widget basic chart esta roto

See merge request artica/pandorafms!7194
This commit is contained in:
Jose Martin 2024-04-15 09:57:53 +00:00
commit 354fa324d8
3 changed files with 30 additions and 3 deletions

View File

@ -303,9 +303,15 @@ function flot_area_graph(
} }
} }
$extra_styles = '';
if (isset($params['extra_styles']) === true && empty($params['extra_styles']) === false) {
$extra_styles = $params['extra_styles'];
}
$return .= 'graph'.$params['adapt_key']."' $return .= 'graph'.$params['adapt_key']."'
style='".$width.'; style='".$width.';
height: '.$params['height']."px;'></div>"; height: '.$params['height'].'px;
'.$extra_styles."'></div>";
$legend_top = 10; $legend_top = 10;
if (empty($params['show_legend']) === false) { if (empty($params['show_legend']) === false) {

View File

@ -641,12 +641,28 @@ class BasicChart extends Widget
$this->values['period'] = parent::getPeriod(); $this->values['period'] = parent::getPeriod();
} }
$margin = 15;
$size['height'] -= $margin;
$graph_height = $size['height'];
$margin_top = 0;
if ((bool) $this->values['showLabel'] === true) {
$margin_top = $this->values['sizeLabel'];
}
if ((bool) $this->values['showValue'] === true) {
if ($this->values['sizeValue'] > $this->values['sizeLabel']) {
$margin_top = $this->values['sizeValue'];
}
}
$graph_height -= $margin_top;
$params = [ $params = [
'agent_module_id' => $this->values['moduleId'], 'agent_module_id' => $this->values['moduleId'],
'period' => $this->values['period'], 'period' => $this->values['period'],
'show_events' => false, 'show_events' => false,
'width' => '100%', 'width' => '100%',
'height' => $size['height'], 'height' => $graph_height,
'title' => $module_name, 'title' => $module_name,
'unit' => $units_name, 'unit' => $units_name,
'only_image' => false, 'only_image' => false,
@ -661,6 +677,7 @@ class BasicChart extends Widget
'backgroundColor' => 'transparent', 'backgroundColor' => 'transparent',
// 'server_id' => $metaconsoleId, // 'server_id' => $metaconsoleId,
'basic_chart' => true, 'basic_chart' => true,
'extra_styles' => 'bottom: -'.($margin_top + $margin - 1).'px; margin-left: 0px;',
'array_colors' => [ 'array_colors' => [
[ [
'border' => '#000000', 'border' => '#000000',
@ -671,7 +688,7 @@ class BasicChart extends Widget
]; ];
$graph = \grafico_modulo_sparse($params); $graph = \grafico_modulo_sparse($params);
$output = '<div class="container-center widget-mrgn-0px">'; $output = '<div class="container-center widget-mrgn-0px w100pi basic-chart-widget">';
if (str_contains($graph, '<img') === false) { if (str_contains($graph, '<img') === false) {
$output .= '<div class="basic-chart-title">'; $output .= '<div class="basic-chart-title">';
$output .= '<span style="color:'.$this->values['colorLabel'].'; font-size:'.$this->values['sizeLabel'].'px;">'; $output .= '<span style="color:'.$this->values['colorLabel'].'; font-size:'.$this->values['sizeLabel'].'px;">';

View File

@ -2086,3 +2086,7 @@ li.agent-autocomplete-li-text-color a {
select option:checked { select option:checked {
background-color: var(--tertiary-color); background-color: var(--tertiary-color);
} }
.basic-chart-widget .flot-base {
background-color: unset;
}