Skip to content

fix(echarts-timeseries): make dataZoom slider bottom offset responsive#38657

Closed
manojshetty2004 wants to merge 10 commits into
apache:masterfrom
manojshetty2004:fix-37286-zoom-slider-overflow
Closed

fix(echarts-timeseries): make dataZoom slider bottom offset responsive#38657
manojshetty2004 wants to merge 10 commits into
apache:masterfrom
manojshetty2004:fix-37286-zoom-slider-overflow

Conversation

@manojshetty2004

@manojshetty2004 manojshetty2004 commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

User description

SUMMARY

This change makes the dataZoom slider bottom offset responsive to the chart height in ECharts time-series charts.

Previously, the slider used a fixed offset:

TIMESERIES_CONSTANTS.zoomBottom

In smaller chart panels or dashboards with limited height, this could cause the zoom slider to appear clipped or overflow outside the visible chart area.

This PR replaces the fixed offset with a responsive calculation based on the chart height:

Math.max(TIMESERIES_CONSTANTS.zoomBottom, Math.floor(height * 0.08))

This ensures:

  • The zoom slider keeps the existing minimum spacing.
  • The control adapts to smaller panel heights.
  • The zoom control remains visible and correctly positioned.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:
The zoom slider could overflow or appear clipped when the chart panel height is small.

After:
The zoom slider position adjusts dynamically based on chart height and remains visible.

TESTING INSTRUCTIONS

  1. Run Superset locally.
  2. Open Explore → ECharts Time-series chart.
  3. Enable Zoomable.
  4. Reduce the chart height or place the chart in a smaller dashboard panel.
  5. Verify that the zoom slider remains visible and positioned correctly.

ADDITIONAL INFORMATION


CodeAnt-AI Description

Keep the time-series zoom slider visible in short charts

What Changed

  • The time-series zoom slider now shifts up based on chart height instead of using one fixed bottom position
  • Small chart panels and compact dashboards keep the zoom control inside the visible chart area
  • A test now checks that the slider position changes when chart height changes

Impact

✅ Fewer clipped time-series charts
✅ Zoom controls stay visible in small dashboard panels
✅ Clearer chart interaction in compact layouts

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai-for-open-source codeant-ai-for-open-source Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Mar 15, 2026
@dosubot dosubot Bot added viz:charts:echarts Related to Echarts viz:charts:timeseries Related to Timeseries labels Mar 15, 2026
@codeant-ai-for-open-source

Copy link
Copy Markdown
Contributor

Sequence Diagram

This PR updates the time series chart option builder to compute the data zoom slider bottom offset from chart height instead of always using a fixed value. The result is that zoom controls stay visible in shorter chart panels while preserving the previous minimum spacing.

sequenceDiagram
    participant User
    participant Chart
    participant TransformProps
    participant ECharts

    User->>Chart: Open small time series panel with zoom enabled
    Chart->>TransformProps: Build chart options with panel height
    TransformProps->>TransformProps: Compute zoom bottom as max of minimum and height based offset
    TransformProps-->>Chart: Return options with data zoom slider bottom
    Chart->>ECharts: Render chart using updated options
    ECharts-->>User: Show visible zoom slider in panel
Loading

Generated by CodeAnt AI

@bito-code-review bito-code-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #eb5663

Actionable Suggestions - 1
  • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts - 1
