Przeglądaj źródła

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

Torkel Ödegaard 9 lat temu
rodzic
commit
88ec307f3e

+ 2 - 2
public/app/plugins/panel/graph/graph.ts

@@ -140,7 +140,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
 
         // add left axis labels
         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)
           .appendTo(elem);
 
@@ -149,7 +149,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
 
         // add right axis labels
         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)
           .appendTo(elem);
 

+ 1 - 9
public/app/plugins/panel/graph/jquery.flot.events.js

@@ -235,7 +235,7 @@ function ($, _, angular, Drop) {
       top = o.top + this._plot.height();
       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",
         "opacity": 0.8,
         "left": left + 'px',
@@ -365,20 +365,12 @@ function ($, _, angular, Drop) {
 
     plot.hooks.draw.push(function(plot) {
       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) {
         // check for first run
         if (eventMarkers.getEvents().length < 1) {
           eventMarkers.setTypes(options.events.types);
           eventMarkers.setupEvents(options.events.data);
-          containerElem.removeEventsElements = true;
         } else {
           eventMarkers.updateEvents();
         }

+ 2 - 2
public/vendor/flot/jquery.flot.js

@@ -248,7 +248,7 @@ Licensed under the MIT license.
 			// Create the text layer container, if it doesn't exist
 
 			if (this.textContainer == null) {
-				this.textContainer = $("<div class='flot-text'></div>")
+				this.textContainer = $("<div class='flot-text flot-temp-elem'></div>")
 					.css({
 						position: "absolute",
 						top: 0,
@@ -1319,7 +1319,7 @@ Licensed under the MIT license.
             // Make sure the placeholder is clear of everything except canvases
             // 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')
                 placeholder.css("position", "relative"); // for positioning labels and overlay