Reduced the max length of the x and y labels of the vertical and horizontal graphs. Ticket #3634
This commit is contained in:
parent
fb17378abc
commit
86ceea13de
|
@ -457,7 +457,16 @@ function pandoraFlotHBars(graph_id, values, labels, water_mark,
|
||||||
function yFormatter(v, axis) {
|
function yFormatter(v, axis) {
|
||||||
format = new Array();
|
format = new Array();
|
||||||
for (i = 0; i < labels_total.length; i++) {
|
for (i = 0; i < labels_total.length; i++) {
|
||||||
format.push([i,'<div class="legend_'+i+'">'+labels_total[i][1]+'</div>']);
|
var label = labels_total[i][1];
|
||||||
|
var shortLabel = reduceText(label, 30);
|
||||||
|
var title = '';
|
||||||
|
if (label !== shortLabel) {
|
||||||
|
title = label;
|
||||||
|
label = shortLabel;
|
||||||
|
}
|
||||||
|
format.push([i,'<div title="'+title+'" class="legend_'+i+'">'
|
||||||
|
+ label
|
||||||
|
+ '</div>']);
|
||||||
}
|
}
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
@ -666,7 +675,7 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#'+graph_id+' .xAxis .tickLabel')
|
$('#'+graph_id+' .xAxis .tickLabel')
|
||||||
.css('transform', 'rotate(-35deg)')
|
.css('transform', 'rotate(-45deg)')
|
||||||
.find('div')
|
.find('div')
|
||||||
.css('position', 'relative')
|
.css('position', 'relative')
|
||||||
.css('top', '+10px')
|
.css('top', '+10px')
|
||||||
|
@ -674,9 +683,19 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
||||||
|
|
||||||
// Format functions
|
// Format functions
|
||||||
function xFormatter(v, axis) {
|
function xFormatter(v, axis) {
|
||||||
format = new Array();
|
var format = new Array();
|
||||||
for (i = 0; i < labels_total.length; i++) {
|
for (i = 0; i < labels_total.length; i++) {
|
||||||
format.push([i,'<div class="legend_'+i+'">'+labels_total[i][1]+'</div>']);
|
var label = labels_total[i][1];
|
||||||
|
var shortLabel = reduceText(label, 35);
|
||||||
|
var title = '';
|
||||||
|
if (label !== shortLabel) {
|
||||||
|
title = label;
|
||||||
|
label = shortLabel;
|
||||||
|
}
|
||||||
|
format.push([i,
|
||||||
|
'<div class="legend_'+i+'" title="'+title+'" style="word-break: break-word; max-width: 110px;">'
|
||||||
|
+ label
|
||||||
|
+ '</div>']);
|
||||||
}
|
}
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
@ -2274,3 +2293,9 @@ function add_threshold (data_base, threshold_data, y_min, y_max, yellow_threshol
|
||||||
|
|
||||||
return datas;
|
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);
|
||||||
|
}
|
Loading…
Reference in New Issue