From 83bd39421c17e875795d8aa4d9430f8bc78f84be Mon Sep 17 00:00:00 2001 From: nreese Date: Tue, 6 Jun 2023 13:48:52 -0600 Subject: [PATCH] render EmptyPlaceholder on no results --- .../public/components/tagcloud_component.tsx | 7 +++++++ .../public/expression_renderers/tagcloud_renderer.tsx | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/plugins/chart_expressions/expression_tagcloud/public/components/tagcloud_component.tsx b/src/plugins/chart_expressions/expression_tagcloud/public/components/tagcloud_component.tsx index 7b8981b99cde5..f44b5ff927932 100644 --- a/src/plugins/chart_expressions/expression_tagcloud/public/components/tagcloud_component.tsx +++ b/src/plugins/chart_expressions/expression_tagcloud/public/components/tagcloud_component.tsx @@ -10,7 +10,9 @@ import React, { useCallback, useState, useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { throttle } from 'lodash'; import { EuiIconTip, EuiResizeObserver } from '@elastic/eui'; +import { IconChartTagcloud } from '@kbn/chart-icons'; import { Chart, Settings, Wordcloud, RenderChangeListener } from '@elastic/charts'; +import { EmptyPlaceholder } from '@kbn/charts-plugin/public'; import type { PaletteRegistry, PaletteOutput } from '@kbn/coloring'; import { IInterpreterRenderHandlers } from '@kbn/expressions-plugin/public'; import { @@ -82,6 +84,11 @@ export const TagCloudChart = ({ renderComplete, syncColors, }: TagCloudChartProps) => { + + if (visData.rows.length === 0) { + return ; + } + const [warning, setWarning] = useState(false); const { bucket, metric, scale, palette, showLabel, orientation } = visParams; diff --git a/src/plugins/chart_expressions/expression_tagcloud/public/expression_renderers/tagcloud_renderer.tsx b/src/plugins/chart_expressions/expression_tagcloud/public/expression_renderers/tagcloud_renderer.tsx index dad8ddce721d1..57c0e973adc25 100644 --- a/src/plugins/chart_expressions/expression_tagcloud/public/expression_renderers/tagcloud_renderer.tsx +++ b/src/plugins/chart_expressions/expression_tagcloud/public/expression_renderers/tagcloud_renderer.tsx @@ -68,8 +68,6 @@ export const tagcloudRenderer: ( const palettesRegistry = await plugins.charts.palettes.getPalettes(); - const showNoResult = config.visData.rows.length === 0; - render( @@ -81,7 +79,6 @@ export const tagcloudRenderer: ( // It is used for rendering at `Canvas`. className={cx('tagCloudContainer', css(tagCloudVisClass))} renderComplete={renderComplete} - showNoResult={showNoResult} >