diff --git a/packages/osd-charts/src/chart_types/wordcloud/state/chart_state.tsx b/packages/osd-charts/src/chart_types/wordcloud/state/chart_state.tsx index eab2c58927e0..ee29634f013e 100644 --- a/packages/osd-charts/src/chart_types/wordcloud/state/chart_state.tsx +++ b/packages/osd-charts/src/chart_types/wordcloud/state/chart_state.tsx @@ -22,18 +22,16 @@ 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'; 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(); @@ -84,25 +82,20 @@ export class WordcloudState implements InternalChartState { return EMPTY_MAP; } - chartRenderer(containerRef: BackwardRef) { - return ( - <> - - - - ); + chartRenderer() { + return ; } getPointerCursor() { 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/packages/osd-charts/src/chart_types/wordcloud/state/selectors/is_tooltip_visible.ts b/packages/osd-charts/src/chart_types/wordcloud/state/selectors/is_tooltip_visible.ts deleted file mode 100644 index 1c3c0d0fb3b5..000000000000 --- a/packages/osd-charts/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/packages/osd-charts/src/chart_types/wordcloud/state/selectors/tooltip.ts b/packages/osd-charts/src/chart_types/wordcloud/state/selectors/tooltip.ts deleted file mode 100644 index 37bf8ea8140a..000000000000 --- a/packages/osd-charts/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: true, - seriesIdentifier: { - specId: spec.id, - key: spec.id, - }, - value: shape.data.length, - formattedValue: `${shape.data.length}`, - }); - }); - - return tooltipInfo; - }, -)((state) => state.chartId);