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). [](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) [](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) [](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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
