Skip to content
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

Closed
asteriscos opened this issue Nov 3, 2023 · 9 comments · Fixed by #6099
Closed

Visualizations with different colors #6095

asteriscos opened this issue Nov 3, 2023 · 9 comments · Fixed by #6099
Assignees
Labels
level/task Task issue type/bug Bug issue

Comments

@asteriscos
Copy link
Member

Wazuh Rev Browser
X.Y.Z xyzw Chrome, Firefox, Safari, etc

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

  1. Navigate to any Dashboard

Expected Result

  1. All visualizations should use the same colors

Actual Result

  1. Some visualization use darker colors

Screenshots
image

@asteriscos asteriscos added type/bug Bug issue level/task Task issue labels Nov 3, 2023
@wazuhci wazuhci moved this to Backlog in Release 4.8.0 Nov 3, 2023
@wazuhci wazuhci moved this from Backlog to In progress in Release 4.8.0 Nov 3, 2023
@chantal-kelm chantal-kelm self-assigned this Nov 3, 2023
@gdiazlo
Copy link
Member

gdiazlo commented Nov 3, 2023

@chantal-kelm chantal-kelm linked a pull request Nov 7, 2023 that will close this issue
6 tasks
@Desvelao
Copy link
Member

Desvelao commented Nov 14, 2023

@Desvelao
Copy link
Member

Desvelao commented Nov 15, 2023

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:
image. We could replace the visualization definition taking in account this limitation.

In this screenshot, the colors assigned for the labels 3 and Brute force are the same ones.

@Desvelao
Copy link
Member

Desvelao commented Nov 15, 2023

OSD 2.10.0 Dashboard app: same colors for different labels
image

Wazuh 4.6.0: different color for different label
image

OSD 2.8.0 Dashboard app: different color for different label
image

@chantal-kelm
Copy link
Member

chantal-kelm commented Nov 15, 2023

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)

@Desvelao
Copy link
Member

Desvelao commented Nov 15, 2023

@Desvelao
Copy link
Member

Video related to assigning colors to visualizations: https://youtu.be/U8by9Qikkhg?si=SerRIpbt8668h-Cj&t=497

@yenienserrano
Copy link
Member

yenienserrano commented Nov 16, 2023

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.
Modifications:

  • Adding the already mapped colors to the alreadyUsedColors variable.
      alreadyUsedColors.push(...Object.values(this._mapping));
  • Change the data of the alreadyUsedColors variable to lowercase
      alreadyUsedColors = alreadyUsedColors.map(color =>
        color.toLocaleLowerCase(),
      );
  • Change the values of the object passed to the euiPaletteColorBlind function. For this:
      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

Screenshots

image

image

image

@chantal-kelm
Copy link
Member

I share a new patch that fixes the error in the colours of the visualisations:

patch.txt

image (9)

@asteriscos asteriscos self-assigned this Nov 22, 2023
@wazuhci wazuhci moved this from In progress to Done in Release 4.8.0 Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/bug Bug issue
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants