diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 4c0f3c3817..7db304b24f 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -457,7 +457,16 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark, function yFormatter(v, axis) { format = new Array(); for (i = 0; i < labels_total.length; i++) { - format.push([i,'
'+labels_total[i][1]+'
']); + var label = labels_total[i][1]; + var shortLabel = reduceText(label, 30); + var title = ''; + if (label !== shortLabel) { + title = label; + label = shortLabel; + } + format.push([i,'
' + + label + + '
']); } return format; } @@ -666,7 +675,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, }); $('#'+graph_id+' .xAxis .tickLabel') - .css('transform', 'rotate(-35deg)') + .css('transform', 'rotate(-45deg)') .find('div') .css('position', 'relative') .css('top', '+10px') @@ -674,9 +683,19 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors, // Format functions function xFormatter(v, axis) { - format = new Array(); + var format = new Array(); for (i = 0; i < labels_total.length; i++) { - format.push([i,'
'+labels_total[i][1]+'
']); + var label = labels_total[i][1]; + var shortLabel = reduceText(label, 35); + var title = ''; + if (label !== shortLabel) { + title = label; + label = shortLabel; + } + format.push([i, + '
' + + label + + '
']); } return format; } @@ -2274,3 +2293,9 @@ function add_threshold (data_base, threshold_data, y_min, y_max, yellow_threshol return datas; } + +function reduceText (text, maxLength) { + if (text.length <= maxLength) return text + var firstSlideEnd = parseInt((maxLength - 3) / 2); + return text.substr(0, firstSlideEnd) + '...' + text.substr(-firstSlideEnd - 3); +}