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

Allow specifying opacity for color mappings #85

Closed
wants to merge 3 commits into from

Conversation

mrubli
Copy link

@mrubli mrubli commented Jun 30, 2020

This allows visually appealing (in my eyes) graphs like these without having to resort to CSS hacks:
opacity

@TheGreatRefrigerator
Copy link
Collaborator

Hey @mrubli,

are you sure you want that as a mapping for each segment?
I would put it as a general option to add opacity to every segment.

Or do you have an example, where it would be needed to have one part of the graph in a different opacity like :
grafik

@mrubli
Copy link
Author

mrubli commented Jul 1, 2020

@TheGreatRefrigerator Hmm, fair point. I don't personally have such a use case, but it could be useful in certain scenarios:

  • artistic reasons: perhaps different colors look slightly better with different opacities when implementing a given color theme
  • (de)emphasize data: certain parts of the data could quickly be hidden or made less obvious, e.g. because they contain low quality or uninteresting data

The opacity being part of the mapping would also fit nicely if other design attributes were added in the future (e.g. hatching).

That being said, making the opacity global would be perfectly fine as well. Let me implement the version with a global option to see what it would look like.

Perhaps other people could also comment on reasons for one way or the other?

@mrubli
Copy link
Author

mrubli commented Jul 1, 2020

Ok, I've pushed a draft of what a global option would look like. I made it a bit more general, allowing to control more than just the overall opacity, allowing things like this:

image

It might be nice to even generalize mappings.color to mappings.style.

Copy link
Collaborator

@TheGreatRefrigerator TheGreatRefrigerator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really better this way ^^
You can add it to the example.js and create a CHANGELOG entry (under Unreleased) if you want.
If not i will merge and do that after lunch.
👍

@TheGreatRefrigerator
Copy link
Collaborator

@mrubli
Copy link
Author

mrubli commented Jul 1, 2020

I was having dinner myself. Thanks for taking care of that! I'll close the PR then.

@mrubli mrubli deleted the feature/graph-opacity branch July 1, 2020 14:10
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

Successfully merging this pull request may close these issues.

2 participants