From 67edd8af4ef63163660609c5b8084152e91a9724 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 18 Jul 2019 14:13:55 +0200 Subject: [PATCH 1/2] show icon in case no data is returned from esaggs --- .../xy_config_panel.tsx | 2 +- .../xy_visualization_plugin/xy_expression.tsx | 27 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_config_panel.tsx b/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_config_panel.tsx index fdaa448584536..3e7f32c62d627 100644 --- a/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_config_panel.tsx +++ b/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_config_panel.tsx @@ -20,7 +20,7 @@ import { VisualizationProps } from '../types'; import { NativeRenderer } from '../native_renderer'; import { MultiColumnEditor } from './multi_column_editor'; -const chartTypeIcons: Array<{ id: SeriesType; label: string; iconType: IconType }> = [ +export const chartTypeIcons: Array<{ id: SeriesType; label: string; iconType: IconType }> = [ { id: 'line', label: i18n.translate('xpack.lens.xyVisualization.lineChartLabel', { diff --git a/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_expression.tsx b/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_expression.tsx index 2392114e26999..772b2a8f55f3b 100644 --- a/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_expression.tsx +++ b/x-pack/legacy/plugins/lens/public/xy_visualization_plugin/xy_expression.tsx @@ -17,9 +17,12 @@ import { BarSeries, } from '@elastic/charts'; import { ExpressionFunction } from 'src/legacy/core_plugins/interpreter/types'; -import { XYArgs } from './types'; +import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiText, IconType } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; +import { XYArgs, SeriesType } from './types'; import { KibanaDatatable } from '../types'; import { RenderFunction } from '../interpreter_types'; +import { chartTypeIcons } from './xy_config_panel'; export interface XYChartProps { data: KibanaDatatable; @@ -101,7 +104,29 @@ export const xyChartRenderer: RenderFunction = { }, }; +function getIconForSeriesType(seriesType: SeriesType): IconType { + return chartTypeIcons.find(chartTypeIcon => chartTypeIcon.id === seriesType)!.iconType; +} + export function XYChart({ data, args }: XYChartProps) { + if (data.rows.length === 0) { + return ( + + + + + + + + + + + ); + } + const { legend, x, y, splitSeriesAccessors, seriesType } = args; // TODO: Stop mapping data once elastic-charts allows axis naming // https://github.com/elastic/elastic-charts/issues/245 From 1ff38c1c209fa6365819bb707e4fbcc58be65752 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Mon, 22 Jul 2019 10:52:50 +0200 Subject: [PATCH 2/2] fix reference --- x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts index 41989427c3e0f..74b0ff434f4cb 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts @@ -6,6 +6,7 @@ import { Chrome } from 'ui/chrome'; import { ToastNotifications } from 'ui/notify/toasts/toast_notifications'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths import { SavedObjectAttributes } from 'src/core/server/saved_objects'; import { IndexPatternField } from './indexpattern';