diff --git a/changelogs/fragments/7051.yml b/changelogs/fragments/7051.yml new file mode 100644 index 000000000000..e60784860985 --- /dev/null +++ b/changelogs/fragments/7051.yml @@ -0,0 +1,2 @@ +fix: +- Fix colors of the visualizations with more than 10 items ([#7051](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7051)) \ No newline at end of file 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);