diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 50939b4271..259876c896 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -653,13 +653,13 @@ function hbar_graph($flash_chart, $chart_data, $width, $height, else { foreach ($chart_data as $key => $value) { - if(strlen($key) > 40){ - if(strpos($key, ' - ') != -1){ - $key_temp = explode(" - ",$key); - $key_temp[0] = $key_temp[0]." \n"; + $str_key = io_safe_output($key); + if(strlen($str_key) > 40){ + if(strpos($str_key, ' - ') != -1){ + $key_temp = explode(" - ",$str_key); + $key_temp[0] = $key_temp[0]."
"; $key_temp[1]= '...'.substr($key_temp[1],-20); $key2 = $key_temp[0].$key_temp[1]; - io_safe_output($key2); } $chart_data[$key2]['g'] = $chart_data[$key]['g']; unset($chart_data[$key]); diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 9719f77642..400125a219 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -419,28 +419,22 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, for (i = 0; i < labels_total.length; i++) { var label = labels_total[i][1]; // var shortLabel = reduceText(label, 25); - var title = ''; - // if (label !== shortLabel) { - title = label; - // label = shortLabel; - // } - - if(label.length > 30){ - if(label.indexOf(" - ")){ - var label_temp = label.split(" - "); - } - else if(label.indexOf(" ")){ - var label_temp = label.split(" "); - } - else{ - var label_temp = ''; - label_temp[0] = label.substring(0, (label.length/2)); - label_temp[1] = label.substring((label.length/2)); - } - label = reduceText(label_temp[0], 20)+"
"+reduceText(label_temp[1], 20); + var title = label; + var margin_top = 0; + if(label.length > 33){ + label = reduceText(label, 33); } - - format.push([i,'
' + var div_attributes = 'style="font-size:'+font_size+'pt !important;' + + ' margin: 0; max-width: 150px;' + + 'margin-right:5px;'; + + if (label.indexOf("
") != -1) { + div_attributes += "min-height: 2.5em;"; + } + + div_attributes += '" title="'+title+'" class="'+font+'"'; + + format.push([i,'
' + label + '
']); } @@ -2325,8 +2319,9 @@ function add_threshold (data_base, threshold_data, y_min, y_max, } function reduceText (text, maxLength) { + if(!text) return text; if (text.length <= maxLength) return text - var firstSlideEnd = parseInt((maxLength - 3) / 2); + var firstSlideEnd = parseInt((maxLength - 3)/1.6); var str_cut = text.substr(0, firstSlideEnd); - return str_cut + '...' + text.substr(-firstSlideEnd - 3); + return str_cut + '...
' + text.substr(-firstSlideEnd - 3); } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 527539bcc9..1c38ade1db 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -712,7 +712,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark, $font = $data = array(); foreach ($graph_data as $label => $values) { - $labels[] = $label; + $labels[] = io_safe_output($label); $i--; foreach ($values as $key => $value) { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 28c6e3691d..ca555e3bd5 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4619,4 +4619,10 @@ form ul.form_flex li ul li{ .events_bar { margin:0 auto; -} \ No newline at end of file +} + +.tickLabel { + white-space: nowrap; + overflow-x: hidden; + line-height: 1.05em!important; +}