Skip to content

Commit

Permalink
render EmptyPlaceholder on no results
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese committed Jun 6, 2023
1 parent a482b0e commit 83bd394
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -82,6 +84,11 @@ export const TagCloudChart = ({
renderComplete,
syncColors,
}: TagCloudChartProps) => {

if (visData.rows.length === 0) {
return <EmptyPlaceholder icon={IconChartTagcloud} renderComplete={renderComplete} />;
}

const [warning, setWarning] = useState(false);
const { bucket, metric, scale, palette, showLabel, orientation } = visParams;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ export const tagcloudRenderer: (

const palettesRegistry = await plugins.charts.palettes.getPalettes();

const showNoResult = config.visData.rows.length === 0;

render(
<KibanaThemeProvider theme$={core.theme.theme$}>
<I18nProvider>
Expand All @@ -81,7 +79,6 @@ export const tagcloudRenderer: (
// It is used for rendering at `Canvas`.
className={cx('tagCloudContainer', css(tagCloudVisClass))}
renderComplete={renderComplete}
showNoResult={showNoResult}
>
<TagCloudChart
{...config}
Expand Down

0 comments on commit 83bd394

Please sign in to comment.