fix(bugs): fixing bugs for world map chart#38030
Conversation
Code Review Agent Run #b49483Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
…andrusoare/fix/world-map
Code Review Agent Run #755cc8Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
| .on('click', handleClick) | ||
| .on('mouseover', function onMouseOver() { | ||
| // Use namespaced events to avoid overriding Datamaps' default tooltip handlers | ||
| .on('mouseover.fillPreserve', function onMouseOver() { |
There was a problem hiding this comment.
Pretty cool we can do namespaced events with d3
|
This question isn’t related to the pull request. I can only help with questions about the PR’s code or comments. |
…andrusoare/fix/world-map
|
🎪 Showtime deployed environment on GHA for 2db22a4 • Environment: http://34.220.14.23:8080 (admin/admin) |
SUMMARY
This PR fixes two issues with the World Map chart:
TypeError: onContextMenu is not a function)Issue 1: Right-Click Error
Symptoms: Right-clicking on any country throws
TypeError: onContextMenu is not a functionRoot Cause: The
onContextMenuhook is called without a null check inWorldMap.ts. This hook is only provided when charts are rendered on a Dashboard with theDrillToDetailfeature flag enabled. In other contexts (e.g., Explore view),onContextMenuisundefined.Fix: Added defensive guard before calling
onContextMenu:Issue 2: Row Count Shows "0 rows"
Symptoms: Legacy charts display "0 rows" despite rendering data correctly
Root Cause: The frontend expects
sql_rowcountfrom query responses, but legacy charts (usinguseLegacyApi: true) only returnrowcount. Both values are computed identically in the backend (len(df.index)), but the legacy API inviz.pydoesn't includesql_rowcount.Fix: Updated frontend components to fall back to
rowcountwhensql_rowcountis unavailable:Impact: This fix benefits all 16 legacy chart plugins that use
useLegacyApi: true, not just World Map.Additional Fix: Country Tooltips Not Appearing
Context: The World Map chart has two tooltip systems - one for country shapes and one for bubbles. The bubble tooltips were working fine, but the country tooltips were broken.
Root Cause:
processedData(an array) instead ofmapData(a keyed object). Datamaps requires{USA: {...}, CAN: {...}}format to populate tooltip data.mouseover/mouseouthandlers that replaced Datamaps' built-in tooltip handlers instead of adding to them.Solution:
data: processedData→data: mapDatapopupTemplatecallbackmouseover.fillPreserve) to preserve Datamaps' handlersBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE
Screen.Recording.2026-02-17.at.14.37.36.mov
AFTER
Screen.Recording.2026-02-17.at.14.35.46.mov
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION