Skip to content

Conversation

@Facyla
Copy link

@Facyla Facyla commented Dec 18, 2025

User description

SUMMARY

Add a JSON-based customization block that allows to override linearColorScheme colors and thresholds with custom thresholds and colors.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

image

TESTING INSTRUCTIONS

  • Paste a sample customization in "Custom Color Scale": the linearScheme is overrided, resulting in the customized Color Scheme to apply.
    [ { "percent": 0, "color": "white" }, { "percent": 0.01, "color": "#FF0000AA" }, { "percent": 20, "color": "#FA0" }, { "percent": 50, "color": "#FF0" }, { "percent": 65, "color": "#9F0" }, { "percent": 99.99, "color": "#000A" }, { "percent": 100, "color": "black" } ]
    The inline help provides a sample configuration that can also be copied/pasted (with some cleaning and lines returns).

  • Edit sample values to adjust to the map needs: the changes appear immediately on map

    • update thresholds with values in percentage; decimal values allowed (eg. 0.001): the color will be applied from that lower limit up to the next one
    • adjust colors, using any valid CSS color, including named colors (red, green, etc.), rgb and hex codes, with or without transparency. A color selector helps visually choosing the color value
    • add or remove thresholds to fit your needs
  • The provided configuration requires a full valid JSON, including brackets, commas except for the last line, quoted keys and quoted values for color codes.

ADDITIONAL INFORMATION

  • Has associated issue: Implement custom formatting similar to Table Chart into Country Map plugin #34427
  • Required feature flags:
  • Changes UI: add a new control
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

CodeAnt-AI Description

Allow custom percent-based color scales for CountryMap and add a color picker

What Changed

  • Users can paste a JSON list of percent/color entries in a new "Custom Color Scale (by %)" textarea to override the map's linear color scheme; the map immediately uses those thresholds and colors.
  • A new color picker control provides an easy way to pick a color and copy its HEX into the custom scale.
  • The chart now tolerates malformed or missing inputs: invalid JSON, invalid colors, or non-numeric metrics fall back to safe defaults and won't break rendering; identical metric values map to a central color.
  • If no valid custom scale is provided, the existing linear color scheme is used as before.

Impact

✅ Clearer thematic maps with user-defined thresholds
✅ Immediate visual feedback when editing color scales
✅ Fewer rendering errors from invalid custom color inputs

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:L This PR changes 100-499 lines, ignoring generated files label Dec 18, 2025
@codeant-ai-for-open-source
Copy link
Contributor

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • d3 API compatibility
    The new code uses d3.scale.linear() and d3.geo.path(). If the project uses a different major d3 version (v4+), these APIs are deprecated/renamed (d3.scaleLinear, d3.geoPath). Verify d3 version compatibility to avoid runtime errors.

  • Empty color handling
    The sample configuration in the PR description allows an empty string for a color (e.g., "") to denote transparency, but normalizeColorKeyword currently treats empty strings as invalid and falls back to #000000. This will map empty colors to black rather than transparent/none which is likely not intended.

  • DOM-only API use
    normalizeColorKeyword calls new Option() to validate named CSS colors. This relies on a browser DOM being present; tests or server-side execution without a DOM will throw. Consider guarding or using a safer check to avoid runtime errors in non-browser environments.

  • Prop name mismatch
    The component uses customColorScale from props but PropTypes defines customColorRules. This mismatch means prop type validation won't match the real prop and consumers may pass the wrong prop name. Ensure the prop name is consistent in PropTypes and in the function signature.

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI finished reviewing your PR.

Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #d66de9

Actionable Suggestions - 2
  • superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js - 2
Additional Suggestions - 3
  • superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.js - 1
    • Convert JS to TS for type safety · Line 27-27
      This JavaScript file should be converted to TypeScript to align with codebase standards that prohibit new JavaScript files and require type safety. The added customColorScale parsing logic is correct but would benefit from TypeScript types for better maintainability.
  • superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js - 2
    • Outdated CSS color regexes · Line 57-60
      The regexes for CSS color functions only match comma-separated syntax (e.g., rgb(255, 0, 0)), but modern CSS supports space-separated syntax (e.g., rgb(255 0 0)). This could cause valid modern color strings to be rejected as invalid, falling back to '#000000'.
    • Unused function (dead code) · Line 78-89
      The rgbaToHex function is defined but never called in the codebase. While it might be intended for future color handling, removing it now keeps the code clean and avoids maintenance overhead.
