fix(world-map): exclude null and zero metric values from color scale#39926
fix(world-map): exclude null and zero metric values from color scale#39926massucattoj wants to merge 1 commit intoapache:masterfrom
Conversation
There was a problem hiding this comment.
Code Review Agent Run #74c8a4
Actionable Suggestions - 1
-
superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.ts - 1
- Bubble rendering inconsistency · Line 167-167
Review Details
-
Files reviewed - 2 · Commit Range:
22d80f1..22d80f1- superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.ts
- superset-frontend/plugins/legacy-plugin-chart-world-map/test/WorldMap.test.ts
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
| : () => theme.colorBorder; | ||
|
|
||
| processedData = filteredData.map(d => ({ | ||
| processedData = colorableData.map(d => ({ |
There was a problem hiding this comment.
The diff incorrectly filters processedData to only include colorableData (where m1 is not null and not zero), which excludes countries from bubble rendering even when they have valid m2 values for bubble size. Bubbles should render for all countries in filteredData. Additionally, fillColor should use theme.colorBorder for null/zero m1 to prevent scale colors, rather than relying on the nullish coalescing operator.
Code suggestion
Check the AI-generated fix before applying
- processedData = colorableData.map(d => ({
- ...d,
- radius: radiusScale(Math.sqrt(d.m2)),
- fillColor: colorFn(d.m1) ?? theme.colorBorder,
- }));
+ processedData = filteredData.map(d => ({
+ ...d,
+ radius: radiusScale(Math.sqrt(d.m2)),
+ fillColor: (d.m1 != null && d.m1 !== 0) ? colorFn(d.m1) : theme.colorBorder,
+ }));
Code Review Run #74c8a4
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
SUMMARY
When using the World Map chart with
Color by: Metric, countries with ametric value of
NULLor0were assigned a color from the linear scaleinstead of being treated as "no data".
NULLvalues often ended up renderedin the darkest shade of the palette, misleadingly suggesting a maximum
value, while
0values were colored as the scale minimum. Both should beindistinguishable from countries that don't appear in the dataset (rendered
in the default grey).
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:

After:

TESTING INSTRUCTIONS
"no data" grey, identical to other countries that do not appear in the
dataset.
ADDITIONAL INFORMATION