You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "s1ny1998 (via GitHub)" <gi...@apache.org> on 2026/08/11 14:40:32 UTC

[PR] fix(echarts): only reserve left grid padding when a Y-axis title exists [superset]

s1ny1998 opened a new pull request, #43064:
URL: https://github.com/apache/superset/pull/43064

   ### SUMMARY
   
   On mobile, timeseries charts render with a large blank strip on the left: the plot area starts roughly a third of the way into the card, well outside the tick labels.
   
   The cause is in `getPadding()` (`plugins/plugin-chart-echarts/src/Timeseries/transformers.ts`):
   
   ```ts
   left:
     yAxisTitlePosition === 'Left'
       ? TIMESERIES_CONSTANTS.gridOffsetLeft + (Number(yAxisTitleMargin) || 0)
       : TIMESERIES_CONSTANTS.gridOffsetLeft,
   ```
   
   The Y-axis title margin is added whenever the title position is `'Left'`, without checking that a title is actually rendered. The control defaults (`sections/chartTitle.tsx`) are position `'Left'` and margin `50`, so every chart with an empty `y_axis_title` — the default — reserves `20 + 50 = 70px` on the left. Because `grid.containLabel` is enabled, that reservation sits *outside* the axis labels, so it is pure dead space.
   
   The guard already exists: callers compute `addYAxisTitleOffset = !!yAxisTitle && convertInteger(yAxisTitleMargin) !== 0`, and the `'Top'` position branch consumes it. Only the `'Left'` branch ignored it.
   
   Changes:
   
   - Gate the left title margin on `addYAxisTitleOffset`. Charts with a Y-axis title keep exactly the spacing they have today; charts without one reclaim 50px of plot area.
   - `Gantt/transformProps.ts` hardcoded `false` for that flag at both `getPadding()` call sites while relying on the `'Left'` branch for its left padding, so it now computes the flag properly and passes it to both. Without this, Gantt charts that do have a title would lose their title padding.
   - Add a `getPadding()` unit test for the no-title case.
   
   Affected chart families: Timeseries (line/bar/area/scatter/smooth), Mixed Timeseries, Box Plot, Gantt. Bubble already passed `true` unconditionally and is unchanged.
   
   This is negligible on wide desktop charts and very visible on narrow ones, which is why it surfaced in mobile consumption mode.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   _Before:_ plot area begins ~95px into a ~320px-wide mobile chart (70px reserved margin + tick-label width), leaving the series squeezed into the right portion of the card.
   
   _After:_ only `gridOffsetLeft` (20px) plus the tick-label width is reserved, and the series fills the card.
   
   ### TESTING INSTRUCTIONS
   
   1. Open any timeseries line chart on a dashboard and leave **Customize → Chart Title → Y Axis Title** empty (the default).
   2. View the dashboard at a mobile width (~390px). The plot area should start just after the Y-axis tick labels, with no blank strip before them.
   3. Set a **Y Axis Title** with position `Left` and a non-zero margin. The reserved space returns and the rotated title renders inside it, unchanged from before.
   4. Repeat step 3 with position `Top` to confirm top spacing is untouched.
   5. Check a Gantt chart both with and without a Y-axis title.
   
   Unit tests:
   
   ```
   npm run test -- plugins/plugin-chart-echarts/test
   ```
   
   56 suites / 655 tests pass, including the new `getPadding` case.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] 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(echarts): only reserve left grid padding when a Y-axis title exists [superset]

Posted by "s1ny1998 (via GitHub)" <gi...@apache.org>.
s1ny1998 commented on PR #43064:
URL: https://github.com/apache/superset/pull/43064#issuecomment-5292602311

   @sadpandajoe Was this not needed? 
   


-- 
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(echarts): only reserve left grid padding when a Y-axis title exists [superset]

Posted by "s1ny1998 (via GitHub)" <gi...@apache.org>.
s1ny1998 commented on PR #43064:
URL: https://github.com/apache/superset/pull/43064#issuecomment-5262548005

   Waiting on @rusackas for approval. Hence marked as draft.


-- 
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(echarts): only reserve left grid padding when a Y-axis title exists [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #43064:
URL: https://github.com/apache/superset/pull/43064#issuecomment-5254685850

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | c5560bd6edc9a5ea5e30b97988abf73c664ac24a |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a7b34600246ad0008564cb3 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-43064--superset-docs-preview.netlify.app](https://deploy-preview-43064--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQzMDY0LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.XYnQGgJXozrYvytMOSzpmQfXdj4iD_Fw2Xkmmpq6ogA)<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#DcrJDYAgEADAXvYtcSOIxg4sYzkUEq4gD42xd_nNY14oNcfSYAMYQFVK2nUf_h6tdlTbxR66_cWab8GySPX0qU9jS8jPbvqVtCguJOIkJBlEXGcptOLw_Q) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-43064--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(echarts): only reserve left grid padding when a Y-axis title exists [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #43064:
URL: https://github.com/apache/superset/pull/43064#issuecomment-5254661956

   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(echarts): only reserve left grid padding when a Y-axis title exists [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe closed pull request #43064: fix(echarts): only reserve left grid padding when a Y-axis title exists
URL: https://github.com/apache/superset/pull/43064


-- 
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(echarts): only reserve left grid padding when a Y-axis title exists [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #43064:
URL: https://github.com/apache/superset/pull/43064#issuecomment-5255052552

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/43064?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 65.80%. Comparing base ([`3cd6720`](https://app.codecov.io/gh/apache/superset/commit/3cd67206dfd87c2210a51124f59c00a0019241f3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`c5560bd`](https://app.codecov.io/gh/apache/superset/commit/c5560bd6edc9a5ea5e30b97988abf73c664ac24a?dropdown=coverage&el=desc&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                    @@
   ##           mobile-dashboard-support   #43064   +/-   ##
   =========================================================
     Coverage                     65.80%   65.80%           
   =========================================================
     Files                          2845     2845           
     Lines                        162333   162335    +2     
     Branches                      37256    37258    +2     
   =========================================================
   + Hits                         106822   106824    +2     
     Misses                        53446    53446           
     Partials                       2065     2065           
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/43064/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/43064/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `72.07% <100.00%> (+<0.01%)` | :arrow_up: |
   
   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/43064?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