Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gauge/goal: Tooltip always includes "_all" #101064

Merged
merged 2 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function pointSeriesTooltipFormatter() {

const details = [];
const isGauge = config.get('gauge', false);
const chartType = config.get('type', undefined);
const isPercentageMode = config.get(isGauge ? 'gauge.percentageMode' : 'percentageMode', false);
const isSetColorRange = config.get('setColorRange', false);

Expand All @@ -44,7 +45,8 @@ export function pointSeriesTooltipFormatter() {
});
}

if (datum.x !== null && datum.x !== undefined) {
// For goal and gauge we have only one value for x - '_all'. It doesn't have sense to show it
if (datum.x !== null && datum.x !== undefined && !['goal', 'gauge'].includes(chartType)) {
VladLasitsa marked this conversation as resolved.
Show resolved Hide resolved
addDetail(data.xAxisLabel, data.xAxisFormatter(datum.x));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,27 @@ describe('tooltipFormatter', function () {
const $rows = $el.find('tr');
expect($rows.length).toBe(3);
});

it('renders correctly for gauge/goal visualizations', function () {
const event = _.cloneDeep(baseEvent);
let type = 'gauge';
event.config.get = (name) => {
const config = {
setColorRange: false,
gauge: false,
percentageMode: false,
type,
};
return config[name];
};

let $el = $(tooltipFormatter(event, uiSettings));
let $rows = $el.find('tr');
expect($rows.length).toBe(2);

type = 'goal';
$el = $(tooltipFormatter(event, uiSettings));
$rows = $el.find('tr');
expect($rows.length).toBe(2);
});
});