Skip to content

Commit

Permalink
[Lens] Switch to unified metric renderer (#126019)
Browse files Browse the repository at this point in the history
* Switch to unified metric renderer

* Fix tests

* Fix snapshots

* Remove unused translation

* Fix tests

* Fix font size mapping

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
VladLasitsa and kibanamachine authored Mar 9, 2022
1 parent 2836018 commit 9f880f2
Show file tree
Hide file tree
Showing 35 changed files with 228 additions and 1,261 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const MetricVisValue = ({
style={autoScale && colorFullBackground ? {} : { backgroundColor: metric.bgColor }}
>
<div
data-test-subj="metric_value"
className="mtrVis__value"
style={{
...(style.spec as CSSProperties),
Expand All @@ -60,6 +61,7 @@ export const MetricVisValue = ({
/>
{labelConfig.show && (
<div
data-test-subj="metric_label"
style={{
...(labelConfig.style.spec as CSSProperties),
order: labelConfig.position === 'top' ? -1 : 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const getMetricVisRenderer = (
render(
<KibanaThemeProvider theme$={theme.theme$}>
<VisualizationContainer
data-test-subj="mtrVis"
className="mtrVis"
showNoResult={!visData.rows?.length}
handlers={handlers}
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/lens/common/expressions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export * from './rename_columns';
export * from './merge_tables';
export * from './time_scale';
export * from './datatable';
export * from './metric_chart';
export * from './xy_chart';

export * from './expression_types';
9 changes: 0 additions & 9 deletions x-pack/plugins/lens/common/expressions/metric_chart/index.ts

This file was deleted.

113 changes: 0 additions & 113 deletions x-pack/plugins/lens/common/expressions/metric_chart/metric_chart.ts

This file was deleted.

33 changes: 0 additions & 33 deletions x-pack/plugins/lens/common/expressions/metric_chart/types.ts

This file was deleted.

17 changes: 15 additions & 2 deletions x-pack/plugins/lens/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ import type {
SerializedFieldFormat,
} from '../../../../src/plugins/field_formats/common';
import type { Datatable } from '../../../../src/plugins/expressions/common';
import type { PaletteContinuity } from '../../../../src/plugins/charts/common';
import type { PaletteOutput } from '../../../../src/plugins/charts/common';
import type {
PaletteContinuity,
PaletteOutput,
ColorMode,
} from '../../../../src/plugins/charts/common';
import {
CategoryDisplay,
layerTypes,
Expand Down Expand Up @@ -121,3 +124,13 @@ export interface PieVisualizationState {
layers: PieLayerState[];
palette?: PaletteOutput;
}
export interface MetricState {
layerId: string;
accessor?: string;
layerType: LayerType;
colorMode?: ColorMode;
palette?: PaletteOutput<CustomPaletteParams>;
titlePosition?: 'top' | 'bottom';
size?: string;
textAlign?: 'left' | 'right' | 'center';
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import type { LensByReferenceInput, LensByValueInput } from './embeddable';
import type { Document } from '../persistence';
import type { IndexPatternPersistedState } from '../indexpattern_datasource/types';
import type { XYState } from '../xy_visualization/types';
import type { MetricState } from '../../common/expressions';
import type { PieVisualizationState } from '../../common';
import type { PieVisualizationState, MetricState } from '../../common';
import type { DatatableVisualizationState } from '../datatable_visualization/visualization';
import type { HeatmapVisualizationState } from '../heatmap_visualization/types';
import type { GaugeVisualizationState } from '../visualizations/gauge/constants';
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/lens/public/expressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { renameColumns } from '../common/expressions/rename_columns/rename_colum
import { formatColumn } from '../common/expressions/format_column';
import { counterRate } from '../common/expressions/counter_rate';
import { getTimeScale } from '../common/expressions/time_scale/time_scale';
import { metricChart } from '../common/expressions/metric_chart/metric_chart';
import { lensMultitable } from '../common/expressions';

export const setupExpressions = (
Expand All @@ -44,7 +43,6 @@ export const setupExpressions = (
xyChart,
mergeTables,
counterRate,
metricChart,
yAxisConfig,
dataLayerConfig,
referenceLineLayerConfig,
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/lens/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export type {
export type { XYState } from './xy_visualization/types';
export type { DataType, OperationMetadata, Visualization } from './types';
export type {
MetricState,
AxesSettingsConfig,
XYLayerConfig,
LegendConfig,
Expand Down

This file was deleted.

Loading

0 comments on commit 9f880f2

Please sign in to comment.