Skip to content

Commit

Permalink
[Dashboard] Fix Lens and TSVB chart tooltip positioning relative to g…
Browse files Browse the repository at this point in the history
…lobal headers (#94247)
  • Loading branch information
nickofthyme authored Apr 5, 2021
1 parent 7da1b82 commit d4b0f92
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 2 deletions.
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

0 comments on commit d4b0f92

Please sign in to comment.