Skip to content

fix(gantt): prevent y-axis labels from being cut off - #39137

Merged
rusackas merged 8 commits into
apache:masterfrom
tushardhawas:fix-gantt-label-cutoff
Sep 12, 2026
Merged

rusackas merged 8 commits into
apache:masterfrom
tushardhawas:fix-gantt-label-cutoff

Conversation

@tushardhawas

@tushardhawas tushardhawas commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Fixes an issue where long y-axis labels in the Gantt chart were clipped and not fully visible.

The fix dynamically calculates the left grid padding based on the widest category label width, ensuring labels are not cut off regardless of length.

TESTING INSTRUCTIONS

  1. Open a Gantt chart with long category labels.
  2. Verify that y-axis labels are fully visible and not clipped.
  3. Confirm no layout regressions occur on other charts.

ADDITIONAL INFORMATION

tushardhawas and others added 2 commits April 6, 2026 17:50
Dynamically calculate left grid padding based on the widest category label width so long y-axis labels are no longer clipped.
@bito-code-review

bito-code-review Bot commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #4d05cf

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 07885cb..5ad2490
    • superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts
  • 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 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

@dosubot dosubot Bot added the viz:charts:echarts Related to Echarts label Apr 6, 2026
tushardhawas and others added 2 commits April 6, 2026 18:09
…formProps.ts


fix: remove label width clamp

Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
…formProps.ts


Previously, category labels were derived using a truthy check (`key ? String(key) : undefined`), which incorrectly treated valid falsy values like `0` and `false` as missing. This caused labels to not render and their widths to be excluded from grid padding calculation, leading to layout inconsistencies.

Updated the logic to explicitly check for `null` and `undefined`, ensuring all valid values are preserved as labels.

Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
@bito-code-review

bito-code-review Bot commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #f8a7d8

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 5ad2490..c55a3e4
    • superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts
  • 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 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

@codecov

codecov Bot commented Apr 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.14%. Comparing base (f490bf5) to head (da5fd1c).
⚠️ Report is 26 commits behind head on master.

Files with missing lines Patch % Lines
...s/plugin-chart-echarts/src/Gantt/transformProps.ts 85.71% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39137   +/-   ##
=======================================
  Coverage   80.14%   80.14%           
=======================================
  Files        2924     2924           
  Lines      172412   172425   +13     
  Branches    40031    40037    +6     
=======================================
+ Hits       138176   138188   +12     
- Misses      31651    31652    +1     
  Partials     2585     2585           
Flag Coverage Δ
javascript 75.66% <85.71%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rusackas

Copy link
Copy Markdown
Member

AI assisted review points below... I think most of this is minor polish, but I'd agree with at least addressing the safeLabelWidth naming redundancy and consider adding a comment explaining the 0.62 constant added.

  1. Canvas created but never cleaned up. A new element is created every time transformProps is called, but it's never appended to the DOM and there's no explicit cleanup. In modern browsers this is generally fine since it'll be GC'd, but it's slightly wasteful — a module-level singleton canvas could be reused.
  2. Font matching may not be exact. The font is set to ${theme.fontSizeSM}px ${theme.fontFamily}, but ECharts internally may render labels slightly differently (e.g., accounting for DPR, letter spacing, or font weight). The measured width should be close enough in practice, but labels with tight padding could still get slightly clipped on some systems.
  3. safeLabelWidth is just maxCategoryLabelWidth renamed. The variable safeLabelWidth is assigned directly from maxCategoryLabelWidth with no further transformation, which adds no value and slightly obscures the intent. This could be a leftover from a refactor.
  4. No padding budget / cap. If a label is extremely long (e.g., 500px), the left grid will just grow unboundedly. A reasonable max width or truncation strategy might be worth considering — though that might be a separate issue.
    Partial test coverage. Codecov flags 3 uncovered lines. Given the typeof document !== 'undefined' branch, it would be good to ensure the SSR/fallback path is tested.

@rusackas

Copy link
Copy Markdown
Member

@tushardhawas the approach is right, but the formatting got mangled. The borderLines/categoryLines block is dedented to column 0 and would never pass prettier. Run pre-commit to fix it, and double-check safeLabelWidth actually feeds the grid padding. Thanks!

@rusackas

rusackas commented Sep 9, 2026

Copy link
Copy Markdown
Member

safeLabelWidth does feed the grid, it sets grid.left so the y-axis labels don't get clipped, which is the whole point here. Formatting's the separate blocker though, that block's dedented to column zero and never got run through prettier. I'll get a cleanup pass pushed so this is easier to merge.

@pull-request-size pull-request-size Bot added size/S and removed size/M labels Sep 10, 2026
@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 9a54194
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aa2ee312127bb00090901c6
😎 Deploy Preview https://deploy-preview-39137--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@tushardhawas

Copy link
Copy Markdown
Contributor Author

Thanks @rusackas @justinpark @michael-s-molina ! Cleaned this up and updated the branch:

  • Fixed the indentation — the borderLines/categoryLines block was dedented to column 0; it's now back at the correct 2-space indent.
  • Reverted the accidental legend-block reformat so the diff only shows the intended change.
  • Dropped the redundant safeLabelWidth; grid.left now uses maxCategoryLabelWidth directly.
  • Added a comment explaining the 0.62 fallback constant (approximate label width used when canvas measurement isn't available, e.g. SSR).
  • Merged latest master in — branch is now up to date with no conflicts.

@netlify

netlify Bot commented Sep 10, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit da5fd1c
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6aa2f4ab5f701300087bf151
😎 Deploy Preview https://deploy-preview-39137--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@bito-code-review

bito-code-review Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #1bd139

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 07885cb..da5fd1c
    • superset-frontend/plugins/plugin-chart-echarts/src/Gantt/transformProps.ts
  • 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 an incremental AI Review.

  • /review full - 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

@rusackas
rusackas merged commit 8e69572 into apache:master Sep 12, 2026
82 checks passed
@rusackas

Copy link
Copy Markdown
Member

Thank you!

villebro pushed a commit that referenced this pull request Sep 16, 2026
Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
(cherry picked from commit 8e69572)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gantt chart y axis labels are cut off

2 participants