You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "alex-poor (via GitHub)" <gi...@apache.org> on 2026/06/05 03:44:50 UTC

[I] Deck.gl Polygon legend labels share endpoints (cosmetic / ambiguous range labels) [superset]

alex-poor opened a new issue, #40786:
URL: https://github.com/apache/superset/issues/40786

   ### Bug description
   
   The deck.gl **Polygon** chart legend renders bucket labels with **shared endpoints**, so consecutive bins appear to overlap. With default settings (no manual break points), the legend shows e.g.:
   
   ```
   1 - 81
   81 - 212
   212 - 369
   ```
   
   Every interior breakpoint (`81`, `212`, …) appears in **two** adjacent labels — once as an upper bound, once as a lower bound — which reads as overlapping ranges and is confusing.
   
   **This is a cosmetic / UX-clarity issue, not a correctness bug.** The underlying binning and coloring are correct: colors are assigned with d3's `scaleThreshold`, which treats each breakpoint as a half-open cut point, so a value of exactly `81` lands in exactly one bucket (`81–212`). No polygon is double-counted or mis-colored. Only the legend *label text* is ambiguous.
   
   ### Root cause
   
   In `superset-frontend/plugins/preset-chart-deckgl/src/utils.ts`, `getBuckets()` builds each label by pairing adjacent breakpoints:
   
   ```js
   const range = `${breakPoints[i]} - ${breakPoints[i + 1]}`;
   ```
   
   This always reuses each interior breakpoint in two labels. The color scale (`getBreakPointColorScaler`, same file) uses `scaleThreshold`, which is half-open and unambiguous — so the labels misrepresent the (correct) bucketing logic.
   
   ### Scope
   
   - Affects the deck.gl **Polygon** layer only — it is the only chart in the frontend that renders a **discrete numeric-range legend** (`scaleThreshold` appears nowhere else in `superset-frontend`).
   - Country Map / World Map avoid this by using a **continuous linear color scale** with no discrete-range legend.
   - ECharts charts use **categorical** legends (names, not ranges), so they are unaffected.
   - Independent of the `Number of buckets` vs `Bucket break points` controls — setting explicit break points changes *where* the bins are, but labels still share endpoints.
   
   ### Expected behavior
   
   Legend bins should read as a clean, non-overlapping partition. There is no existing internal convention to match (Polygon is the only discrete-range legend), so candidate formats:
   
   1. **Edge-operator notation** (common GIS/choropleth convention — ArcGIS, Datawrapper): `< 81`, `81 – 212`, `212 – 369`, `> 369`
   2. **Interval notation:** `[1, 81)`, `[81, 212)`, `[212, 369]`
   3. **Render the boundary number once between touching swatches** (gradient-bar style) rather than as isolated `a - b` rows.
   
   > Note: simply incrementing the lower bound (`82 - 212`) is *not* correct in general — breakpoints and metric values can be fractional, so a value like `81.5` would fall into a labeling gap.
   
   ### How to reproduce
   
   1. Create a deck.gl **Polygon** chart with a numeric metric.
   2. Leave **Bucket break points** empty (use default **Number of buckets**).
   3. Observe the legend — adjacent bins share endpoints (`1 - 81`, `81 - 212`, …).
   
   ### Superset version
   
   master / latest (also observed on 5.0+).
   
   ### Related (different) issues
   
   - #34747 — legend *limits* miscalculated (rounding the max bound); a separate, already-fixed bug.
   - #7264, #35142 — other deck.gl legend fixes; none address label formatting.
   
   No existing open issue/PR covers the shared-endpoint label formatting.
   


