From 26833337fff83a33adaf478a73be581824b376ed Mon Sep 17 00:00:00 2001 From: Nick Partridge Date: Wed, 21 Aug 2019 11:42:29 -0500 Subject: [PATCH] fix(tooltip): ie11 flex sizing (#334) Fix tooltip label overflow/squeeze #332 --- packages/osd-charts/.playground/playgroud.tsx | 199 ++++++++---------- packages/osd-charts/package.json | 6 +- .../osd-charts/src/components/_tooltip.scss | 3 +- 3 files changed, 92 insertions(+), 116 deletions(-) diff --git a/packages/osd-charts/.playground/playgroud.tsx b/packages/osd-charts/.playground/playgroud.tsx index ea0670739378..759a5c8e8cd1 100644 --- a/packages/osd-charts/.playground/playgroud.tsx +++ b/packages/osd-charts/.playground/playgroud.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { loremIpsum } from 'lorem-ipsum'; import { Axis, @@ -10,129 +9,103 @@ import { Position, ScaleType, Settings, - AreaSeries, - mergeWithDefaultTheme, + LineSeries, } from '../src'; import { KIBANA_METRICS } from '../src/utils/data_samples/test_dataset_kibana'; +import { CursorEvent } from '../src/specs/settings'; +import { CursorUpdateListener } from '../src/chart_types/xy_chart/store/chart_state'; export class Playground extends React.Component { + ref1 = React.createRef(); + ref2 = React.createRef(); + ref3 = React.createRef(); + + onCursorUpdate: CursorUpdateListener = (event?: CursorEvent) => { + this.ref1.current!.dispatchExternalCursorEvent(event); + this.ref2.current!.dispatchExternalCursorEvent(event); + this.ref3.current!.dispatchExternalCursorEvent(event); + }; + render() { - return <>{this.renderChart(Position.Bottom)}; + return ( + <> + {renderChart( + '1', + this.ref1, + KIBANA_METRICS.metrics.kibana_os_load[0].data.slice(0, 15), + this.onCursorUpdate, + true, + )} + {renderChart( + '2', + this.ref2, + KIBANA_METRICS.metrics.kibana_os_load[1].data.slice(0, 15), + this.onCursorUpdate, + true, + )} + {renderChart('3', this.ref3, KIBANA_METRICS.metrics.kibana_os_load[1].data.slice(15, 30), this.onCursorUpdate)} + + ); } - renderChart(legendPosition: Position) { - const renderMore = () => { - const random = Math.floor(Math.random() * 3) + 1; - const id = loremIpsum({ count: random, units: 'words' }); - return ( - , + data: any, + onCursorUpdate?: CursorUpdateListener, + timeSeries: boolean = false, +) { + return ( +
+ + + + d.toFixed(2)} /> + - ); - }; - const theme = mergeWithDefaultTheme({ - lineSeriesStyle: { - line: { - stroke: 'violet', - strokeWidth: 4, - }, - point: { - fill: 'yellow', - stroke: 'black', - strokeWidth: 2, - radius: 6, - }, - }, - }); - return ( -
- - - - d.toFixed(2)} /> - - - - - {Array(10) - .fill(null) - .map(renderMore)} - -
- ); - } + + +
+
+ ); } diff --git a/packages/osd-charts/package.json b/packages/osd-charts/package.json index 70b1940e0e27..5ad6ddcd52ac 100644 --- a/packages/osd-charts/package.json +++ b/packages/osd-charts/package.json @@ -29,7 +29,8 @@ "semantic-release": "semantic-release", "typecheck:src": "yarn build:ts --noEmit", "typecheck:all": "tsc -p ./tsconfig.json --noEmit", - "playground": "cd .playground && webpack-dev-server" + "playground": "cd .playground && webpack-dev-server", + "playground:ie": "cd .playground && webpack-dev-server --host=0.0.0.0 --disable-host-check --useLocalIp" }, "files": [ "dist/**/*", @@ -145,6 +146,7 @@ "yarn": "^1.10.1" }, "browserslist": [ - "last 2 versions" + "last 2 versions", + "ie 11" ] } diff --git a/packages/osd-charts/src/components/_tooltip.scss b/packages/osd-charts/src/components/_tooltip.scss index 9200337d28da..5e0e379eb990 100644 --- a/packages/osd-charts/src/components/_tooltip.scss +++ b/packages/osd-charts/src/components/_tooltip.scss @@ -24,7 +24,8 @@ } &__label { - @include euiTextOverflowWrap; + overflow-wrap: break-word; + word-wrap: break-word; min-width: 1px; flex: 1 1 auto; }