mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
d3c79c9b49
commit
688ed405df
@ -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.
|
||||
|
@ -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';
|
||||
|
Loading…
Reference in New Issue
Block a user