Selaa lähdekoodia

fix(graph tooltip): multi series tooltip did no highlight correct point when stacking was enabled and series were of different resolution, fixes #2620

Torkel Ödegaard 10 vuotta sitten
vanhempi
commit
688ed405df

+ 1 - 1
public/app/panels/graph/graph.tooltip.js

@@ -69,7 +69,7 @@ function ($) {
         }
 
         // Highlighting multiple Points depending on the plot type
-        if (scope.panel.steppedLine || (scope.panel.stack && scope.panel.nullPointMode == "null")) {
+        if (scope.panel.steppedLine || scope.panel.stack) {
           // stacked and steppedLine plots can have series with different length.
           // Stacked series can increase its length on each new stacked serie if null points found,
           // to speed the index search we begin always on the last found hoverIndex.

+ 48 - 7
public/test/specs/graph-tooltip-specs.js

@@ -73,8 +73,22 @@ define([
   describeSharedTooltip("steppedLine false, stack true, individual false", function(ctx) {
     ctx.setup(function() {
       ctx.data = [
-        { data: [[10, 15], [12, 20]], stack: true },
-        { data: [[10, 2], [12, 3]], stack: true }
+        {
+          data: [[10, 15], [12, 20]],
+          datapoints: {
+            pointsize: 2,
+            points: [[10,15], [12,20]],
+          },
+          stack: true,
+        },
+        {
+          data: [[10, 2], [12, 3]],
+          datapoints: {
+            pointsize: 2,
+            points: [[10, 2], [12, 3]],
+          },
+          stack: true
+        }
       ];
       ctx.scope.panel.stack = true;
       ctx.pos = { x: 11 };
@@ -83,14 +97,27 @@ define([
     it('should show stacked value', function() {
       expect(ctx.results[1].value).to.be(17);
     });
-
   });
 
   describeSharedTooltip("steppedLine false, stack true, individual false, series stack false", function(ctx) {
     ctx.setup(function() {
       ctx.data = [
-        { data: [[10, 15], [12, 20]], stack: true },
-        { data: [[10, 2], [12, 3]], stack: false }
+        {
+          data: [[10, 15], [12, 20]],
+          datapoints: {
+            pointsize: 2,
+            points: [[10, 15], [12, 20]],
+          },
+          stack: true
+        },
+        {
+          data: [[10, 2], [12, 3]],
+          datapoints: {
+            pointsize: 2,
+            points: [[10, 2], [12, 3]],
+          },
+          stack: false
+        }
       ];
       ctx.scope.panel.stack = true;
       ctx.pos = { x: 11 };
@@ -105,8 +132,22 @@ define([
   describeSharedTooltip("steppedLine false, stack true, individual true", function(ctx) {
     ctx.setup(function() {
       ctx.data = [
-        { data: [[10, 15], [12, 20]], },
-        { data: [[10, 2], [12, 3]], }
+        {
+          data: [[10, 15], [12, 20]],
+          datapoints: {
+            pointsize: 2,
+            points: [[10, 15], [12, 20]],
+          },
+          stack: true
+        },
+        {
+          data: [[10, 2], [12, 3]],
+          datapoints: {
+            pointsize: 2,
+            points: [[10, 2], [12, 3]],
+          },
+          stack: false
+        }
       ];
       ctx.scope.panel.stack = true;
       ctx.scope.panel.tooltip.value_type = 'individual';