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

[Bug] Rich text in legend does not inherit color from legend configuration if theme specifies textStyle.color #18196

Closed
juliepagano opened this issue Jan 19, 2023 · 6 comments
Labels
bug difficulty: easy Issues that can be fixed more easily than the average. en This issue is in English topic: legend

Comments

@juliepagano
Copy link
Contributor

Version

5.4.1

Link to Minimal Reproduction

https://codepen.io/juliepagano_cs/pen/XWBzLaJ

Steps to Reproduce

  1. Open the codepen
  2. Note that the non-rich text in the legend is red (the value specified in legend.textStyle.color).
  3. Note that the rich text in the legend is green (the value specified in the theme's textStyle.color).
  4. Click an item in the legend.
  5. Note that the non-rich text in the legend is blue (the value specified in legend.inactiveColor).
  6. Note that the rich text in the legend is green (the value specified in the theme's textStyle.color).
  7. Comment out the textStyle.color in the theme and note that the rich and non-rich text match the legend configuration.

Current Behavior

When a chart's theme specifies textStyle.color, rich text within the legend configuration inherits from the theme's text color instead of the colors configured in the legend.

Expected Behavior

I would expect rich text within a legend to inherit from the legend's color configuration (legend.textStyle.color when active and legend.inactiveColor when inactive).

Environment

- OS: macOS Monterey
- Browser: Chrome 108.0.5359.124 
- Framework: the bug is not framework specific, but we are working in React

Any additional comments?

No response

@echarts-bot echarts-bot bot added en This issue is in English pending We are not sure about whether this is a bug/new feature. labels Jan 19, 2023
@helgasoft
Copy link

helgasoft commented Jan 20, 2023

Observations are correct, but an easy fix is to just set bold.color to 'red' instead of relying on inheritance.
Currently legend.textStyle.rich.bold.color inherits first from theme.textStyle.color, then from legend.textStyle.color and inactiveColor.
It should be the other way around.

@juliepagano
Copy link
Contributor Author

Observations are correct, but an easy fix is to just set bold.color to 'red' instead of relying on inheritance.

Guessing the strikethrough means you already inferred this, but clarifying just in case...

If you explicitly set a specific color in the rich text config, it cannot change to match the active/inactive colors set by legend.textStyle.color and legend.inactiveColor because it's hardcoded to a single value.

@Ovilia Ovilia added topic: legend difficulty: easy Issues that can be fixed more easily than the average. and removed pending We are not sure about whether this is a bug/new feature. labels Feb 1, 2023
@echarts-bot
Copy link

echarts-bot bot commented Feb 1, 2023

This issue is labeled with difficulty: easy.
@juliepagano Would you like to debug it by yourself? This is a quicker way to get your problem fixed. Or you may wait for the community to fix.

Please have a look at How to debug ECharts if you'd like to give a try. 🤓

@manishdait
Copy link
Contributor

If this issue is not fix till now, I would like to fix this issue

@ChepteaCatalin
Copy link
Contributor

ChepteaCatalin commented Mar 29, 2023

@manishdait have you checked #18260? It seems that this issue was fixed there a moth ago.

@manishdait
Copy link
Contributor

@ChepteaCatalin Sorry for that, The issue was not close therefore. I create that PR

@Ovilia Ovilia closed this as completed in 24c01c1 Apr 3, 2023
@Ovilia Ovilia removed this from the TBD milestone Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug difficulty: easy Issues that can be fixed more easily than the average. en This issue is in English topic: legend
Projects
None yet
Development

No branches or pull requests

5 participants