Improved the legends of the vertical bar graphs
This commit is contained in:
parent
12d7087014
commit
922566dbf7
|
@ -500,7 +500,6 @@ $.fn.VUseTooltip = function () {
|
||||||
$(this).bind("plothover", function (event, pos, item) {
|
$(this).bind("plothover", function (event, pos, item) {
|
||||||
if (item) {
|
if (item) {
|
||||||
if ((previousLabel != item.series.label) || (previousPoint != item.seriesIndex)) {
|
if ((previousLabel != item.series.label) || (previousPoint != item.seriesIndex)) {
|
||||||
$('.legend_'+previousPoint).css("visibility","hidden");
|
|
||||||
previousPoint = item.seriesIndex;
|
previousPoint = item.seriesIndex;
|
||||||
previousLabel = item.series.label;
|
previousLabel = item.series.label;
|
||||||
|
|
||||||
|
@ -510,15 +509,13 @@ $.fn.VUseTooltip = function () {
|
||||||
var y = item.datapoint[1];
|
var y = item.datapoint[1];
|
||||||
|
|
||||||
var color = item.series.color;
|
var color = item.series.color;
|
||||||
$('.legend_'+x).css("visibility","");
|
|
||||||
showTooltip(pos.pageX,
|
showTooltip(pos.pageX,
|
||||||
pos.pageY,
|
pos.pageY,
|
||||||
color,
|
color,
|
||||||
"<strong>" + $('.legend_'+x).text() + "</strong>" + " : <strong>" + y + "</strong>");
|
"<strong>" + y + "</strong>");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$("#tooltip").remove();
|
$("#tooltip").remove();
|
||||||
$('.legend_'+previousPoint).css("visibility","hidden");
|
|
||||||
previousPoint = null;
|
previousPoint = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -669,11 +666,19 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
||||||
|
|
||||||
$(this).text(text);
|
$(this).text(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#'+graph_id+' .xAxis .tickLabel')
|
||||||
|
.css('transform', 'rotate(-35deg)')
|
||||||
|
.find('div')
|
||||||
|
.css('position', 'relative')
|
||||||
|
.css('top', '+10px')
|
||||||
|
.css('left', '-20px');
|
||||||
|
|
||||||
// Format functions
|
// Format functions
|
||||||
function xFormatter(v, axis) {
|
function xFormatter(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 style="visibility: hidden;" class="legend_'+i+'">'+labels_total[i][1]+'</div>']);
|
format.push([i,'<div class="legend_'+i+'">'+labels_total[i][1]+'</div>']);
|
||||||
}
|
}
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue