superset icon indicating copy to clipboard operation
superset copied to clipboard

Cannot set color scheme for dashboard-associated chart even when dashboard color scheme is cleared

Open jonhoo opened this issue 1 year ago • 11 comments

Once a chart is associated with a dashboard, it is no longer possible to change its color scheme. In the customize panel, the color scheme dropdown displays the warning:

The color scheme is determined by the related dashboard. Edit the color scheme in the dashboard properties.

And disabled the dropdown via this code: https://github.com/apache/superset/blob/594d3e0e0c4add06c1216490c63cdc6ac43e2f5a/superset-frontend/src/explore/components/controls/ColorSchemeControl/index.tsx#L111-L121

However, if the dashboard does not have a color scheme selected (or it's been cleared), the chart's color scheme is still respected (you can see this by selecting a color scheme for a chart before assigning it to a dashboard without a color scheme). In this situation, it does make sense to change the chart's color scheme, and so the dropdown shouldn't be disabled (the warning could still be shown though).

How to reproduce the bug

  1. Create a chart not associated with any dashboard
  2. Set its color scheme to something that's not the default.
  3. Create a dashboard. Do not set its color scheme (or set it to "" in the JSON config).
  4. Add the chart to the dashboard. Notice that it still renders with the chosen color scheme.
  5. Go to the chart's "Customize" tab. Notice that you cannot change its color scheme (nor is its current color scheme shown).

Expected results

Since the dashboard has no color scheme set, and the chart's color scheme is thus used, I expect to be able to change it.

Actual results

I am unable to change the chart's color scheme except by removing it from the dashboard, changing the color scheme, and adding it back.

Environment

(please complete the following information):

  • browser type and version: Firefox 112.0.1.
  • superset version: Hosted custom build, so I'm not 100% sure. I think it's close to master.
  • python version: Hosted, so unknown.
  • node.js version: Hosted, so unknown.
  • any feature flags active: Hosted, so unknown.

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • [x] I have reproduced the issue with at least the latest released version of superset.
  • [x] I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

I can't for the life of me find the exact point in the code where dashboard color scheme is chosen over the chart color scheme when the former is set, but I'm pretty sure that code is going to show that if the dashboard color scheme is unset (or ""), then the chart color scheme will be used.

jonhoo avatar Apr 28 '23 22:04 jonhoo