Review Details
  • Files reviewed - 1 · Commit Range: 1abdd35..1abdd35
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts Outdated
@sfirke sfirke changed the title fix(echarts-timeseries): make dataZoom slider bottom offset responsive (#37286) fix(echarts-timeseries): make dataZoom slider bottom offset responsive Mar 16, 2026
@codeant-ai-for-open-source codeant-ai-for-open-source Bot added size:XS This PR changes 0-9 lines, ignoring generated files and removed size:XS This PR changes 0-9 lines, ignoring generated files labels Mar 16, 2026
@sfirke

sfirke commented Mar 16, 2026

Copy link
Copy Markdown
Member

I merged master branch into this, in an attempt to fix a test that was failing for unrelated reasons.

@manojshetty2004

Copy link
Copy Markdown
Contributor Author

@sfirke
Thanks for merging master into the branch to address the unrelated failing test. I can confirm that all checks are now passing on my side as well. Please let me know if any further adjustments are needed for this PR.

@sadpandajoe

Copy link
Copy Markdown
Member

@manojshetty2004 in the before and after section of the description, can you add images or a small video of the changes?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts ECharts time-series dataZoom slider positioning to avoid the zoom control being clipped in constrained panel sizes by making the slider’s bottom offset depend on chart height.

Changes:

  • Introduces a computed dynamicZoomBottom value derived from height.
  • Uses dynamicZoomBottom instead of TIMESERIES_CONSTANTS.zoomBottom for dataZoom.slider.bottom.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts Outdated
Comment on lines 967 to +970
type: 'slider',
start: TIMESERIES_CONSTANTS.dataZoomStart,
end: TIMESERIES_CONSTANTS.dataZoomEnd,
bottom: TIMESERIES_CONSTANTS.zoomBottom,
bottom: dynamicZoomBottom,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @manojshetty2004!
I agree with Copilot that unit tests need to be added.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SBIN2010
Thanks for the suggestion! I've added a unit test to verify that the dataZoom bottom value adjusts dynamically based on chart height. Also resolved merge conflicts. Please let me know if anything else is needed.

@codeant-ai-for-open-source codeant-ai-for-open-source Bot added size:XS This PR changes 0-9 lines, ignoring generated files and removed size:XS This PR changes 0-9 lines, ignoring generated files labels Mar 17, 2026
@manojshetty2004

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestion! I’ll add before/after screenshots demonstrating the zoom slider behavior shortly.

@bito-code-review

bito-code-review Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #491d05

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 1abdd35..112b949
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@manojshetty2004

Copy link
Copy Markdown
Contributor Author

@sadpandajoe
Thanks for the suggestion. I wasn’t able to reliably reproduce the exact clipping issue locally, but I validated the change by testing with smaller chart heights where the zoom slider area becomes constrained. The dynamic bottom offset ensures additional spacing is allocated, preventing potential overlap or clipping in tighter layouts.

Please let me know if you’d like me to try a specific scenario or dataset to better demonstrate the issue.

@codeant-ai-for-open-source codeant-ai-for-open-source Bot added size:XS This PR changes 0-9 lines, ignoring generated files and removed size:XS This PR changes 0-9 lines, ignoring generated files labels Mar 20, 2026
@netlify

netlify Bot commented Mar 20, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit bc1b579
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69bda5f8f6091400089fe4a9
😎 Deploy Preview https://deploy-preview-38657--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@bito-code-review

bito-code-review Bot commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #b7af21

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 112b949..22ca17e
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codeant-ai-for-open-source codeant-ai-for-open-source Bot added size:XS This PR changes 0-9 lines, ignoring generated files and removed size:XS This PR changes 0-9 lines, ignoring generated files labels Mar 21, 2026
@netlify

netlify Bot commented Mar 21, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 55ae379
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69cd47aa52d5490008b42c95
😎 Deploy Preview https://deploy-preview-38657--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@EnxDev

EnxDev commented May 6, 2026

Copy link
Copy Markdown
Contributor

Hey @manojshetty2004 could you add a before/after video in the description?

@rusackas

Copy link
Copy Markdown
Member

Thanks @manojshetty2004, appreciate you sticking with this one.

I'm a little confused on the direction though. #37286 is about the zoom control clipping in short panels, but Math.max(zoomBottom, Math.floor(height * 0.08)) only raises bottom as height grows, so a 300px panel still resolves to the old 30 and the test's smallBottom is unchanged. Taller charts get a bigger bottom margin instead. Can you walk me through how that fixes the clipped case? :)

Also this needs a rebase, it's conflicting with current master so we can't merge as-is.

@EnxDev

EnxDev commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

EnxDev's Review Agent — #38657 · HEAD ad515f1

Request changes — the formula is a no-op for the short panels it's meant to fix, so #37286 isn't addressed, and the new test hides that.

