fix(graph tooltip): multi series tooltip did no highlight correct point when stacking was enabled and series were of different resolution, fixes #2620
This commit is contained in:
@@ -69,7 +69,7 @@ function ($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Highlighting multiple Points depending on the plot type
|
// 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 and steppedLine plots can have series with different length.
|
||||||
// Stacked series can increase its length on each new stacked serie if null points found,
|
// 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.
|
// to speed the index search we begin always on the last found hoverIndex.
|
||||||
|
|||||||
@@ -73,8 +73,22 @@ define([
|
|||||||
describeSharedTooltip("steppedLine false, stack true, individual false", function(ctx) {
|
describeSharedTooltip("steppedLine false, stack true, individual false", function(ctx) {
|
||||||
ctx.setup(function() {
|
ctx.setup(function() {
|
||||||
ctx.data = [
|
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.scope.panel.stack = true;
|
||||||
ctx.pos = { x: 11 };
|
ctx.pos = { x: 11 };
|
||||||
@@ -83,14 +97,27 @@ define([
|
|||||||
it('should show stacked value', function() {
|
it('should show stacked value', function() {
|
||||||
expect(ctx.results[1].value).to.be(17);
|
expect(ctx.results[1].value).to.be(17);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describeSharedTooltip("steppedLine false, stack true, individual false, series stack false", function(ctx) {
|
describeSharedTooltip("steppedLine false, stack true, individual false, series stack false", function(ctx) {
|
||||||
ctx.setup(function() {
|
ctx.setup(function() {
|
||||||
ctx.data = [
|
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.scope.panel.stack = true;
|
||||||
ctx.pos = { x: 11 };
|
ctx.pos = { x: 11 };
|
||||||
@@ -105,8 +132,22 @@ define([
|
|||||||
describeSharedTooltip("steppedLine false, stack true, individual true", function(ctx) {
|
describeSharedTooltip("steppedLine false, stack true, individual true", function(ctx) {
|
||||||
ctx.setup(function() {
|
ctx.setup(function() {
|
||||||
ctx.data = [
|
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.stack = true;
|
||||||
ctx.scope.panel.tooltip.value_type = 'individual';
|
ctx.scope.panel.tooltip.value_type = 'individual';
|
||||||
|
|||||||
Reference in New Issue
Block a user