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
PieChart: Support row data in pie charts #34755
Conversation
Ok, added logic that makes color overrides added by the color picker work |
@@ -152,6 +152,13 @@ export const getFieldDisplayValues = (options: GetFieldDisplayValuesOptions): Fi | |||
} | |||
} | |||
|
|||
// Palette color modes use series index (field index) which does not work for when displaing rows | |||
// So updating seriesIndex here makes the palette color modes work in "All values" mode | |||
field.state = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: would it be worth to change this to something like field.state = setIndexForPaletteColor(field.state)
and move the code + comment into a small help function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work with this!
* PieChart: Support row data in pie chart * Make color override work * removed thing * Minor refactoring (cherry picked from commit 658cc5d)
It's very frustrating that the pie chart currently cannot visualize:
A few weeks ago we removed the "all values" option that is part of stat/gauge/bargauge. Because it does not work with palette based color schemes, setting manual color does not work
either as we can only color fields, not values.
One way would be to add a transform that pivots the data (Rows to fields). But that is a bit painful from a user / ease of use perspective. In this PR I tested a way to update seriesIndex to get unique auto colors. We could never support custom color selection with this mode.
With this PR
The thing that would be nice to add with this an auto mode that selects Calculate or All values based on the data using some heuristic.
Question is given that color picker will never work with the data in this form, should we skip this solution and explore a way for a panel add a transform? but how to make that easy to use? Or panel edit to suggest a transform?
Updated so that color picker created overrides does work. They will say "not found" in panel edit but this feels ok