🔴 Functional

  • src/Timeseries/transformProps.ts:1001Math.max(TIMESERIES_CONSTANTS.zoomBottom, Math.floor(height * 0.08)) with zoomBottom = 30 (constants.ts:41) crosses over at height = 375. For every height ≤ 375px it resolves to exactly 30 — identical to the old fixed offset. Issue Zoom Data control doesn't fit into the panel #37286 is a short panel clipping bug, i.e. precisely the range where this changes nothing. The only heights it affects are tall charts (>375px), which weren't the problem and lose a little plot area as the slider shifts up. So the fix doesn't fix the linked issue. What's the intended direction here — should the offset shrink (or the grid's gridOffsetBottomZoomable adapt) on short charts so the slider actually fits?
  • test/Timeseries/transformProps.test.ts:1635 — the test passes only because it compares 300px (bottom=30) to 600px (bottom=48); the inequality is driven entirely by the tall chart. It asserts smallBottom !== largeBottom but never checks the short-panel value, so it would still pass with the no-op-on-short-charts behavior above. It gives false confidence that the bug is fixed. (test: assert the actual short-panel bottom and that it differs from the pre-PR 30.)

🟡 Should-fix

  • test/Timeseries/transformProps.test.ts:1655 — assert the exact computed values (e.g. 30 and 48) rather than just inequality, so the formula is actually pinned by the test.

🔵 Nits

  • src/Timeseries/transformProps.ts:1001 — Gantt/MixedTimeseries still use the fixed zoomBottom; if the responsive offset is kept, apply it consistently (already raised by a bot).
  • test/Timeseries/transformProps.test.ts:1647as any[] casts; prefer typing against the dataZoom option shape.

🙌 Praise

  • Added a focused transformProps test with zoomable: true in response to reviewer feedback — right instinct, just needs sharper assertions.

Reviewed by EnxDev's Review Agent — @EnxDev · HEAD ad515f1.

@manojshetty2004

Copy link
Copy Markdown
Contributor Author

Hey @manojshetty2004 could you add a before/after video in the description?

Hi! The before/after video has already been added to the description. Please let me know if you'd like me to update it further or if there's a specific section you'd like me to highlight.

Comment on lines +1018 to +1021
const dynamicZoomBottom = Math.max(
TIMESERIES_CONSTANTS.zoomBottom,
Math.floor(height * 0.08),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The responsive offset calculation is inverted for the stated goal: Math.max keeps the old fixed value for shorter charts and only increases spacing on taller charts. With zoomBottom = 30, any chart height under 375px still gets 30, so small panels remain non-responsive and can still clip. Use a formula that actually changes behavior for smaller heights (e.g., clamp with Math.min or otherwise reduce the offset as height shrinks). [logic error]

Severity Level: Major ⚠️
- ⚠️ Small-height echarts_timeseries charts keep non-responsive zoom slider.
- ⚠️ Zoom slider clipping persists in compact dashboard panels.
Steps of Reproduction ✅
1. In
`superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:181-276`,
note that `transformProps` reads `height` from `chartProps` and uses it later to drive
layout and zoom controls.

2. At `constants.ts:33-55`, observe `TIMESERIES_CONSTANTS.zoomBottom = 30` and the
compact/micro chart thresholds (`compactChartHeight = 100`, `microChartHeight = 60`),
showing the intent to adapt behavior for small heights.

3. At `Timeseries/transformProps.ts:1018-1021`, `dynamicZoomBottom` is computed as
`Math.max(TIMESERIES_CONSTANTS.zoomBottom, Math.floor(height * 0.08))`. For any `height <
375` (since `30 / 0.08 = 375`), `Math.floor(height * 0.08) < 30`, so `dynamicZoomBottom`
resolves to `30`, identical to the old fixed offset.

4. At `Timeseries/transformProps.ts:1181-1188`, the dataZoom slider config uses `bottom:
dynamicZoomBottom`. For zoomable small charts (e.g., `height = 80` or `height = 300` used
throughout `transformProps.test.ts`), the slider still gets `bottom = 30`, meaning the
PR's "responsive to smaller panel heights" behavior never triggers for the actual
small-height range where clipping was reported.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
**Line:** 1018:1021
**Comment:**
	*Logic Error: The responsive offset calculation is inverted for the stated goal: `Math.max` keeps the old fixed value for shorter charts and only increases spacing on taller charts. With `zoomBottom = 30`, any chart height under 375px still gets `30`, so small panels remain non-responsive and can still clip. Use a formula that actually changes behavior for smaller heights (e.g., clamp with `Math.min` or otherwise reduce the offset as height shrinks).

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

Comment on lines +1666 to +1668
const smallChart = createTestChartProps({
height: 300,
formData: { zoomable: true },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This test gives false confidence for the reported bug because the "small" case (height: 300) still hits the fixed minimum branch (30) and never validates behavior for truly small panels where clipping was reported. Add an assertion using a smaller height that exercises the intended small-chart path and verifies the expected direction of change (not just inequality). [incomplete implementation]

Severity Level: Major ⚠️
- ⚠️ Test misses small-height behavior of dataZoom bottom offset.
- ⚠️ Regression in small chart layout may go undetected.
Steps of Reproduction ✅
1. In
`superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:112-137`,
`createTestChartProps` builds `EchartsTimeseriesChartProps` using `DEFAULT_FORM_DATA` and
a passed `height`, exercising the same transform as production charts.

2. The new test at `transformProps.test.ts:1665-1693` constructs `smallChart` with
`height: 300` and `largeChart` with `height: 600`, both `zoomable: true`, then calls
`transformProps` and inspects `echartOptions.dataZoom[0].bottom`.

3. Using the implementation in `Timeseries/transformProps.ts:1018-1021` and
`constants.ts:33-55`, compute `dynamicZoomBottom`: for `height = 300`, `Math.floor(300 *
0.08) = 24`, so `bottom = max(30, 24) = 30`; for `height = 600`, `Math.floor(600 * 0.08) =
48`, so `bottom = 48`. The assertion `expect(smallBottom).not.toEqual(largeBottom)`
therefore passes while the "small" case still uses the old fixed offset.

4. Because the test never exercises the truly small-height range where clipping was
reported (e.g., `height < 100` used elsewhere in the suite for compact behavior) and does
not assert the expected direction of change (e.g., that small charts move the slider
further inside the visible area), it can pass even if the small-panel clipping bug is not
fixed, giving false confidence about the regression the PR aims to guard.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
**Line:** 1666:1668
**Comment:**
	*Incomplete Implementation: This test gives false confidence for the reported bug because the "small" case (`height: 300`) still hits the fixed minimum branch (`30`) and never validates behavior for truly small panels where clipping was reported. Add an assertion using a smaller height that exercises the intended small-chart path and verifies the expected direction of change (not just inequality).

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

@manojshetty2004

Copy link
Copy Markdown
Contributor Author

Thanks @manojshetty2004, appreciate you sticking with this one.

I'm a little confused on the direction though. #37286 is about the zoom control clipping in short panels, but Math.max(zoomBottom, Math.floor(height * 0.08)) only raises bottom as height grows, so a 300px panel still resolves to the old 30 and the test's smallBottom is unchanged. Taller charts get a bigger bottom margin instead. Can you walk me through how that fixes the clipped case? :)

Also this needs a rebase, it's conflicting with current master so we can't merge as-is.

Thanks for the clarification and for pointing that out. You're right—my current approach doesn't address the clipping issue in shorter panels, and I misunderstood the root cause.

I'll revisit the issue, investigate the clipping behavior again, and work on a more appropriate fix. I'll also rebase the PR onto the latest master and push an updated implementation once I have a better solution. Thanks again for the detailed review and guidance!

@rusackas

Copy link
Copy Markdown
Member

Holler if you need any help getting this done... would be happy to jump in if I'm able.

@rusackas

Copy link
Copy Markdown
Member

Thanks for the PR, Manoj! CI's failing right now, looks like the new test in transformProps.test.ts is missing its closing brace before the describe('Tooltip with long labels'...) block, so the file can't even parse, that's what's tripping up pre-commit, lint, and one of the jest shards.

There's also a bot thread still open pointing out that Math.max(zoomBottom, height * 0.08) only starts changing anything once the chart's taller than a few hundred px, so the small panels this is meant to fix (the #37286 case) might still get the old fixed offset. Worth confirming that's not the case before this goes in.

Mind fixing the syntax break and settling that logic question? Happy to take another look once CI's green. Holler if I can help more here, and push a commit or whatever :)

manojshetty2004 and others added 10 commits July 17, 2026 12:22
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…transformProps.ts

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

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

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

Co-authored-by: codeant-ai-for-open-source[bot] <244253245+codeant-ai-for-open-source[bot]@users.noreply.github.com>
@manojshetty2004
manojshetty2004 force-pushed the fix-37286-zoom-slider-overflow branch from 735c821 to c588e2c Compare July 17, 2026 07:13
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 17, 2026
@manojshetty2004

Copy link
Copy Markdown
Contributor Author

@rusackas
Thanks for the feedback. I'll close this PR and work on a fresh implementation in a new PR that properly addresses the issue. This PR has accumulated unrelated changes during development, so starting fresh will make the review cleaner and easier. I'll link the new PR to this issue once it's ready.

expect(symbol1).not.toEqual(symbol2);
});

test('should adjust dataZoom bottom when chart height changes', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The exact same test case name and behavior is added twice, creating duplicate coverage and ambiguous failure reporting in CI. Keep only one copy of this test and remove the duplicate block. [code quality]

Severity Level: Major ⚠️
⚠️ Duplicate jest test names complicate CI failure triage.
⚠️ Redundant tests increase suite runtime without added coverage.
Steps of Reproduction ✅
1. Open
`superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts`
and locate the first test named `should adjust dataZoom bottom when chart height changes`
added in the hunk starting at diff line 1744, which constructs small and large charts and
compares their `dataZoom[0].bottom` values.

2. In the same file, scroll down to the later hunk starting around diff line 1871 and
observe a second test with the identical name `should adjust dataZoom bottom when chart
height changes` that also creates `smallChart` and `largeChart`, calls `transformProps`,
and asserts that the `dataZoom[0].bottom` values differ.

3. Run the frontend test suite (for example `cd superset-frontend && npm test --
plugin-chart-echarts/test/Timeseries/transformProps.test.ts`) and note that Jest reports
two separate tests with the exact same description string, both invoking `transformProps`
and asserting the bottom offset behavior.

4. When a regression occurs in this behavior, CI output will show a failure for `should
adjust dataZoom bottom when chart height changes` without distinguishing which of the two
blocks failed, making diagnosis harder and executing redundant assertions for the same
scenario.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
**Line:** 1744:1744
**Comment:**
	*Code Quality: The exact same test case name and behavior is added twice, creating duplicate coverage and ambiguous failure reporting in CI. Keep only one copy of this test and remove the duplicate block.

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

Comment on lines +1314 to +1317
const headerCellFormattedValue =
dateFormatters?.[attrName]?.(
convertToNumberIfNumeric(colKey[attrIdx]),
) ?? colKey[attrIdx];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This new block references variables that are not defined in this row-header scope (attrName, colKey, attrIdx), which will throw when rendering. Use the row-scope variables (settingsRowAttrs[i], r, and the row index) instead of column-header-only variables. [incorrect variable usage]

Severity Level: Critical 🚨
❌ Frontend build fails, blocking pivot table plugin usage.
⚠️ CI pipelines fail on TypeScript compilation errors.
Steps of Reproduction ✅
1. Open
`superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx`
and locate the `renderColHeaderRow` callback around lines 860-1135 (from the `Read` tool),
where `attrName`, `attrIdx`, `colKey`, `colLabelClass`, and related variables are defined
and used to build column header cells.

2. In the same file, inspect the `renderTableRow` callback starting at line 116 in the
`Read` output (diff hunk around 1316) that renders row header cells; within the
`rowKey.map((r, i) => { ... })` callback, the newly added block at diff lines 1314-1317
defines `const headerCellFormattedValue =
dateFormatters?.[attrName]?.(convertToNumberIfNumeric(colKey[attrIdx])) ??
colKey[attrIdx];`.

3. Verify from the surrounding `renderTableRow` scope (lines 120-145 from `Read`) that
`settingsRowAttrs`, `rowKey`, and `dateFormatters` are defined, but there is no definition
of `attrName`, `colKey`, or `attrIdx` in this function; those identifiers only exist as
parameters to `renderColHeaderRow` and are not in scope inside `renderTableRow`.

4. Run the TypeScript type-check or frontend build (for example `cd superset-frontend &&
npm run build`), and the compiler will flag `attrName`, `colKey`, and `attrIdx` in
`TableRenderers.tsx` (diff lines 1314-1317) as undefined identifiers, causing compilation
to fail and blocking the pivot table plugin from being built or used.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx
**Line:** 1314:1317
**Comment:**
	*Incorrect Variable Usage: This new block references variables that are not defined in this row-header scope (`attrName`, `colKey`, `attrIdx`), which will throw when rendering. Use the row-scope variables (`settingsRowAttrs[i]`, `r`, and the row index) instead of column-header-only variables.

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

Comment on lines +1328 to +1329
attrValueCells.push(
<th

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Pushing into attrValueCells from inside the callback that is used to initialize attrValueCells creates a self-reference during initialization and breaks the row rendering flow. Keep this path as a pure map return (as before) and avoid mutating the array being constructed inside its own initializer. [logic error]

Severity Level: Major ⚠️
❌ Pivot table rows crash with ReferenceError during render.
⚠️ Users see blank pivot tables instead of data.
Steps of Reproduction ✅
1. In `TableRenderers.tsx`, within the `renderTableRow` callback (lines 148-199 from the
`Read` output), note that `const attrValueCells = rowKey.map((r: string, i: number) => {
... });` initializes `attrValueCells` by mapping over `rowKey`, so `attrValueCells` is
defined by the result of this `map` call.

2. Inside the same `rowKey.map` callback, inspect the newly added block at diff lines
1328-1329 where `attrValueCells.push(<th ... > ...)` is called, meaning the callback
attempts to push additional header cells into `attrValueCells` while `attrValueCells`
itself is still being initialized.

3. From JavaScript semantics, referencing `attrValueCells` inside its own initializer
(`const attrValueCells = rowKey.map(() => { attrValueCells.push(...); })`) places that
reference in the temporal dead zone; at runtime, when `rowKey.map` invokes the callback
for the first element, `attrValueCells` has not yet been assigned, so any read or `push`
on `attrValueCells` triggers a `ReferenceError: Cannot access 'attrValueCells' before
initialization`.

4. Once the TypeScript compile-time issues in this block are resolved and a pivot table
chart (rendered via `PivotTable.tsx` which delegates to `TableRenderer`) reaches this
path, rendering rows will immediately crash with the temporal-dead-zone `ReferenceError`,
preventing any pivot table rows from displaying.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx
**Line:** 1328:1329
**Comment:**
	*Logic Error: Pushing into `attrValueCells` from inside the callback that is used to initialize `attrValueCells` creates a self-reference during initialization and breaks the row rendering flow. Keep this path as a pure `map` return (as before) and avoid mutating the array being constructed inside its own initializer.

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

Comment on lines +1336 to +1342
onClick={this.clickHeaderHandler(
pivotData,
colKey,
this.props.cols,
attrIdx,
this.props.tableOptions.clickColumnHeaderCallback,
)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This component is a function component, so using this-based handlers/state will fail at runtime because this is undefined. Replace these calls with the already scoped hook/local variables (clickHeaderHandler, cols, tableOptions, collapsedCols, activeSortColumn, sortingOrder) used elsewhere in this file. [api mismatch]

Severity Level: Critical 🚨
❌ Pivot table charts fail rendering due to runtime TypeError.
⚠️ Cross-filtering from row headers becomes completely unusable.
Steps of Reproduction ✅
1. In
`superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx`,
confirm that `TableRenderer` is a function component using React hooks, defined at lines
334-453 (from the `export function TableRenderer(props: TableRendererProps)` declaration
and subsequent `useState` and `useCallback` hooks returned by the `Read` tool).

2. Within the same file, inspect the `renderTableRow` callback (useCallback starting
around diff line 1316) where row header cells are rendered; the new hunk at diff lines
1336-1342 sets `onClick={this.clickHeaderHandler(pivotData, colKey, this.props.cols,
attrIdx, this.props.tableOptions.clickColumnHeaderCallback)}` on a header `<th>` element
instead of using the `clickHeaderHandler` hook defined earlier.

3. Observe via the code that `clickHeaderHandler` in this file is a top-level hook-scoped
function (lines 59-88 from the `Read` output) and there is no `this` binding or class
instance for `TableRenderer`; therefore, evaluating `this.clickHeaderHandler` inside the
render path will attempt to read a property from `this`, which is `undefined` for function
components.

4. Render any pivot table chart (for example by using the `PivotTable` wrapper in
`plugins/plugin-chart-pivot-table/src/react-pivottable/PivotTable.tsx`, which returns
`<TableRenderer {...props} />` at lines 5-8) and when React executes `renderTableRow`, the
expression `this.clickHeaderHandler(...)` is evaluated during render, causing a runtime
TypeError (`Cannot read properties of undefined`) and preventing the pivot table from
rendering.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx
**Line:** 1336:1342
**Comment:**
	*Api Mismatch: This component is a function component, so using `this`-based handlers/state will fail at runtime because `this` is `undefined`. Replace these calls with the already scoped hook/local variables (`clickHeaderHandler`, `cols`, `tableOptions`, `collapsedCols`, `activeSortColumn`, `sortingOrder`) used elsewhere in this file.

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

@bito-code-review bito-code-review Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #bf02fc

Actionable Suggestions - 2
  • superset-frontend/plugins/plugin-chart-echarts/src/constants.ts - 1
    • Inconsistent zoom padding across chart types · Line 42-42
  • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts - 1
Review Details
  • Files reviewed - 4 · Commit Range: dc3f7a2..c588e2c
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx
  • 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 evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

legendRightTopOffset: 30,
legendTopRightOffset: 55,
zoomBottom: 30,
zoomBottomMin: 10,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent zoom padding across chart types

The new zoomBottomMin constant (10) is only applied to Timeseries charts, while Gantt and MixedTimeseries charts continue using the hardcoded zoomBottom value (30) directly. This creates inconsistent behavior where small-height Gantt/MixedTimeseries charts will have excessive 30px zoom padding instead of the minimum 10px. Update both files to use Math.min(TIMESERIES_CONSTANTS.zoomBottom, Math.max(TIMESERIES_CONSTANTS.zoomBottomMin, Math.floor(height * 0.08))).

Code Review Run #bf02fc


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Comment on lines +1871 to +1892
test('should adjust dataZoom bottom when chart height changes', () => {
const smallChart = createTestChartProps({
height: 300,
formData: { zoomable: true },
});
const largeChart = createTestChartProps({
height: 600,
formData: { zoomable: true },
});

const smallResult = transformProps(smallChart);
const largeResult = transformProps(largeChart);

const smallBottom = (smallResult.echartOptions.dataZoom as any[])[0].bottom;
const largeBottom = (largeResult.echartOptions.dataZoom as any[])[0].bottom;

expect(smallBottom).toBeDefined();
expect(largeBottom).toBeDefined();

// Bottom should vary with height
expect(smallBottom).not.toEqual(largeBottom);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate test case

This test is semantically duplicated - identical test already exists at lines 1744-1772. Having two tests with the same setup, assertions, and purpose increases maintenance burden and creates divergence risk if one is updated without the other.

Code Review Run #bf02fc


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugins 🎪 🔒 showtime-blocked size/L size:S This PR changes 10-29 lines, ignoring generated files viz:charts:echarts Related to Echarts viz:charts:timeseries Related to Timeseries 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zoom Data control doesn't fit into the panel

7 participants