fix(graph panel): fixed issue with graph axis labels

This commit is contained in:
Torkel Ödegaard 2016-09-28 21:39:35 +02:00
parent c2856926aa
commit 88ec307f3e
3 changed files with 5 additions and 13 deletions

View File

@ -140,7 +140,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
// add left axis labels // add left axis labels
if (panel.yaxes[0].label) { if (panel.yaxes[0].label) {
var yaxisLabel = $("<div class='axisLabel left-yaxis-label'></div>") var yaxisLabel = $("<div class='axisLabel left-yaxis-label flot-temp-elem'></div>")
.text(panel.yaxes[0].label) .text(panel.yaxes[0].label)
.appendTo(elem); .appendTo(elem);
@ -149,7 +149,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
// add right axis labels // add right axis labels
if (panel.yaxes[1].label) { if (panel.yaxes[1].label) {
var rightLabel = $("<div class='axisLabel right-yaxis-label'></div>") var rightLabel = $("<div class='axisLabel right-yaxis-label flot-temp-elem'></div>")
.text(panel.yaxes[1].label) .text(panel.yaxes[1].label)
.appendTo(elem); .appendTo(elem);

View File

@ -235,7 +235,7 @@ function ($, _, angular, Drop) {
top = o.top + this._plot.height(); top = o.top + this._plot.height();
left = xaxis.p2c(event.min) + o.left; left = xaxis.p2c(event.min) + o.left;
var line = $('<div class="events_line"></div>').css({ var line = $('<div class="events_line flot-temp-elem"></div>').css({
"position": "absolute", "position": "absolute",
"opacity": 0.8, "opacity": 0.8,
"left": left + 'px', "left": left + 'px',
@ -365,20 +365,12 @@ function ($, _, angular, Drop) {
plot.hooks.draw.push(function(plot) { plot.hooks.draw.push(function(plot) {
var options = plot.getOptions(); var options = plot.getOptions();
var container = plot.getPlaceholder();
var containerElem = container[0];
if (containerElem.removeEventsElements) {
container.find(".events_line").remove();
containerElem.removeEventsElements = false;
}
if (eventMarkers.eventsEnabled) { if (eventMarkers.eventsEnabled) {
// check for first run // check for first run
if (eventMarkers.getEvents().length < 1) { if (eventMarkers.getEvents().length < 1) {
eventMarkers.setTypes(options.events.types); eventMarkers.setTypes(options.events.types);
eventMarkers.setupEvents(options.events.data); eventMarkers.setupEvents(options.events.data);
containerElem.removeEventsElements = true;
} else { } else {
eventMarkers.updateEvents(); eventMarkers.updateEvents();
} }

View File

@ -248,7 +248,7 @@ Licensed under the MIT license.
// Create the text layer container, if it doesn't exist // Create the text layer container, if it doesn't exist
if (this.textContainer == null) { if (this.textContainer == null) {
this.textContainer = $("<div class='flot-text'></div>") this.textContainer = $("<div class='flot-text flot-temp-elem'></div>")
.css({ .css({
position: "absolute", position: "absolute",
top: 0, top: 0,
@ -1319,7 +1319,7 @@ Licensed under the MIT license.
// Make sure the placeholder is clear of everything except canvases // Make sure the placeholder is clear of everything except canvases
// from a previous plot in this container that we'll try to re-use. // from a previous plot in this container that we'll try to re-use.
placeholder.find(".flot-text").remove(); placeholder.find(".flot-temp-elem").remove();
if (placeholder.css("position") == 'static') if (placeholder.css("position") == 'static')
placeholder.css("position", "relative"); // for positioning labels and overlay placeholder.css("position", "relative"); // for positioning labels and overlay