From e5b40bbb1c8804ef853ac408b7c15a5744ce8e08 Mon Sep 17 00:00:00 2001 From: Krzysztof Kowalczyk Date: Mon, 18 Nov 2024 12:55:06 +0100 Subject: [PATCH] [Lens] Prefer pie over donut. Keep donut if donut already (#199735) ## Summary This PR makes it so `pie` is used over `donut` as default suggestion. If something is a `donut` already, adding another ring won't switch to `pie`. Closes: #101289 --- .../partition/suggestions.test.ts | 2 +- .../visualizations/partition/suggestions.ts | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts b/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts index 60a7aed1c9274..b848e0c44922e 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/suggestions.test.ts @@ -668,7 +668,7 @@ describe('suggestions', () => { ).toContainEqual( expect.objectContaining({ state: { - shape: PieChartTypes.DONUT, + shape: PieChartTypes.PIE, palette, layers: [ { diff --git a/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts b/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts index 0e66291c068da..4654ce73d8157 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts +++ b/x-pack/plugins/lens/public/visualizations/partition/suggestions.ts @@ -39,20 +39,18 @@ function shouldReject({ table, keptLayerIds, state }: SuggestionRequest = { title: i18n.translate('xpack.lens.pie.suggestionLabel', { defaultMessage: '{chartName}',