From 7c99e788c7686d7aed544b83ead14ba262a9a8d3 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 27 Jun 2023 15:53:42 +0200 Subject: [PATCH] #10691 added image no data in pue graph --- .../include/lib/Dashboard/Widgets/top_n.php | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n.php b/pandora_console/include/lib/Dashboard/Widgets/top_n.php index d11718ee43..13d6d919dc 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n.php @@ -586,10 +586,26 @@ class TopNWidget extends Widget break; case 'pie': - $output .= pie_graph( - $data, - $options - ); + $empty = true; + foreach ($data as $key => $value) { + if ($value > 0) { + $empty = false; + break; + } + } + + if ($empty === true) { + $output .= html_print_image( + 'images/no_data_toshow.png', + true, + [ 'style' => 'width: 60%;' ] + ); + } else { + $output .= pie_graph( + $data, + $options + ); + } break; default: