Commit 04fcd2a0 by Mitsuhiro Tanda Committed by Torkel Ödegaard

add series override option to hide tooltip (#12378)

* add series override option to hide tooltip

* fix test

* invert option

* fix test

* remove initialization
parent a8976f6c
......@@ -76,6 +76,7 @@ export default class TimeSeries {
valueFormater: any;
stats: any;
legend: boolean;
hideTooltip: boolean;
allIsNull: boolean;
allIsZero: boolean;
decimals: number;
......@@ -181,6 +182,9 @@ export default class TimeSeries {
if (override.legend !== void 0) {
this.legend = override.legend;
}
if (override.hideTooltip !== void 0) {
this.hideTooltip = override.hideTooltip;
}
if (override.yaxis !== void 0) {
this.yaxis = override.yaxis;
......
......@@ -81,6 +81,11 @@ export default function GraphTooltip(elem, dashboard, scope, getSeriesFn) {
continue;
}
if (series.hideTooltip) {
results[0].push({ hidden: true, value: 0 });
continue;
}
hoverIndex = this.findHoverIndexFromData(pos.x, series);
hoverDistance = pos.x - series.data[hoverIndex][0];
pointTime = series.data[hoverIndex][0];
......
......@@ -152,6 +152,7 @@ export function SeriesOverridesCtrl($scope, $element, popoverSrv) {
$scope.addOverrideOption('Z-index', 'zindex', [-3, -2, -1, 0, 1, 2, 3]);
$scope.addOverrideOption('Transform', 'transform', ['negative-Y']);
$scope.addOverrideOption('Legend', 'legend', [true, false]);
$scope.addOverrideOption('Hide in tooltip', 'hideTooltip', [true, false]);
$scope.updateCurrentOverrides();
}
......
......@@ -68,7 +68,10 @@ describe('findHoverIndexFromData', function() {
describeSharedTooltip('steppedLine false, stack false', function(ctx) {
ctx.setup(function() {
ctx.data = [{ data: [[10, 15], [12, 20]], lines: {} }, { data: [[10, 2], [12, 3]], lines: {} }];
ctx.data = [
{ data: [[10, 15], [12, 20]], lines: {}, hideTooltip: false },
{ data: [[10, 2], [12, 3]], lines: {}, hideTooltip: false },
];
ctx.pos = { x: 11 };
});
......@@ -105,6 +108,7 @@ describeSharedTooltip('steppedLine false, stack true, individual false', functio
points: [[10, 15], [12, 20]],
},
stack: true,
hideTooltip: false,
},
{
data: [[10, 2], [12, 3]],
......@@ -114,6 +118,7 @@ describeSharedTooltip('steppedLine false, stack true, individual false', functio
points: [[10, 2], [12, 3]],
},
stack: true,
hideTooltip: false,
},
];
ctx.ctrl.panel.stack = true;
......@@ -136,6 +141,7 @@ describeSharedTooltip('steppedLine false, stack true, individual false, series s
points: [[10, 15], [12, 20]],
},
stack: true,
hideTooltip: false,
},
{
data: [[10, 2], [12, 3]],
......@@ -145,6 +151,7 @@ describeSharedTooltip('steppedLine false, stack true, individual false, series s
points: [[10, 2], [12, 3]],
},
stack: false,
hideTooltip: false,
},
];
ctx.ctrl.panel.stack = true;
......@@ -167,6 +174,7 @@ describeSharedTooltip('steppedLine false, stack true, individual true', function
points: [[10, 15], [12, 20]],
},
stack: true,
hideTooltip: false,
},
{
data: [[10, 2], [12, 3]],
......@@ -176,6 +184,7 @@ describeSharedTooltip('steppedLine false, stack true, individual true', function
points: [[10, 2], [12, 3]],
},
stack: false,
hideTooltip: false,
},
];
ctx.ctrl.panel.stack = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment