Skip to content

Commit

Permalink
Fix visualizations colors for more than 10 items
Browse files Browse the repository at this point in the history
Fixes opensearch-project#5422

Signed-off-by: Eva Millán <[email protected]>
  • Loading branch information
evamillan committed Jun 18, 2024
1 parent 0db5848 commit 55fba70
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/plugins/charts/public/services/colors/mapped_colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 55fba70

Please sign in to comment.