add series override option to hide tooltip (#12378)

* add series override option to hide tooltip

* fix test

* invert option

* fix test

* remove initialization
pull/12063/head
Mitsuhiro Tanda 7 years ago committed by Torkel Ödegaard
parent a8976f6c36
commit 04fcd2a054
  1. 4
      public/app/core/time_series2.ts
  2. 5
      public/app/plugins/panel/graph/graph_tooltip.ts
  3. 1
      public/app/plugins/panel/graph/series_overrides_ctrl.ts
  4. 11
      public/app/plugins/panel/graph/specs/graph_tooltip.jest.ts

@ -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;

Loading…
Cancel
Save