You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/07/30 08:02:48 UTC
[PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
rusackas opened a new pull request, #42610:
URL: https://github.com/apache/superset/pull/42610
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
In a horizontal, stacked, row-contribution (100%) bar chart, some segments could vanish from the render entirely even though the underlying percentages were correct and summed to 100%.
The row-contribution axis max was hard-coded to exactly `1`. Contribution shares are normalized so a stacked row is supposed to sum to `1`, but floating point rounding can push the actual stacked total fractionally above `1` (e.g. `1.0000000000000002`). When that happens, capping the axis max at exactly `1` causes echarts to clip the topmost stacked segment entirely on the swapped axis used for horizontal bars, instead of just rounding the pixel width. This lines up with the community's own workaround of nudging "Truncate Y Axis" max to `1.00001`, which happened to sidestep the same edge case.
This PR pads the axis max up to the actual stacked total when it exceeds `1`, so no segment gets clipped, while leaving the `0`-`1` default in place for the (much more common) case where the total is exactly `1` or below.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — this is a floating point edge case in axis-bounds calculation; see the reproduction and screenshots already on the issue.
### TESTING INSTRUCTIONS
1. Build a horizontal, stacked bar chart with contribution mode = Row over a dataset with several small groupby segments per category, using the SQL repro attached to #30914.
2. Reload the chart a few times; before this fix, the same segment goes missing on certain categories on every load. After the fix, all segments render.
3. `pytest`-equivalent for the frontend: `npm run test -- plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts` — new test `should not clip small segments when row-contribution percentages float above 1 in horizontal stacked bar charts` pins the regression.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #30914
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #42610:
URL: https://github.com/apache/superset/pull/42610#discussion_r3709809085
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -688,7 +688,35 @@ export default function transformProps(
// default to 0-100% range when doing row-level contribution chart
if ((contributionMode === 'row' || isAreaExpand) && stack) {
if (yAxisMin === undefined) yAxisMin = 0;
- if (yAxisMax === undefined) yAxisMax = 1;
+ if (yAxisMax === undefined) {
+ if (contributionMode === 'row') {
+ // Contribution percentages are normalized so each stacked row should
+ // sum to 1, but floating point rounding can push the actual stacked
+ // total fractionally above 1 (e.g. 1.0000000000000002). Hard-capping
+ // the axis max at exactly 1 in that case causes echarts to clip the
+ // topmost stacked segment entirely rather than just rounding the
+ // pixel width, which is most visible in horizontal orientation where
+ // this axis is swapped onto the x-axis. Pad the max up to the actual
+ // stacked total when it exceeds 1 so no segment gets clipped.
+ //
+ // This padding only applies in row-contribution mode: for an Expand
+ // ("100% stacked") chart, `sortedTotalValues` holds the raw,
+ // pre-normalization row totals (e.g. 100), not values near 1, so
+ // padding against them here would stretch the axis out to the raw
+ // total instead of the intended 0-1 range.
+ const stackedTotalMax = sortedTotalValues.reduce<number>(
+ (max, v) =>
+ typeof v === 'number' && !Number.isNaN(v) ? Math.max(max, v) : max,
+ Number.NEGATIVE_INFINITY,
+ );
+ yAxisMax =
Review Comment:
Good catch — the padding was computed from `sortedTotalValues`, which sums every column per row regardless of stack. Fixed to compute the max per ECharts stack instead, with a test covering row-contribution + time_compare.
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42610:
URL: https://github.com/apache/superset/pull/42610#issuecomment-5176784351
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42610:
URL: https://github.com/apache/superset/pull/42610#issuecomment-5128211483
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #42610:
URL: https://github.com/apache/superset/pull/42610#issuecomment-5135347142
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 23cfc0ef6dca66e9316a7286d2c7cf36175adae8 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a6ba54736a37100080871d8 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-42610--superset-docs-preview.netlify.app](https://deploy-preview-42610--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#q1YqKMrPLShRslJS0lFKKkrMS84AstMyK_Qzi4tLU3WNDSwNTXTT8nNy8stLC4BqUlILcvIrPVOAqswSzZISTU3Mjc0Sjc0NDQwMLAwszA1TLJRqAQ) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-42610--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #42610:
URL: https://github.com/apache/superset/pull/42610#discussion_r3681050724
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -688,7 +688,25 @@ export default function transformProps(
// default to 0-100% range when doing row-level contribution chart
if ((contributionMode === 'row' || isAreaExpand) && stack) {
if (yAxisMin === undefined) yAxisMin = 0;
- if (yAxisMax === undefined) yAxisMax = 1;
+ if (yAxisMax === undefined) {
+ // Contribution percentages are normalized so each stacked row should
+ // sum to 1, but floating point rounding can push the actual stacked
+ // total fractionally above 1 (e.g. 1.0000000000000002). Hard-capping
+ // the axis max at exactly 1 in that case causes echarts to clip the
+ // topmost stacked segment entirely rather than just rounding the
+ // pixel width, which is most visible in horizontal orientation where
+ // this axis is swapped onto the x-axis. Pad the max up to the actual
+ // stacked total when it exceeds 1 so no segment gets clipped.
+ const stackedTotalMax = Math.max(
+ ...sortedTotalValues.filter(
+ (v): v is number => typeof v === 'number' && !Number.isNaN(v),
+ ),
+ );
Review Comment:
**Suggestion:** Calling `Math.max` with every value spread as a function argument can throw a `RangeError` once a large query returns more values than the JavaScript argument limit. This new path runs for row-contribution and expanded charts even when the later horizontal data-bounds path is disabled. Compute the maximum incrementally with `reduce` or a loop instead of spreading the entire dataset. [possible bug]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Large stacked chart transformations can throw RangeError.
- ❌ ECharts options are not produced for affected queries.
- ⚠️ Row-contribution and expanded charts fail during rendering.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=2ec3c13655a9472f861aca6053b4d33f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=2ec3c13655a9472f861aca6053b4d33f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
**Line:** 700:704
**Comment:**
*Possible Bug: Calling `Math.max` with every value spread as a function argument can throw a `RangeError` once a large query returns more values than the JavaScript argument limit. This new path runs for row-contribution and expanded charts even when the later horizontal data-bounds path is disabled. Compute the maximum incrementally with `reduce` or a loop instead of spreading the entire dataset.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42610&comment_hash=8be580e84e3b349c3247088584ba30abed62c0433bb1d30ae02cf409ff34bee4&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42610&comment_hash=8be580e84e3b349c3247088584ba30abed62c0433bb1d30ae02cf409ff34bee4&reaction=dislike'>👎</a>
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42610:
URL: https://github.com/apache/superset/pull/42610#issuecomment-5179334121
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #42610:
URL: https://github.com/apache/superset/pull/42610#discussion_r3685635786
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -688,7 +688,25 @@ export default function transformProps(
// default to 0-100% range when doing row-level contribution chart
if ((contributionMode === 'row' || isAreaExpand) && stack) {
if (yAxisMin === undefined) yAxisMin = 0;
- if (yAxisMax === undefined) yAxisMax = 1;
+ if (yAxisMax === undefined) {
+ // Contribution percentages are normalized so each stacked row should
+ // sum to 1, but floating point rounding can push the actual stacked
+ // total fractionally above 1 (e.g. 1.0000000000000002). Hard-capping
+ // the axis max at exactly 1 in that case causes echarts to clip the
+ // topmost stacked segment entirely rather than just rounding the
+ // pixel width, which is most visible in horizontal orientation where
+ // this axis is swapped onto the x-axis. Pad the max up to the actual
+ // stacked total when it exceeds 1 so no segment gets clipped.
+ const stackedTotalMax = Math.max(
+ ...sortedTotalValues.filter(
+ (v): v is number => typeof v === 'number' && !Number.isNaN(v),
+ ),
+ );
+ yAxisMax =
+ Number.isFinite(stackedTotalMax) && stackedTotalMax > 1
Review Comment:
Good catch, @sadpandajoe. Limited the padding to row-contribution mode now, since sortedTotalValues holds the raw pre-normalization totals for Expand stacks. Expand still gets the flat 1 max, pushed with a test for both cases.
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #42610:
URL: https://github.com/apache/superset/pull/42610#issuecomment-5128357698
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/42610?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `85.71429%` with `1 line` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 65.33%. Comparing base ([`673f928`](https://app.codecov.io/gh/apache/superset/commit/673f9285892dd09b5b3a0bfa24a4fa844b918266?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a0b6b96`](https://app.codecov.io/gh/apache/superset/commit/a0b6b962450f8efb0ea4e5a4a42dd5070da01c2e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/42610?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...gin-chart-echarts/src/Timeseries/transformProps.ts](https://app.codecov.io/gh/apache/superset/pull/42610?src=pr&el=tree&filepath=superset-frontend%2Fplugins%2Fplugin-chart-echarts%2Fsrc%2FTimeseries%2FtransformProps.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvVGltZXNlcmllcy90cmFuc2Zvcm1Qcm9wcy50cw==) | 85.71% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/42610?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #42610 +/- ##
=======================================
Coverage 65.33% 65.33%
=======================================
Files 2803 2803
Lines 158490 158496 +6
Branches 36178 36182 +4
=======================================
+ Hits 103557 103561 +4
- Misses 52922 52924 +2
Partials 2011 2011
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/42610/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/42610/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `71.47% <85.71%> (-0.01%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/42610?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #42610:
URL: https://github.com/apache/superset/pull/42610#discussion_r3708284242
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -688,7 +688,35 @@ export default function transformProps(
// default to 0-100% range when doing row-level contribution chart
if ((contributionMode === 'row' || isAreaExpand) && stack) {
if (yAxisMin === undefined) yAxisMin = 0;
- if (yAxisMax === undefined) yAxisMax = 1;
+ if (yAxisMax === undefined) {
+ if (contributionMode === 'row') {
+ // Contribution percentages are normalized so each stacked row should
+ // sum to 1, but floating point rounding can push the actual stacked
+ // total fractionally above 1 (e.g. 1.0000000000000002). Hard-capping
+ // the axis max at exactly 1 in that case causes echarts to clip the
+ // topmost stacked segment entirely rather than just rounding the
+ // pixel width, which is most visible in horizontal orientation where
+ // this axis is swapped onto the x-axis. Pad the max up to the actual
+ // stacked total when it exceeds 1 so no segment gets clipped.
+ //
+ // This padding only applies in row-contribution mode: for an Expand
+ // ("100% stacked") chart, `sortedTotalValues` holds the raw,
+ // pre-normalization row totals (e.g. 100), not values near 1, so
+ // padding against them here would stretch the axis out to the raw
+ // total instead of the intended 0-1 range.
+ const stackedTotalMax = sortedTotalValues.reduce<number>(
+ (max, v) =>
+ typeof v === 'number' && !Number.isNaN(v) ? Math.max(max, v) : max,
+ Number.NEGATIVE_INFINITY,
+ );
+ yAxisMax =
Review Comment:
With `time_compare`, `sortedTotalValues` combines multiple independently normalized stacks, so one comparison sets this maximum to 2 and makes every 100% bar occupy only half the plot. Could this bound be computed per ECharts stack and covered with a row-contribution + `time_compare` test?
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #42610:
URL: https://github.com/apache/superset/pull/42610
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42610:
URL: https://github.com/apache/superset/pull/42610#issuecomment-5128253143
<!-- Bito Reply -->
The flagged issue is correct. Using the spread operator (`...`) with `Math.max` on a large array can exceed the maximum number of arguments allowed by the JavaScript engine, leading to a `RangeError`. To resolve this, you should replace the spread operator with a `reduce` function to calculate the maximum value incrementally.
Here is the corrected implementation for the logic in `superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts`:
```typescript
const stackedTotalMax = sortedTotalValues.reduce((max, v) => {
if (typeof v === 'number' && !Number.isNaN(v)) {
return Math.max(max, v);
}
return max;
}, -Infinity);
```
I have checked the available PR comments, and there are no other review comments to address. Would you like me to proceed with any other tasks?
**superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts**
```
const stackedTotalMax = sortedTotalValues.reduce((max, v) => {
if (typeof v === 'number' && !Number.isNaN(v)) {
return Math.max(max, v);
}
return max;
}, -Infinity);
```
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #42610:
URL: https://github.com/apache/superset/pull/42610#discussion_r3684861608
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -688,7 +688,25 @@ export default function transformProps(
// default to 0-100% range when doing row-level contribution chart
if ((contributionMode === 'row' || isAreaExpand) && stack) {
if (yAxisMin === undefined) yAxisMin = 0;
- if (yAxisMax === undefined) yAxisMax = 1;
+ if (yAxisMax === undefined) {
+ // Contribution percentages are normalized so each stacked row should
+ // sum to 1, but floating point rounding can push the actual stacked
+ // total fractionally above 1 (e.g. 1.0000000000000002). Hard-capping
+ // the axis max at exactly 1 in that case causes echarts to clip the
+ // topmost stacked segment entirely rather than just rounding the
+ // pixel width, which is most visible in horizontal orientation where
+ // this axis is swapped onto the x-axis. Pad the max up to the actual
+ // stacked total when it exceeds 1 so no segment gets clipped.
+ const stackedTotalMax = Math.max(
+ ...sortedTotalValues.filter(
+ (v): v is number => typeof v === 'number' && !Number.isNaN(v),
+ ),
+ );
+ yAxisMax =
+ Number.isFinite(stackedTotalMax) && stackedTotalMax > 1
Review Comment:
For expanded stacks, `sortedTotalValues` still contains the pre-normalization row totals, so a row totaling 100 now renders normalized 0–1 values against a 0–100 axis and occupies only 1% of the plot. Could this padding be limited to row contribution, or computed from the normalized series, so expanded stacks keep their 100% scale?
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #42610:
URL: https://github.com/apache/superset/pull/42610#discussion_r3685634573
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -688,7 +688,25 @@ export default function transformProps(
// default to 0-100% range when doing row-level contribution chart
if ((contributionMode === 'row' || isAreaExpand) && stack) {
if (yAxisMin === undefined) yAxisMin = 0;
- if (yAxisMax === undefined) yAxisMax = 1;
+ if (yAxisMax === undefined) {
+ // Contribution percentages are normalized so each stacked row should
+ // sum to 1, but floating point rounding can push the actual stacked
+ // total fractionally above 1 (e.g. 1.0000000000000002). Hard-capping
+ // the axis max at exactly 1 in that case causes echarts to clip the
+ // topmost stacked segment entirely rather than just rounding the
+ // pixel width, which is most visible in horizontal orientation where
+ // this axis is swapped onto the x-axis. Pad the max up to the actual
+ // stacked total when it exceeds 1 so no segment gets clipped.
+ const stackedTotalMax = Math.max(
+ ...sortedTotalValues.filter(
+ (v): v is number => typeof v === 'number' && !Number.isNaN(v),
+ ),
+ );
Review Comment:
Good catch, swapped the spread for a reduce so a big series cant blow the argument limit.
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -688,7 +688,25 @@ export default function transformProps(
// default to 0-100% range when doing row-level contribution chart
if ((contributionMode === 'row' || isAreaExpand) && stack) {
if (yAxisMin === undefined) yAxisMin = 0;
- if (yAxisMax === undefined) yAxisMax = 1;
+ if (yAxisMax === undefined) {
+ // Contribution percentages are normalized so each stacked row should
+ // sum to 1, but floating point rounding can push the actual stacked
+ // total fractionally above 1 (e.g. 1.0000000000000002). Hard-capping
+ // the axis max at exactly 1 in that case causes echarts to clip the
+ // topmost stacked segment entirely rather than just rounding the
+ // pixel width, which is most visible in horizontal orientation where
+ // this axis is swapped onto the x-axis. Pad the max up to the actual
+ // stacked total when it exceeds 1 so no segment gets clipped.
+ const stackedTotalMax = Math.max(
+ ...sortedTotalValues.filter(
+ (v): v is number => typeof v === 'number' && !Number.isNaN(v),
+ ),
+ );
Review Comment:
Good catch, swapped the spread for a reduce so a big series can't blow the argument limit.
--
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: [PR] fix(explore): pin and fix clipped segments in horizontal row-contribution stacked bar charts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42610:
URL: https://github.com/apache/superset/pull/42610#issuecomment-5136921842
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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