Flip x_label when it would render off-page

This commit is contained in:
Bernerd Schaefer 2013-04-12 11:59:49 +02:00
parent 461e02d2b8
commit 43dc377bee
2 changed files with 12 additions and 0 deletions

View file

@ -22,6 +22,10 @@ svg {
margin: 0 0 0 0px;
}
.graph .detail .x_label.flipped {
right: 0;
}
.graph .detail .item.flipped {
right: 10px;
}

View file

@ -382,6 +382,14 @@ Prometheus.Graph.prototype.updateGraph = function(reloadGraph) {
var width = this.graph.width;
var element = jQuery(this.element);
jQuery(".x_label", element).each(function() {
if ($(this).outerWidth() + element.offset().left > width) {
$(this).addClass("flipped")
} else {
$(this).removeClass("flipped")
}
})
jQuery(".item", element).each(function() {
if ($(this).outerWidth() + element.offset().left > width) {
$(this).addClass("flipped")