You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rebenitez1802 (via GitHub)" <gi...@apache.org> on 2026/03/13 14:55:53 UTC
[PR] fix(color): ensure createLinearScale always returns a color for null/NaN input [superset]
rebenitez1802 opened a new pull request, #38631:
URL: https://github.com/apache/superset/pull/38631
### SUMMARY
`SequentialScheme.createLinearScale()` returns a d3 `scaleLinear` that returns `undefined` for `null`, `undefined`, and `NaN` inputs. This causes missing fill colors in charts when metric values are nullable.
This fix uses d3's built-in `.unknown()` method to set a fallback color (`this.colors[0]`) so the scale **always returns a valid color string**. This fixes the issue upstream rather than requiring every caller to add `?? fallback` guards.
**Affected plugins** (7 callers of `createLinearScale`):
| Plugin | Had its own guard? |
|---|---|
| WorldMap | Yes (`??`) |
| CountryMap | Yes (`??` + fallback fn) |
| Calendar | Yes (fallback fn) |
| Sunburst | **No** — likely had same bug |
| ParallelCoordinates | Partial |
| DeckGL Heatmap | Indirect |
| DeckGL utils | No |
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — behavioral fix, no UI changes.
### TESTING INSTRUCTIONS
1. Create a World Map chart with sequential (metric-based) coloring
2. Include data where some country metric values are `NULL`
3. Verify all countries render with a valid fill color (previously some appeared without fill)
4. Run `npm run test -- --testPathPatterns="SequentialScheme"` — 3 new tests for null/NaN/undefined
5. Run `npm run test -- --testPathPatterns="WorldMap"` — 3 new end-to-end tests
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
Related: #38602 (WorldMap-specific fix with caller-side guard)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(color): ensure createLinearScale always returns a color for null/NaN input [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #38631: fix(color): ensure createLinearScale always returns a color for null/NaN input
URL: https://github.com/apache/superset/pull/38631
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(color): ensure createLinearScale always returns a color for null/NaN input [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38631:
URL: https://github.com/apache/superset/pull/38631#issuecomment-4055768693
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(color): ensure createLinearScale always returns a color for null/NaN input [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #38631:
URL: https://github.com/apache/superset/pull/38631#issuecomment-4724850223
Shall we close this out? Seems like it's not being actively worked on.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(color): ensure createLinearScale always returns a color for null/NaN input [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #38631:
URL: https://github.com/apache/superset/pull/38631#issuecomment-5040322550
Closing this out, doesn't look like it's being actively worked on. Most of the callers already guard against null/NaN on their own anyway. Happy to reopen/revisit if you want to push it through.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org