-- 
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.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: [I] Deck.gl Polygon legend labels share endpoints (cosmetic / ambiguous range labels) [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #40786: Deck.gl Polygon legend labels share endpoints (cosmetic / ambiguous range labels)
URL: https://github.com/apache/superset/issues/40786


-- 
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: [I] Deck.gl Polygon legend labels share endpoints (cosmetic / ambiguous range labels) [superset]

Posted by "rabumaabraham (via GitHub)" <gi...@apache.org>.
rabumaabraham commented on issue #40786:
URL: https://github.com/apache/superset/issues/40786#issuecomment-4644094434

   Hi, I'm working on this issue and will submit a PR soon. Please assign it to me if possible, thanks!


-- 
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: [I] Deck.gl Polygon legend labels share endpoints (cosmetic / ambiguous range labels) [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on issue #40786:
URL: https://github.com/apache/superset/issues/40786#issuecomment-4633816920

   @dosubot help debug this


-- 
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: [I] Deck.gl Polygon legend labels share endpoints (cosmetic / ambiguous range labels) [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #40786:
URL: https://github.com/apache/superset/issues/40786#issuecomment-4633836575

   <!-- Answer -->
   Here's the full debug breakdown of the shared-endpoint label issue:
   
   **The problematic code** is in `getBuckets()` at `superset-frontend/plugins/preset-chart-deckgl/src/utils.ts` [[1]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.ts#L179-L180):
   
   ```typescript
   breakPoints.slice(1).forEach((_, i) => {
     const range = `${breakPoints[i]} - ${breakPoints[i + 1]}`;
     ...
   });
   ```
   
   This pairs adjacent breakpoints directly, so for breakpoints `[1, 81, 212, 369]` you get `"1 - 81"`, `"81 - 212"`, `"212 - 369"` — each interior value appears in two labels.
   
   **The color scale** uses D3's `scaleThreshold` [[2]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.ts#L87-L166), which creates left-inclusive / right-exclusive intervals:
   
   - `[1, 81)` → color 0
   - `[81, 212)` → color 1
   - `[212, 369]` → color 2
   
   So a value of exactly `81` lands in bucket 2, not bucket 1. The bucketing is correct; only the labels are ambiguous.
   
   **Breakpoint generation** (`getBreakPoints`, [[3]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.ts#L42-L85)) computes evenly spaced values using `(startValue + i * delta).toFixed(precision)`, where precision is derived from `Math.ceil(Math.log10(1 / delta))`. These can be fractional strings, which is why a naive "lower + 1" fix doesn't generalize.
   
   **Legend rendering** — the `formatCategoryLabel` function [[4]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-deckgl/src/components/Legend.tsx#L85-L97) splits each range on `" - "` and formats each number, then the Legend component renders them as color-swatch rows [[5]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-deckgl/src/components/Legend.tsx#L103-L119).
   
   **A minimal fix** would be localized to `getBuckets()`. For example, using the edge-operator notation proposed in the issue:
   
   ```typescript
   breakPoints.slice(1).forEach((_, i) => {
     let range: string;
     if (i === 0) {
       range = `< ${breakPoints[i + 1]}`;
     } else if (i === breakPoints.length - 2) {
       range = `≥ ${breakPoints[i]}`;
     } else {
       range = `${breakPoints[i]} - ${breakPoints[i + 1]}`;
     }
     ...
   });
   ```
   
   However, this would also require updating `formatCategoryLabel` in the Legend component since it currently splits on `" - "` to format the numbers. The interval notation (`[1, 81)`) would be more semantically precise and wouldn't require changes to the delimiter-based formatting — you'd just need to ensure the brackets don't get stripped.
   
   The relevant files for a fix are:
   
   1. `superset-frontend/plugins/preset-chart-deckgl/src/utils.ts` — label generation [[6]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.ts)
   2. `superset-frontend/plugins/preset-chart-deckgl/src/CategoricalDeckGLContainer.tsx` — legend rendering [[7]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-deckgl/src/components/Legend.tsx)
   3. `superset-frontend/plugins/preset-chart-deckgl/src/layers/Polygon/Polygon.tsx` — where `getBuckets` is called [[8]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.tsx)
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
   
   ---
   
   Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset).
   
   [![Leave Feedback](https://img.shields.io/badge/Leave%20Feedback-555555?style=flat)](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=0052af27-367b-4f94-8d62-d46b6935d822) [![Learn about superset with Dosu](https://img.shields.io/badge/Learn%20about%20superset%20with%20Dosu-2f7b3f?style=flat&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iODYiIGhlaWdodD0iODkiIHZpZXdCb3g9IjAgMCA4NiA4OSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0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VY3LjYxNTMyWk00MC43MDQgNy42MTUzMkg0Mi41ODA1Vi02LjU3OTE5SDQwLjcwNFY3LjYxNTMyWiIgZmlsbD0iYmxhY2siIG1hc2s9InVybCgjZG9zdS1kLWN1dG91dCkiLz48cGF0aCBkPSJNNjguOTIxNSAzNi4wMTM1QzY4LjkyMTUgMzYuMDEzNSA2NS43MzY5IDQ5LjQ3MzggNTEuNDIzMSA0OS40NzM4QzM3LjEwOTMgNDkuNDczOCAzMi41Nzg3IDM3LjM1OTYgMzIuNTc4NyAzNi4wMTM1IiBzdHJva2U9ImJsYWNr
 IiBzdHJva2Utd2lkdGg9IjcuNjkxNjEiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjxwYXRoIGQ9Ik0wLjM0ODYzMyA4NS40OTQ2QzAuMzQ4NjMzIDg1LjQ5NDYgMjkuNDg1NiA4NS44MzA5IDM0LjgwOSA4NS42OThDNDQuODMzNyA4NS40NDc3IDUxLjI4NzIgODQuNDAyIDU3LjUyNjkgNzguOTcyNEM2Mi44MTI5IDc0LjM3MjcgNzUuMTM0MiA1OS42ODM2IDc1LjEzNDIgNTkuNjgzNiIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSI2LjE2NDgyIi8%2BPC9zdmc%2B)](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [![Add Dosu to your team](https://img.shields.io/badge/Add%20Dosu%20to%20your%20team-1f6feb?style=flat)](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset)


-- 
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