From e4f3b0308923b8e8ff140e5cb453467d72a60637 Mon Sep 17 00:00:00 2001 From: Katalin Monfera Date: Sat, 27 Mar 2021 10:06:36 +0100 Subject: [PATCH 1/2] chore: remove tooltip --- src/chart_types/wordcloud/state/chart_state.tsx | 12 +++--------- src/chart_types/wordcloud/state/selectors/tooltip.ts | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/chart_types/wordcloud/state/chart_state.tsx b/src/chart_types/wordcloud/state/chart_state.tsx index eab2c58927..abfa6abf36 100644 --- a/src/chart_types/wordcloud/state/chart_state.tsx +++ b/src/chart_types/wordcloud/state/chart_state.tsx @@ -22,8 +22,7 @@ import React from 'react'; import { ChartTypes } from '../..'; import { DEFAULT_CSS_CURSOR } from '../../../common/constants'; import { LegendItem } from '../../../common/legend'; -import { Tooltip } from '../../../components/tooltip'; -import { InternalChartState, GlobalChartState, BackwardRef } from '../../../state/chart_state'; +import { InternalChartState, GlobalChartState } from '../../../state/chart_state'; import { InitStatus } from '../../../state/selectors/get_internal_is_intialized'; import { LegendItemLabel } from '../../../state/selectors/get_legend_items_labels'; import { DebugState } from '../../../state/types'; @@ -84,13 +83,8 @@ export class WordcloudState implements InternalChartState { return EMPTY_MAP; } - chartRenderer(containerRef: BackwardRef) { - return ( - <> - - - - ); + chartRenderer() { + return ; } getPointerCursor() { diff --git a/src/chart_types/wordcloud/state/selectors/tooltip.ts b/src/chart_types/wordcloud/state/selectors/tooltip.ts index 37bf8ea814..08422fa80b 100644 --- a/src/chart_types/wordcloud/state/selectors/tooltip.ts +++ b/src/chart_types/wordcloud/state/selectors/tooltip.ts @@ -46,7 +46,7 @@ export const getTooltipInfoSelector = createCachedSelector( label: 'Word count', color: 'white', isHighlighted: false, - isVisible: true, + isVisible: false, seriesIdentifier: { specId: spec.id, key: spec.id, From 1656a923b3541c2c1709af520d61dd24bb73da93 Mon Sep 17 00:00:00 2001 From: Katalin Monfera Date: Sun, 28 Mar 2021 17:35:30 +0200 Subject: [PATCH 2/2] chore: tooltip return false or empty --- .../wordcloud/state/chart_state.tsx | 11 ++-- .../state/selectors/is_tooltip_visible.ts | 37 ----------- .../wordcloud/state/selectors/tooltip.ts | 61 ------------------- 3 files changed, 5 insertions(+), 104 deletions(-) delete mode 100644 src/chart_types/wordcloud/state/selectors/is_tooltip_visible.ts delete mode 100644 src/chart_types/wordcloud/state/selectors/tooltip.ts diff --git a/src/chart_types/wordcloud/state/chart_state.tsx b/src/chart_types/wordcloud/state/chart_state.tsx index abfa6abf36..ee29634f01 100644 --- a/src/chart_types/wordcloud/state/chart_state.tsx +++ b/src/chart_types/wordcloud/state/chart_state.tsx @@ -27,12 +27,11 @@ import { InitStatus } from '../../../state/selectors/get_internal_is_intialized' import { LegendItemLabel } from '../../../state/selectors/get_legend_items_labels'; import { DebugState } from '../../../state/types'; import { Dimensions } from '../../../utils/dimensions'; +import { EMPTY_TOOLTIP } from '../../partition_chart/layout/viewmodel/tooltip_info'; import { Wordcloud } from '../renderer/svg/connected_component'; -import { isTooltipVisibleSelector } from './selectors/is_tooltip_visible'; import { createOnElementClickCaller } from './selectors/on_element_click_caller'; import { createOnElementOutCaller } from './selectors/on_element_out_caller'; import { createOnElementOverCaller } from './selectors/on_element_over_caller'; -import { getTooltipInfoSelector } from './selectors/tooltip'; import { getSpecOrNull } from './selectors/wordcloud_spec'; const EMPTY_MAP = new Map(); @@ -91,12 +90,12 @@ export class WordcloudState implements InternalChartState { return DEFAULT_CSS_CURSOR; } - isTooltipVisible(globalState: GlobalChartState) { - return { visible: isTooltipVisibleSelector(globalState), isExternal: false }; + isTooltipVisible() { + return { visible: false, isExternal: false }; } - getTooltipInfo(globalState: GlobalChartState) { - return getTooltipInfoSelector(globalState); + getTooltipInfo() { + return EMPTY_TOOLTIP; } getTooltipAnchor(state: GlobalChartState) { diff --git a/src/chart_types/wordcloud/state/selectors/is_tooltip_visible.ts b/src/chart_types/wordcloud/state/selectors/is_tooltip_visible.ts deleted file mode 100644 index 1c3c0d0fb3..0000000000 --- a/src/chart_types/wordcloud/state/selectors/is_tooltip_visible.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import createCachedSelector from 're-reselect'; - -import { getTooltipType } from '../../../../specs'; -import { TooltipType } from '../../../../specs/constants'; -import { getChartIdSelector } from '../../../../state/selectors/get_chart_id'; -import { getSettingsSpecSelector } from '../../../../state/selectors/get_settings_specs'; -import { getTooltipInfoSelector } from './tooltip'; - -/** @internal */ -export const isTooltipVisibleSelector = createCachedSelector( - [getSettingsSpecSelector, getTooltipInfoSelector], - (settingsSpec, tooltipInfo): boolean => { - if (getTooltipType(settingsSpec) === TooltipType.None) { - return false; - } - return tooltipInfo.values.length > 0; - }, -)(getChartIdSelector); diff --git a/src/chart_types/wordcloud/state/selectors/tooltip.ts b/src/chart_types/wordcloud/state/selectors/tooltip.ts deleted file mode 100644 index 08422fa80b..0000000000 --- a/src/chart_types/wordcloud/state/selectors/tooltip.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import createCachedSelector from 're-reselect'; - -import { TooltipInfo } from '../../../../components/tooltip/types'; -import { getPickedShapes } from './picked_shapes'; -import { getSpecOrNull } from './wordcloud_spec'; - -const EMPTY_TOOLTIP = Object.freeze({ - header: null, - values: [], -}); - -/** @internal */ -export const getTooltipInfoSelector = createCachedSelector( - [getSpecOrNull, getPickedShapes], - (spec, pickedShapes): TooltipInfo => { - if (!spec) { - return EMPTY_TOOLTIP; - } - - const tooltipInfo: TooltipInfo = { - header: null, - values: [], - }; - - pickedShapes.forEach((shape) => { - tooltipInfo.values.push({ - label: 'Word count', - color: 'white', - isHighlighted: false, - isVisible: false, - seriesIdentifier: { - specId: spec.id, - key: spec.id, - }, - value: shape.data.length, - formattedValue: `${shape.data.length}`, - }); - }); - - return tooltipInfo; - }, -)((state) => state.chartId);