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

[7.x] [Dashboard] Fix Lens and TSVB chart tooltip positioning relative to global headers (#94247) #96578

Merged
merged 1 commit into from
Apr 8, 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
14 changes: 14 additions & 0 deletions src/core/public/rendering/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
min-height: 100%;
}

#app-fixed-viewport {
pointer-events: none;
visibility: hidden;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}

.app-wrapper {
display: flex;
flex-flow: column nowrap;
Expand All @@ -35,6 +45,10 @@
@mixin kbnAffordForHeader($headerHeight) {
padding-top: $headerHeight;

#app-fixed-viewport {
top: $headerHeight;
}

.euiFlyout,
.euiCollapsibleNav {
top: $headerHeight;
Expand Down
1 change: 1 addition & 0 deletions src/core/public/rendering/rendering_service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class RenderingService {
{chromeHeader}
<AppWrapper chromeVisible$={chrome.getIsVisible$()}>
<div className="app-wrapper-panel">
<div id="app-fixed-viewport" />
<div id="globalBannerList">{bannerComponent}</div>
<AppContainer classes$={chrome.getApplicationClasses$()}>{appComponent}</AppContainer>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export const TimeSeries = ({
tooltip={{
snap: true,
type: tooltipMode === 'show_focused' ? TooltipType.Follow : TooltipType.VerticalCursor,
boundary: document.getElementById('app-fixed-viewport') ?? undefined,
headerFormatter: tooltipFormatter,
}}
externalPointerEvents={{ tooltip: { visible: false } }}
Expand Down
4 changes: 3 additions & 1 deletion src/plugins/vis_type_xy/public/components/xy_settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ export const XYSettings: FC<XYSettingsProps> = ({
: headerValueFormatter &&
(tooltip.detailedTooltip ? undefined : ({ value }: any) => headerValueFormatter(value));

const boundary = document.getElementById('app-fixed-viewport') ?? undefined;
const tooltipProps: TooltipProps = tooltip.detailedTooltip
? {
...tooltip,
boundary,
customTooltip: tooltip.detailedTooltip(headerFormatter),
headerFormatter: undefined,
}
: { ...tooltip, headerFormatter };
: { ...tooltip, boundary, headerFormatter };

return (
<Settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ export function PieComponent(

onClickValue(desanitizeFilterContext(context));
};

return (
<VisualizationContainer
reportTitle={props.args.title}
Expand All @@ -260,6 +261,7 @@ export function PieComponent(
>
<Chart>
<Settings
tooltip={{ boundary: document.getElementById('app-fixed-viewport') ?? undefined }}
debugState={window._echDebugStateFlag ?? false}
// Legend is hidden in many scenarios
// - Tiny preview
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x-pack/plugins/lens/public/xy_visualization/expression.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ export function XYChart({
const { legend, layers, fittingFunction, gridlinesVisibilitySettings, valueLabels } = args;
const chartTheme = chartsThemeService.useChartsTheme();
const chartBaseTheme = chartsThemeService.useChartsBaseTheme();

const filteredLayers = getFilteredLayers(layers, data);

if (filteredLayers.length === 0) {
Expand Down Expand Up @@ -547,6 +546,7 @@ export function XYChart({
}}
baseTheme={chartBaseTheme}
tooltip={{
boundary: document.getElementById('app-fixed-viewport') ?? undefined,
headerFormatter: (d) => safeXAccessorLabelRenderer(d.value),
}}
rotation={shouldRotate ? 90 : 0}
Expand Down