From a0a66a15776f2117c1a0bd44d4f64f6a7575f080 Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Tue, 9 Mar 2021 18:03:19 -0600 Subject: [PATCH 01/10] fix lens and xy charts tooltip position --- package.json | 2 +- .../vis_type_xy/public/components/xy_settings.tsx | 10 +++++++++- .../lens/public/pie_visualization/render_function.tsx | 6 +++++- x-pack/plugins/lens/public/shared_components/index.ts | 2 ++ .../lens/public/xy_visualization/expression.tsx | 4 +++- yarn.lock | 8 ++++---- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 12eae1b256570..1545a5d7f22df 100644 --- a/package.json +++ b/package.json @@ -348,7 +348,7 @@ "@cypress/webpack-preprocessor": "^5.5.0", "@elastic/apm-rum": "^5.6.1", "@elastic/apm-rum-react": "^1.2.5", - "@elastic/charts": "25.1.0", + "@elastic/charts": "25.2.0", "@elastic/eslint-config-kibana": "link:packages/elastic-eslint-config-kibana", "@elastic/eslint-plugin-eui": "0.0.2", "@elastic/github-checks-reporter": "0.0.20b3", diff --git a/src/plugins/vis_type_xy/public/components/xy_settings.tsx b/src/plugins/vis_type_xy/public/components/xy_settings.tsx index 59bed0060a6a6..c350f76d00eb4 100644 --- a/src/plugins/vis_type_xy/public/components/xy_settings.tsx +++ b/src/plugins/vis_type_xy/public/components/xy_settings.tsx @@ -61,6 +61,8 @@ type XYSettingsProps = Pick< legendPosition: Position; }; +const KBN_HEADER_OFFSET = 98; + function getValueLabelsStyling(isHorizontal: boolean) { const VALUE_LABELS_MAX_FONTSIZE = 15; const VALUE_LABELS_MIN_FONTSIZE = 10; @@ -148,13 +150,19 @@ export const XYSettings: FC = ({ : headerValueFormatter && (tooltip.detailedTooltip ? undefined : ({ value }: any) => headerValueFormatter(value)); + const boudaryProps = { + boundary: document.body, + boundaryPadding: { top: KBN_HEADER_OFFSET }, + }; + const tooltipProps: TooltipProps = tooltip.detailedTooltip ? { ...tooltip, + ...boudaryProps, customTooltip: tooltip.detailedTooltip(headerFormatter), headerFormatter: undefined, } - : { ...tooltip, headerFormatter }; + : { ...tooltip, ...boudaryProps, headerFormatter }; return (