فهرست منبع

Added click events in graph to core eventbus (#7511)

Dennis Wiemer 8 سال پیش
والد
کامیت
8b25ba6a7c
2فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 1 0
      public/app/plugins/panel/graph/graph.ts
  2. 4 0
      public/app/plugins/panel/graph/graph_tooltip.js

+ 1 - 0
public/app/plugins/panel/graph/graph.ts

@@ -253,6 +253,7 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv) {
             backgroundColor: null,
             borderWidth: 0,
             hoverable: true,
+            clickable: true,
             color: '#c8c8c8',
             margin: { left: 0, right: 0 },
           },

+ 4 - 0
public/app/plugins/panel/graph/graph_tooltip.js

@@ -162,6 +162,10 @@ function ($, core) {
       appEvents.emit('graph-hover', {pos: pos, panel: panel});
     });
 
+    elem.bind("plotclick", function (event, pos, item) {
+      appEvents.emit('graph-click', {pos: pos, panel: panel, item: item});
+    });
+
     this.clear = function(plot) {
       $tooltip.detach();
       plot.clearCrosshair();