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

Dashboard: Add series color shades #61300

Merged
merged 12 commits into from
Apr 13, 2023

Conversation

jkraml-staffbase
Copy link
Contributor

Add color option "Shades of a color" which gives each series a color derived from a user-selected base color.

What is this feature?

Add a color option "Shades of a color" to give series a similar (but not identical) color.

E.g. Let's say I have a CPU-usage metric for all my k8s pods. I would like to make the series for backend pods blue and the one for database pods yellow. But I don't want them to be the same color so that I can still differentiate between them visually.

Why do we need this feature?

To give groups of series a similar color. Currently they can only be assigned the same color or be colored by value.

Who is this feature for?

People designing dashboards.

Which issue(s) does this PR fix?:

Fixes #4555

Special notes for your reviewer:

Add color option "Shades of a color" which gives each series a color derived from a user-selected base color.
Describe color option "Shades of a color" in documentation.
@grafanabot grafanabot added area/frontend pr/external This PR is from external contributor labels Jan 11, 2023
@jkraml-staffbase
Copy link
Contributor Author

jkraml-staffbase commented Jan 11, 2023

What do I need to do to accept the CLA?

edit: done, CLAassistant took care of it

@CLAassistant
Copy link

CLAassistant commented Jan 11, 2023

CLA assistant check
All committers have signed the CLA.

Fall back to a gray color if the configured color cannot be parsed.
@jkraml-staffbase jkraml-staffbase marked this pull request as ready for review January 12, 2023 13:34
@jkraml-staffbase jkraml-staffbase requested review from a team as code owners January 12, 2023 13:34
@jkraml-staffbase jkraml-staffbase requested a review from a team January 12, 2023 13:34
@jkraml-staffbase jkraml-staffbase requested a review from a team as a code owner January 12, 2023 13:34
@grafanabot
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@grafanabot grafanabot added the stale Issue with no recent activity label Feb 18, 2023
@jkraml-staffbase jkraml-staffbase requested review from a team and Eve832 as code owners February 24, 2023 16:13
Copy link
Member

@axelavargas axelavargas left a comment

Choose a reason for hiding this comment

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

Hey @jkraml-staffbase 😄 ,

Thank you for your valuable contribution to Grafana 🙌🏾 . I've had a chance to review your PR and I think the feature makes sense.

I've noticed that adding the new option to the color scheme field works really well with timeseries panels. Here's an example of what I mean:

image

However, I've also observed that the shades are less noticeable in other visualizations, like this one:

image

That being said, I would love to get some feedback from the @grafana/dataviz-squad. I believe they could provide better insights into how useful this option would be for different visualizations.

Copy link
Contributor

@nmarrs nmarrs left a comment

Choose a reason for hiding this comment

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

This feature seems reasonable / useful - @leeoniya interested in your thoughts on this feature / option. Is something similar to this possible with an override or should this maybe be an override instead of an additional standard option?

@nmarrs
Copy link
Contributor

nmarrs commented Mar 9, 2023

Hi @jkraml-staffbase, thanks for this contribution! I have included this PR on our squads grooming review list - once reviewed we will provide an update on how we will proceed with this PR / feature request.

@jkraml-staffbase
Copy link
Contributor Author

@axelavargas oh, you're right. I admit, I only tried it with timeseries.

@nmarrs cool, thanks for letting me know

@grafanabot
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 2 weeks if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@grafanabot grafanabot added stale Issue with no recent activity and removed stale Issue with no recent activity labels Apr 10, 2023
Copy link
Collaborator

@imatwawana imatwawana left a comment

Choose a reason for hiding this comment

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

One small nit for the docs, but otherwise looks good in that regard!

@zoltanbedi zoltanbedi removed their request for review April 12, 2023 07:50
@jkraml-staffbase
Copy link
Contributor Author

jkraml-staffbase commented Apr 13, 2023

@nmarrs Hi, any news on reviewing this PR?

@torkelo
Copy link
Member

torkelo commented Apr 13, 2023

@jkraml-staffbase pushed an update, sorry if I messed things up. I think the changes make sense but please tweak it further.

I removed all the custom color parsing as we already use a color manipulation lib in tinycolor2 that can handle att that. I changed and simplified the logic a bit by using tinycolor2 and also added a tiny bit of color hue spin to create more slight share difference

@torkelo
Copy link
Member

torkelo commented Apr 13, 2023

Demo dashboard
Screenshot from 2023-04-13 18-22-27

@nmarrs nmarrs added add to changelog no-backport Skip backport of PR labels Apr 13, 2023
@nmarrs nmarrs added this to the 10.0.0 milestone Apr 13, 2023
Copy link
Contributor

@nmarrs nmarrs left a comment

Choose a reason for hiding this comment

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

I'm happy with this, especially with the refactoring via tinycolor lib as I wasn't as comfortable with us owning the custom logic 👍

@jkraml-staffbase let us know if you're good with the refactor, after that in my opinion this is ready to be merged -> degree of shade variance can always be tweaked in future PRs based on wider community feedback. Great job on this contribution! ⭐

@leeoniya
Copy link
Contributor

looks like shaded by value, but isn't 🤯. works well for lines, but imo not so well for filled viz regions 🤷

@jkraml-staffbase
Copy link
Contributor Author

@torkelo cool, thanks for the changes, I wasn't aware of that dependency

@nmarrs totaly cool with it 👍

@nmarrs nmarrs merged commit 8d6314c into grafana:main Apr 13, 2023
alexmobo pushed a commit that referenced this pull request Apr 14, 2023
* Dashboard: Add series color shades

Add color option "Shades of a color" which gives each series a color derived from a user-selected base color.

* Documentation: Add entry for color shades

Describe color option "Shades of a color" in documentation.

* Chore: formatting fixes

* Dashboard: Use better fallback color for color shades in fieldColor.ts

Fall back to a gray color if the configured color cannot be parsed.

* Chore: fix typo in fieldColor.test.ts

* Documentation: fix a sentence

* remove custom color parsing and change logic a bit

* Fix prettier issue

---------

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
Co-authored-by: nmarrs <nathanielmarrs@gmail.com>
Co-authored-by: Kristina Durivage <kristina.durivage@grafana.com>
@zerok zerok modified the milestones: 10.0.0, 10.0.0-preview May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FR: Add color shades to series