diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index c4f47fc604..9e03c6e301 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -4241,8 +4241,19 @@ function generator_chart_to_pdf( ]; } + // If not install chromium avoid 500 convert tu images no data to show. + $chromium_dir = io_safe_output($config['chromium_path']); + $result_ejecution = exec($chromium_dir.' --version'); + if (empty($result_ejecution) === true) { + if ($params['return_img_base_64']) { + $params['base64'] = true; + } + + return graph_nodata_image($params); + } + try { - $browserFactory = new BrowserFactory($config['chromium_path']); + $browserFactory = new BrowserFactory($chromium_dir); // Starts headless chrome. $browser = $browserFactory->createBrowser(['noSandbox' => true]); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 3f3b1e9d84..dc9470c069 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2260,14 +2260,13 @@ function graphic_combined_module( } $options = [ - 'width' => $width, - 'height' => $height, - 'waterMark' => $water_mark, - 'ttl' => $ttl, - 'background' => $background_color, - 'pdf' => $params['pdf'], - 'legend' => ['display' => false], - 'scales' => [ + 'width' => $width, + 'height' => $height, + 'waterMark' => $water_mark, + 'ttl' => $ttl, + 'pdf' => $params['pdf'], + 'legend' => ['display' => false], + 'scales' => [ 'x' => [ 'bounds' => 'data', 'grid' => ['display' => false], @@ -2296,7 +2295,7 @@ function graphic_combined_module( } $output = '
'; - $output .= '
'; + $output .= '
'; $output .= vbar_graph($graph_values, $options); $output .= '
'; $output .= '
'; @@ -2383,13 +2382,12 @@ function graphic_combined_module( $height = null; $options = [ - 'width' => $width, - 'height' => $height, - 'waterMark' => $water_mark, - 'ttl' => $ttl, - 'background' => $background_color, - 'pdf' => $params['pdf'], - 'legend' => [ + 'width' => $width, + 'height' => $height, + 'waterMark' => $water_mark, + 'ttl' => $ttl, + 'pdf' => $params['pdf'], + 'legend' => [ 'display' => (bool) $params['show_legend'], 'position' => 'right', 'align' => 'center', @@ -2407,7 +2405,7 @@ function graphic_combined_module( } $output = '
'; - $output .= '
'; + $output .= '
'; $output .= ring_graph($graph_values, $options); $output .= '
'; $output .= '
'; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 545943880a..4c7b92d5b2 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -2228,7 +2228,6 @@ function reporting_event_report_group( $options_charts = [ 'width' => 500, 'height' => 150, - 'radius' => null, 'viewport' => [ 'width' => 500, 'height' => 0, diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 75cb14b4e0..a646b34128 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -658,34 +658,68 @@ function get_build_setup_charts($type, $options, $data) $chart->options()->setResponsive($responsive); // LEGEND. - // Set Display legends. - $legendDisplay = true; - if (isset($options['legend']['display']) === true) { - $legendDisplay = $options['legend']['display']; - } - - $chart->options()->getPlugins()->getLegend()->setDisplay($legendDisplay); - - // Set Position legends. - $legendPosition = 'top'; - if (isset($options['legend']['position']) === true - && empty($options['legend']['position']) === false + if (isset($options['legend']) === true + && empty($options['legend']) === false + && is_array($options['legend']) === true ) { - $legendPosition = $options['legend']['position']; + $legend = $chart->options()->getPlugins()->getLegend(); + + // Set Display legends. + $legendDisplay = true; + if (isset($options['legend']['display']) === true) { + $legendDisplay = $options['legend']['display']; + } + + $legend->setDisplay($legendDisplay); + + // Set Position legends. + $legendPosition = 'top'; + if (isset($options['legend']['position']) === true + && empty($options['legend']['position']) === false + ) { + $legendPosition = $options['legend']['position']; + } + + $legend->setPosition($legendPosition); + + // Set Align legends. + $legendAlign = 'center'; + if (isset($options['legend']['align']) === true + && empty($options['legend']['align']) === false + ) { + $legendAlign = $options['legend']['align']; + } + + $legend->setAlign($legendAlign); + + // Defaults fonts legends. + $legend->labels()->getFonts()->setFamily((empty($config['fontpath']) === true) ? 'Lato' : $config['fontpath']); + $legend->labels()->getFonts()->setStyle('normal'); + $legend->labels()->getFonts()->setWeight(600); + $legend->labels()->getFonts()->setSize(((int) $config['font_size'] + 2)); + + if (isset($options['legend']['fonts']) === true + && empty($options['legend']['fonts']) === false + && is_array($options['legend']['fonts']) === true + ) { + if (isset($options['legend']['fonts']['size']) === true) { + $legend->labels()->getFonts()->setSize($options['legend']['fonts']['size']); + } + + if (isset($options['legend']['fonts']['style']) === true) { + $legend->labels()->getFonts()->setStyle($options['legend']['fonts']['style']); + } + + if (isset($options['legend']['fonts']['weight']) === true) { + $legend->labels()->getFonts()->setWeight($options['legend']['fonts']['weight']); + } + + if (isset($options['legend']['fonts']['family']) === true) { + $legend->labels()->getFonts()->setFamily($options['legend']['fonts']['family']); + } + } } - $chart->options()->getPlugins()->getLegend()->setPosition($legendPosition); - - // Set Align legends. - $legendAlign = 'center'; - if (isset($options['legend']['align']) === true - && empty($options['legend']['align']) === false - ) { - $legendAlign = $options['legend']['align']; - } - - $chart->options()->getPlugins()->getLegend()->setAlign($legendAlign); - if (isset($options['layout']) === true && empty($options['layout']) === false && is_array($options['layout']) === true