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

[FEATURE] Legend.Item Transparency on Disabled #4438

Open
seddonm1 opened this issue Jun 27, 2017 · 5 comments
Open

[FEATURE] Legend.Item Transparency on Disabled #4438

seddonm1 opened this issue Jun 27, 2017 · 5 comments

Comments

@seddonm1
Copy link

Current Behavior

When a user clicks on a legend item currently a strikethrough effect is placed through the text of that legend item and the coloured box of the legend item remains unchanged.

Possible Solution

I have done a quick proof-of-concept (which could easily be incorporated into the main repo) which changes the alpha channel on the existing box and text colours to increase the transparency.

The questions are:

  • Is this feature considered useful by the community?
  • If so, should there be additional configuration options exposed (preferred) so a user can provide dataset.disabledBackgroundColor, dataset.disabledBorderColor and legend.labels.disabledFontColor at the expense of adding additional configuration options or should it be guessed?
@etimberg
Copy link
Member

@seddonm1 an interesting idea would be to add a single callback function that returns the styles to apply when disabled. This would mean that we wouldn't need to add a lot of different individual options. @simonbrunel thoughts?

@tucq88
Copy link

tucq88 commented Mar 9, 2018

I think it's pretty useful as :

  • Developers should make Charts UI align with system style for consistency, so they should able to change disable style to lower Opacity, adding icon... or just simple styling
  • A callback is safer and easier for developers making custom changes, as providing options can't fit all cases

Currently there's only way allows us to change Legend style on filtering (as hidden) is to extend Legend, as well guided here, but this way need to copy a lot code from ChartJS core so it's not stable when core getting changed.

@etimberg
Copy link
Member

This can be done by overriding the generateLabels callback. https://jsfiddle.net/1npmkjr6/1/

@kurkle not sure if we want that function to control the text colour as well

@kurkle
Copy link
Member

kurkle commented Feb 21, 2021

Another option would be to implement the color as scriptable / label.

@etimberg
Copy link
Member

If I wanted to make a ton of changes, I would do that and remove the LegendItem concept (same with tooltips) and replace with better contexts. Not sure that's worth it now

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

No branches or pull requests

4 participants