-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visualizations with different colors #6095
Comments
Related to: opensearch-project/OpenSearch-Dashboards#5422 |
The default colors of charts are defined by OpenSearch Dashboards in https://github.com/opensearch-project/OpenSearch-Dashboards/blob/2.10.0/src/plugins/charts/public/services/colors/mapped_colors.ts#L109-L112 |
The darker and lighter colors appear when the results of the visualization are more than 10, this causes the standard colors could not be used. Reducing the aggregation size could mitigate the problems with the colors. @yenienserrano found this workaround doesn't work for any visualizations whose possible results are more than 10 as: In this screenshot, the colors assigned for the labels |
We have raised the OpenSearch bug in their repository and they are currently working on it. We have continued our research to find a solution to fix the bug. Assigning colours to dynamic data #5838 (comment) |
@asteriscos tried to use |
Video related to assigning colors to visualizations: https://youtu.be/U8by9Qikkhg?si=SerRIpbt8668h-Cj&t=497 |
A possible solution to the problem could be to overwrite the function that sets the colors of the graphs in our application with a few modifications.
alreadyUsedColors.push(...Object.values(this._mapping));
alreadyUsedColors = alreadyUsedColors.map(color =>
color.toLocaleLowerCase(),
);
const colorPalette = euiPaletteColorBlind({
rotations: Math.ceil(
(keysToMap.length + alreadyUsedColors.length) / 10,
),
direction: core.uiSettings.get('theme:darkMode') ? 'darker' : 'lighter',
})
.filter(color => !alreadyUsedColors.includes(color.toLowerCase()))
.slice(0, keysToMap.length); This causes, as labels are added to the visualizations, the color palette to expand and, depending on the theme, display light or dark colors in the graphics. I share a patch with the changes: paletteColor.txt |
I share a new patch that fixes the error in the colours of the visualisations: |
Description
Some visualizations use darker colors than the standard ones. This behavior happens at different "random" moments without apparent cause.
Preconditions
1.
Steps to reproduce
Expected Result
Actual Result
Screenshots
The text was updated successfully, but these errors were encountered: