Bug description

For a number of my pie charts across multiple Superset instances, I am seeing an issue where unique rows are assigned the same color as others (although there are other colors available in my Dashboard scheme).

This issue is reproduced consistently every time that I refresh the chart, either in edit mode or shown on a dashboard.

This appears to be the same issue reported as https://github.com/apache/superset/issues/31368. But as requested there, I am re-filing since the issue is taking place on 4.x.x.

I am not using any CSS templates or any custom dashboard palette overwrites.

Screenshots/recordings

Image

Superset version

4.1.2

Python version

3.9

Node version

16

Browser

Chrome

Additional context

  • The charts are set to use Dashboard Scheme, which is "Superset Colors" for my instances.
  • I do not have any relevant feature flags set.

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

Hello @rudokemper! I'm Dosu, a bot here to help you solve bugs, answer questions, and guide you in becoming a contributor. I'm ready to assist you while you wait for a human maintainer.

In Superset version 4.1.2, the color assignment logic for pie charts involves several steps, including checking for a dashboard color scheme, maintaining shared and custom label colors, and mapping unique labels to colors. If there are more unique values than available colors, the system recycles colors, which might be causing the issue you're experiencing [1][2].

To address this, ensure that your dashboard or chart is not inadvertently using a limited color scheme. You can specify a different color scheme in the formData object to see if it resolves the issue:

formData={{
  colorScheme: 'supersetColors', // or another available scheme
  // other properties
}}

Additionally, check if the UseAnalogousColors feature flag is enabled, as it can generate analogous colors to expand the available color range [3]. If the issue persists, it might be related to a bug in the color assignment logic, as noted in the GitHub issue you referenced.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Comment From: rusackas

Are you able to replicate this with an example chart/dataset/dashboard so we can have reproducible steps on our end?

Comment From: geido

Is that 1 and 5 or 3 and 4 on the Pie being used by other charts in the same origin Dashboard?

Comment From: rudokemper

Are you able to replicate this with an example chart/dataset/dashboard so we can have reproducible steps on our end?

I will try. Sorry for delay. With a newborn on my side.

Is that 1 and 5 or 3 and 4 on the Pie being used by other charts in the same origin Dashboard?

Yes, that is the case:

Image

These values are used across a number of charts, shown here and also in other tabs (blurred out for privacy).

Weirdly enough, when I went to check earlier, via the "Preset" color scheme, there were distinct colors for all values. But I changed back to "Superset" (as per the screenshot above) to see if it was specific to that color scheme, but now I have the issue with "Preset" too:

Image

Comment From: rusackas

Hopefully your kiddo is coming along well and you're getting some sleep! If you do indeed have more time now, we'd LOVE to see/try an example we can reproduce using example datasets/dashboards/charts on current master or in 5.0.0. If not, we might have to close this out as inactionable, even if I believe you that it's an issue.

Comment From: rudokemper

Hey, thanks! We're 5 months along so at least sleep is getting a little better ;)

Would it work to give you access to a Superset dashboard where you can see this in action?

Or if not, could I export some of the superset metastore db tables for you?