Skip to content

Commit

Permalink
resolve types
Browse files Browse the repository at this point in the history
  • Loading branch information
drewdaemon committed Nov 10, 2022
1 parent ff8a49f commit b240615
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {
VisualizationDimensionGroupConfig,
Suggestion,
VisualizeEditorContext,
VisualizationInfo,
} from '../../types';
import { getSortedGroups, toExpression, toPreviewExpression } from './to_expression';
import {
Expand All @@ -40,6 +41,10 @@ import { DimensionDataExtraEditor, DimensionEditor, PieToolbar } from './toolbar
import { LayerSettings } from './layer_settings';
import { checkTableForContainsSmallValues } from './render_helpers';

const metricLabel = i18n.translate('xpack.lens.pie.groupMetricLabelSingular', {
defaultMessage: 'Metric',
});

function newLayerState(layerId: string): PieLayerState {
return {
layerId,
Expand Down Expand Up @@ -299,9 +304,7 @@ export const getPieVisualization = ({
? i18n.translate('xpack.lens.pie.groupMetricLabel', {
defaultMessage: 'Metrics',
})
: i18n.translate('xpack.lens.pie.groupMetricLabelSingular', {
defaultMessage: 'Metric',
});
: metricLabel;

return {
groupId: 'metric',
Expand Down Expand Up @@ -581,15 +584,14 @@ export const getPieVisualization = ({

getVisualizationInfo(state: PieVisualizationState) {
const layer = state.layers[0];
const dimensions = [];
if (layer.metric) {
const dimensions: VisualizationInfo['layers'][number]['dimensions'] = [];

layer.metrics.forEach((metric) => {
dimensions.push({
id: layer.metric,
name: i18n.translate('xpack.lens.pie.groupsizeLabel', {
defaultMessage: 'Size by',
}),
id: metric,
name: metricLabel,
});
}
});

if (state.shape === 'mosaic' && layer.secondaryGroups && layer.secondaryGroups.length) {
layer.secondaryGroups.forEach((accessor) => {
Expand Down

0 comments on commit b240615

Please sign in to comment.