From b6688dda1c8d27705b85d0bd647ed389cfb8852c Mon Sep 17 00:00:00 2001 From: fermin831 Date: Thu, 1 Mar 2018 16:49:50 +0100 Subject: [PATCH] [SQL charts reports] Added top n report to set the maximum number of elements --- pandora_console/include/functions_graph.php | 2 +- pandora_console/include/functions_reporting.php | 3 ++- pandora_console/include/graphs/fgraph.php | 14 ++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 8d4bdd68ce..3462366c0d 100644 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -3925,7 +3925,7 @@ function graph_custom_sql_graph ($id, $width, $height, $label = __('Data'); if (!empty($data_item["label"])) { $label = io_safe_output($data_item["label"]); - if ((strlen($label) > $SQL_GRAPH_MAX_LABEL_SIZE) && ($type !== 'sql_graph_vbar')) { + if (strlen($label) > $SQL_GRAPH_MAX_LABEL_SIZE) { $first_label = $label; $label = substr($first_label, 0, floor($SQL_GRAPH_MAX_LABEL_SIZE/2)); $label .= '...'; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 7737e32f69..1aa1b85dd9 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -3294,7 +3294,8 @@ function reporting_sql_graph($report, $content, $type, $content["type"], true, ui_get_full_url(false, false, false, false), - $ttl); + $ttl, + $content['top_n_value']); break; case 'data': break; diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 16fc4a0f0a..d1df2f6397 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -190,14 +190,12 @@ function vbar_graph( else { $new_chart_data = array(); foreach ($chart_data as $key => $value) { - if(strlen($key) > 20){ - if(strpos($key, ' - ') != -1){ - $key_temp = explode(" - ",$key); - $key_temp[0] = $key_temp[0]." \n"; - $key_temp[1]= '...'.substr($key_temp[1],-15); - $key2 = $key_temp[0].$key_temp[1]; - io_safe_output($key2); - } + if(strlen($key) > 20 && strpos($key, ' - ') != -1){ + $key_temp = explode(" - ",$key); + $key_temp[0] = $key_temp[0]." \n"; + $key_temp[1]= '...'.substr($key_temp[1],-15); + $key2 = $key_temp[0].$key_temp[1]; + io_safe_output($key2); $new_chart_data[$key2]['g'] = $chart_data[$key]['g']; } else { $new_chart_data[$key] = $value;