-
Notifications
You must be signed in to change notification settings - Fork 14k
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
feat: improve color consistency #17792
Conversation
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.
Hey @stephenLYZ thanks for working on this hard problem. Please read my comment. I am open to discuss this further.
superset-frontend/packages/superset-ui-core/src/color/CategoricalColorNamespace.ts
Outdated
Show resolved
Hide resolved
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.
For testing purposes, used the virtual table as Dataset. We can see different value of column
has different color:
SELECT * FROM
(SELECT 'a' as color, 1 as val
UNION
SELECT 'b', 1
UNION
SELECT 'c', 1
UNION
SELECT 'd', 1
UNION
SELECT 'e', 1
UNION
SELECT 'f', 1
UNION
SELECT 'g', 1
UNION
SELECT 'h', 1
UNION
SELECT 'i', 1
UNION
SELECT 'j', 1
UNION
SELECT 'k', 1
UNION
SELECT 'l', 1
UNION
SELECT 'm', 1
UNION
SELECT 'n', 1
UNION
SELECT 'o', 1
UNION
SELECT 'p', 1
UNION
SELECT 'q', 1
UNION
SELECT 'r', 1
UNION
SELECT 's', 1
UNION
SELECT 't', 1
UNION
SELECT 'u', 1
UNION
SELECT 'v', 1
UNION
SELECT 'w', 1
UNION
SELECT 'x', 1
UNION
SELECT 'y', 1
UNION
SELECT 'z', 1
) as _view
ORDER BY COLOR
- Create virtual dataset in the SQLLab.
- Create a Pie Chart 1)
count(*)
as metric 2)color
as groupby 3)a,b,c
in filter, save as new chart and create a dashboard. - Create a Pie Chart 1)
count(*)
as metric 2)color
as groupby 3)d,e,f
in filter, save as new chart and insert into previous dashboard.
In this PR
Current master(19daf65)
You are right @zhaoyongjie that's because this PR brings back sharing the same color instance across all the charts of a dashboard, as I mentioned in a comment above. However, @stephenLYZ said that is for testing only, so I assume it will be reverted soon. |
@geido I have actually reverted. 😂 I believe this PR should behave as expected. Since the column(label) of the second chart is different from the first one, they may not share the same color. |
@stephenLYZ but they have the same number of series, they should use the available colors of the color scheme from first to last, individually. What @zhaoyongjie is showing in master is the correct and expected behaviour afaik. |
superset-frontend/plugins/plugin-chart-echarts/src/Treemap/transformProps.ts
Show resolved
Hide resolved
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.
Hey @stephenLYZ there is a lot of improvement that went into this. I am curious to see this in action. Do you think is it a good time to spin up a test env?
superset-frontend/src/explore/components/ExploreChartHeader/index.jsx
Outdated
Show resolved
Hide resolved
I think it's okay and even though I didn't add tinyColor to resolve the color conflict, I don't think it gets in the way of the overall flow logic |
Great. Let's make CI pass so that we can spin up the test env and start testing 🥳 |
Codecov Report
@@ Coverage Diff @@
## master #17792 +/- ##
=======================================
Coverage 66.58% 66.58%
=======================================
Files 1641 1641
Lines 63533 63535 +2
Branches 6424 6424
=======================================
+ Hits 42303 42305 +2
Misses 19551 19551
Partials 1679 1679
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
c5be449
to
94b0f3a
Compare
Ephemeral environment shutdown and build artifacts deleted. |
/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true FEATURE_DASHBOARD_CROSS_FILTERS=true FEATURE_ENABLE_EXPLORE_DRAG_AND_DROP=true FEATURE_ENABLE_DND_WITH_CLICK_UX=true FEATURE_UX_BETA=true |
@geido Ephemeral environment spinning up at http://52.10.94.201:8080. Credentials are |
Hey @stephenLYZ I think I found a rather impactful issue. Superset.mp4 |
/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true FEATURE_DASHBOARD_CROSS_FILTERS=true FEATURE_ENABLE_EXPLORE_DRAG_AND_DROP=true FEATURE_ENABLE_DND_WITH_CLICK_UX=true FEATURE_UX_BETA=true |
@geido Ephemeral environment spinning up at http://54.187.201.134:8080. Credentials are |
Hey @stephenLYZ I found that two labels within the same chart share exactly the same color. This reminded me of the color conflict resolution requirements that I think we skipped to prioritize testing looking at the threads above. What do you think? |
Discussion result with @geido : |
Just for the sake of clarity, I am adding a bit more info here. Let's say that we have Chart A and Chart B that share two labels. The same color for both labels would be set, but now Chart B has an adjacent label that also uses the same color. That's the main color conflict we need to resolve here. The solution that Stephen is proposing above, generates new colors for the I think the solution works on paper, but I'd like to hear feedback from @rusackas @zhaoyongjie @jinghua-qa |
cc53c94
to
e6bee06
Compare
Ephemeral environment shutdown and build artifacts deleted. |
/testenv up FEATURE_DASHBOARD_NATIVE_FILTERS=true FEATURE_DASHBOARD_CROSS_FILTERS=true FEATURE_ENABLE_EXPLORE_DRAG_AND_DROP=true FEATURE_ENABLE_DND_WITH_CLICK_UX=true FEATURE_UX_BETA=true |
@geido Ephemeral environment spinning up at http://54.185.16.118:8080. Credentials are |
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
This PR improves the existing color consistency. The main optimization is that in a dashboard if a color scheme is set for the dashboard (either in the color scheme select or via the metadata editor), all charts in the dashboard with the same label have the same color, while other labels are generated in the normal color scheme order.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
before
after
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION