From 55fba70189653974600cc129ea7f1a5d395f36e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Mill=C3=A1n?= Date: Tue, 18 Jun 2024 15:22:04 +0200 Subject: [PATCH] Fix visualizations colors for more than 10 items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #5422 Signed-off-by: Eva Millán --- src/plugins/charts/public/services/colors/mapped_colors.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/charts/public/services/colors/mapped_colors.ts b/src/plugins/charts/public/services/colors/mapped_colors.ts index a6051bf2b30f..3fe8dc9006bb 100644 --- a/src/plugins/charts/public/services/colors/mapped_colors.ts +++ b/src/plugins/charts/public/services/colors/mapped_colors.ts @@ -106,9 +106,11 @@ export class MappedColors { }); // Choose colors from euiPaletteColorBlind and filter out any already assigned to keys + const rotations = Math.ceil(keys.length / 10); const colorPalette = euiPaletteColorBlind({ - rotations: Math.ceil(keys.length / 10), - direction: 'both', + rotations, + direction: rotations === 2 ? 'lighter' : 'both', + order: rotations > 2 ? 'middle-out' : 'append', }) .filter((color) => !alreadyUsedColors.includes(color.toLowerCase())) .slice(0, keysToMap.length);