Review Details
  • Files reviewed - 3 · Commit Range: ca2e1b8..30fcc46
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.js
  • 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 Default Agent You can customize the agent settings here or contact your Bito workspace admin at [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Dec 24, 2025

Code Review Agent Run #3475b2

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 30fcc46..ade8c16
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.js
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

@Facyla
Copy link
Author

Facyla commented Dec 24, 2025

Hi,
PR has been updated to sync PR with the 6.0.0 release: no conflict.

@rusackas
Copy link
Member

rusackas commented Jan 3, 2026

Running CI!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds customizable color scales to the CountryMap plugin, allowing users to define custom color thresholds based on percentage values. The feature enables more flexible thematic map visualizations by letting users override the default linear color scheme with JSON-configured breakpoints and colors.

Key Changes:

  • Added JSON-based custom color scale configuration that accepts percent/color pairs for precise threshold control
  • Introduced a color picker control to help users select and identify HEX color codes
  • Implemented robust error handling for invalid JSON, malformed color values, and edge cases in metric data

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
transformProps.js Parses and validates the custom color scale JSON configuration, passing sanitized data to the chart component
controlPanel.ts Adds two new controls: a TextArea for JSON color scale input and a ColorPicker for color selection assistance
CountryMap.js Implements core logic for custom color scale processing, including color validation, data normalization, and fallback handling for both custom and linear color schemes

@codeant-ai-for-open-source
Copy link
Contributor

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@Facyla
Copy link
Author

Facyla commented Jan 7, 2026

Hi,
PR updated:

  1. Synced with master as of 2026-01-07 morning commit cedc35e
  2. Fixed pre-commit issue (a redundant newline)

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 7, 2026

Code Review Agent Run #89823c

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: ade8c16..63c7506
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.js
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

…CountryMap.js

Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
@netlify
Copy link

netlify bot commented Jan 28, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit ea4c0fe
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/697a2d5829274100086d87d2
😎 Deploy Preview https://deploy-preview-36732--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

…CountryMap.js

Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
@netlify
Copy link

netlify bot commented Jan 28, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 4daf361
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/697a2d8beccb190008fe0362
😎 Deploy Preview https://deploy-preview-36732--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Facyla and others added 2 commits January 28, 2026 16:45
…transformProps.js

Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
@Facyla
Copy link
Author

Facyla commented Jan 28, 2026

Hi @rusackas and dear reviewers/mainteainers

I'm struggling to keep this PR in sync with master branch and handling AI bot comments that are pretty relevant, but tend to introduce more complexity than it should.
This is the 2nd PR, initial PR became unreadable so i created this one to keep the changes readable/reviewable - as they only are made in a plugin folder, and in very few files.
These AI reviews are interesting and quite powerful, but not easy to handle from an organizational point of view (and a little perturbing because there is non consistence into the recommendations which sometimes complexify things, then protest against that move).

Goal here is not to provide a fancy UI or too much guidance for end-users, but to give more control on chloropleth map rendering for advanced map creators.

I hope these latest changes might help making advance into integrating this into the project :)

Yours

Copy link
Contributor

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #32187a

Actionable Suggestions - 1
  • superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js - 1
Review Details
  • Files reviewed - 3 · Commit Range: 63c7506..3e81051
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/controlPanel.ts
    • superset-frontend/plugins/legacy-plugin-chart-country-map/src/transformProps.js
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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 [email protected].

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines +163 to +165
.interpolate(function (a, b) {
return a;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken interpolator function

The interpolate method must return an interpolator function, not a value. Returning 'a' directly will cause a TypeError when d3 calls it with a parameter t, breaking color scaling for custom color rules.

Code suggestion
Check the AI-generated fix before applying
Suggested change
.interpolate(function (a, b) {
return a;
});
.interpolate(function (a, b) {
return function(t) { return a; };
});

Code Review Run #32187a


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugins size/L size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants