From 49a8f75ca02a3b302d7ea304c20a79f2a30a3734 Mon Sep 17 00:00:00 2001 From: Uladzislau Lasitsa Date: Mon, 14 Feb 2022 14:26:21 +0300 Subject: [PATCH] Fixed remarks --- .../expression_metric/common/constants.ts | 5 +++++ .../common/types/expression_functions.ts | 4 ++-- .../common/types/expression_renderers.ts | 8 +++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/plugins/chart_expressions/expression_metric/common/constants.ts b/src/plugins/chart_expressions/expression_metric/common/constants.ts index b39902f61ac45..7d3b84283ec4b 100644 --- a/src/plugins/chart_expressions/expression_metric/common/constants.ts +++ b/src/plugins/chart_expressions/expression_metric/common/constants.ts @@ -7,3 +7,8 @@ */ export const EXPRESSION_METRIC_NAME = 'metricVis'; + +export const LabelPosition = { + BOTTOM: 'bottom', + TOP: 'top', +}; diff --git a/src/plugins/chart_expressions/expression_metric/common/types/expression_functions.ts b/src/plugins/chart_expressions/expression_metric/common/types/expression_functions.ts index bbc409e4dea0d..acce56ef2878d 100644 --- a/src/plugins/chart_expressions/expression_metric/common/types/expression_functions.ts +++ b/src/plugins/chart_expressions/expression_metric/common/types/expression_functions.ts @@ -14,7 +14,7 @@ import { } from '../../../../expressions'; import { ExpressionValueVisDimension } from '../../../../visualizations/common'; import { ColorMode, CustomPaletteState, PaletteOutput } from '../../../../charts/common'; -import { VisParams, visType } from './expression_renderers'; +import { VisParams, visType, LabelPositionType } from './expression_renderers'; import { EXPRESSION_METRIC_NAME } from '../constants'; export interface MetricArguments { @@ -24,7 +24,7 @@ export interface MetricArguments { palette?: PaletteOutput; font: Style; labelFont: Style; - labelPosition: 'bottom' | 'top'; + labelPosition: LabelPositionType; metric: ExpressionValueVisDimension[]; bucket?: ExpressionValueVisDimension; autoScale?: boolean; diff --git a/src/plugins/chart_expressions/expression_metric/common/types/expression_renderers.ts b/src/plugins/chart_expressions/expression_metric/common/types/expression_renderers.ts index e35e50c65ef8e..3804d015d5803 100644 --- a/src/plugins/chart_expressions/expression_metric/common/types/expression_renderers.ts +++ b/src/plugins/chart_expressions/expression_metric/common/types/expression_renderers.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { $Values } from '@kbn/utility-types'; import { ExpressionValueVisDimension } from '../../../../visualizations/common'; import { ColorMode, @@ -14,6 +15,7 @@ import { Style as ChartStyle, } from '../../../../charts/common'; import { Style } from '../../../../expressions/common'; +import { LabelPosition } from '../constants'; export const visType = 'metric'; @@ -22,13 +24,17 @@ export interface DimensionsVisParam { bucket?: ExpressionValueVisDimension; } +export type LabelPositionType = $Values; + export type MetricStyle = Style & Pick; + +export type LabelsConfig = Labels & { style: Style; position: LabelPositionType }; export interface MetricVisParam { percentageMode: boolean; percentageFormatPattern?: string; metricColorMode: ColorMode; palette?: CustomPaletteState; - labels: Labels & { style: Style; position: 'bottom' | 'top' }; + labels: LabelsConfig; style: MetricStyle; autoScale?: boolean; }