anonyms opened a new issue, #45135:
URL: https://github.com/apache/superset/issues/45135

   ### Bug description
   
   In hierarchical Treemap charts (two or more dimensions), child nodes no 
longer
   inherit their parent's colour. Every node gets its own categorical colour 
from
   its own name, so the top-level grouping is not visible by colour at all. 
There
   is no control in Explore to change this; switching colour scheme only changes
   which colours are used.
   
   This makes the Treemap unsuitable for its main use case: seeing how a total 
is
   distributed across categories at a glance.
   
   **Expected behaviour**
   As in Superset <= 4.1.1 (and as in the Treemap thumbnail in the chart 
gallery):
   children are shaded in their parent's colour (ECharts `colorSaturation`), so
   each top-level category reads as one colour family.
   
   **How to reproduce**
   1. Create a Treemap with two dimensions, e.g. `state`, `city`, metric 
`SUM(population)`.
   2. Observe that cities in the same state have unrelated colours.
   3. Create the same Treemap with only `state`: states get their colours 
correctly.
   
   **Root cause**
   
`superset-frontend/plugins/plugin-chart-echarts/src/Treemap/transformProps.ts`
   
   Commit 90572be95 (#30646, "fix(Dashboard): Retain colors when color scheme 
not
   set", released in 4.1.2) moved `itemStyle.color: colorFn(name, sliceId)` from
   the non-leaf branch onto every node. Because leaf nodes now have an explicit
   colour, ECharts no longer derives their colour from the parent.
   
   Verified in the source: 4.1.1 sets the colour on parent nodes only; 4.1.2,
   4.1.3, 4.1.4, 6.1.0 and master set it on every node.
   
   **Suggested fix**
   Only set `itemStyle.color` on non-leaf nodes (the pre-4.1.2 behaviour), 
keeping
   `colorFn` for parents so the dashboard colour consistency from #30646 still
   applies. Optionally, add a control for "colour by: top-level category / each 
node".
   
   ### Screenshots/recordings
   
   **Left:** two-level Treemap (`state` → `city`, metric: population, US Census 
2020).
   Each state has a fixed colour set in the dashboard's label colours (e.g.
   California blue, Texas red). The cities should be shades of their state's
   colour, but each city gets its own unrelated colour, so you can't see which
   state a city belongs to.
   
   **Right:** the same data as a one-level Treemap (`state` only). The states 
get
   their assigned colours correctly, so the colour configuration itself works.
   It just isn't passed down to child nodes.
   
   <img width="3133" height="566" alt="Image" 
src="https://github.com/user-attachments/assets/ccc7f2fd-20fd-47a3-a53f-7f82998583c0";
 />
   
   ### Superset version
   
   6.1.0
   
   ### Python version
   
   3.11
   
   ### Node version
   
   18 or greater
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   - Follow-up to #36807, which was closed after the 1px gap part was fixed
     (#40181), with a request to re-report the colouring on a current release.
     This confirms it still happens on 6.1.0.
   - Running the official image via the Helm chart (0.22.8).
   - cc @geido   as author of #30646.
   
   ### 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to