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

Chart displays incorrect colors for data #6158

Closed
ickisIckis opened this issue Apr 2, 2024 · 2 comments
Closed

Chart displays incorrect colors for data #6158

ickisIckis opened this issue Apr 2, 2024 · 2 comments
Assignees

Comments

@ickisIckis
Copy link

问题描述

Hello,
While working with g2plot, we have observed that the charts display incorrect colors for the data. Although the colors may appear similar, the hex values are different.

重现链接

No response

重现步骤

Open any chart (for example https://g2plot.antv.antgroup.com/en/examples/more-plots/waterfall/#custom-color).
Use any color picker from the browser page to select a color, check the hex value, and compare it with the hex value passed to the 'color' property - they are different.

预期行为

The hex value of the displayed color is the same as the one passed to the options.

平台

  • 操作系统: [macOS, Windows]
  • 网页浏览器: [Google Chrome, Firefox]

屏幕截图或视频(可选)

Screenshot 2024-04-02 091403

补充说明(可选)

In our project, we are utilizing web-safe colors, and from this perspective, maintaining the correct hex value of a color is quite important. We verified this using a color picker with a lens, and consistently found it to be incorrect at each point. Additionally, we checked these colors on a plain canvas, where they appeared as the correct colors we had assigned. It seems that the g2plot process may be altering the colors in some way (perhaps through the use of filters?).

@xiaoiver
Copy link
Contributor

xiaoiver commented Apr 9, 2024

It's because of the default theme of G2 will apply fillOpacity to 0.95.
You can set the value of this style property to 1 like this:

chart.style('fillOpacity', 1);

DEMO: https://codesandbox.io/p/sandbox/bar-diverging-stacked-7m7g9k?file=%2Findex.js%3A53%2C1-54%2C1

@ickisIckis
Copy link
Author

Thank you, this is really helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants