Skip to content

fix(echarts): adapt y-axis ticks and padding for compact timeseries charts#38673

Open
EnxDev wants to merge 5 commits intomasterfrom
enxdev/fix/matrixify-y-axis-responsive-ticks
Open

fix(echarts): adapt y-axis ticks and padding for compact timeseries charts#38673
EnxDev wants to merge 5 commits intomasterfrom
enxdev/fix/matrixify-y-axis-responsive-ticks

Conversation

@EnxDev
Copy link
Contributor

@EnxDev EnxDev commented Mar 16, 2026

SUMMARY

When timeseries charts are rendered at small heights common in dense dashboard layouts with matrix/grid arrangements — the y-axis labels, ticks, and legends compete for the limited vertical space, often overlapping each other and making the chart unreadable.

This PR introduces a three-tier responsive behavior for the y-axis based on chart height:

  • Full charts (≥ 100px): Standard behavior with a proportional tick count (Math.floor(height / 80), minimum 3), ensuring the number of axis labels scales naturally with chart size rather than using a fixed count that may crowd or underwhelm.
  • Compact charts (60–99px): Strips away axis lines, ticks, split lines, minor ticks, legend, and y-axis title — showing only min/max labels so the user retains a sense of scale without visual clutter. Grid padding is also tightened to maximize the drawing area.
  • Micro charts (< 60px): Hides all axis decorations entirely, leaving just the data line — effectively a sparkline view.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

  • Before
before1
  • After
after1
  • Before
before2
  • After
after2
  • Before
before3
  • After
after3

TESTING INSTRUCTIONS

  1. Create a line-chart
  2. Resize a Row height to various heights:
    • Above 100px: should see full axis with proportional tick count
    • Between 60–99px: should see only min/max labels, no ticks/gridlines/legend
    • Below 60px: should see line only, no axis decorations at all
  3. Verify no label overlapping or clipping at any size

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

CodeAnt-AI Description

Adapt y-axis ticks and padding for compact timeseries charts

What Changed

  • Charts now use three height-based display modes: full (>=100px) with proportional tick count, compact (60–99px) showing only min/max labels and hiding ticks/lines, and micro (<60px) hiding axis labels and decorations except the axis line
  • Top and bottom padding are reduced for very short charts so the plot area fits better in dense grids
  • Legends are suppressed on compact charts and y-axis titles are hidden to avoid vertical clutter

Impact

✅ Fewer overlapping y-axis labels on small charts
✅ Clearer micro and compact timeseries visuals in dense dashboards
✅ More usable plot area for tiny chart cells

💡 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.

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Mar 16, 2026

Code Review Agent Run #b0e47f

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: ca487d9..648f6ae
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/constants.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

@dosubot dosubot bot added viz:charts:echarts Related to Echarts viz:charts:timeseries Related to Timeseries labels Mar 16, 2026
@EnxDev EnxDev added testenv-up and removed viz:charts:echarts Related to Echarts viz:charts:timeseries Related to Timeseries labels Mar 16, 2026
@codeant-ai-for-open-source codeant-ai-for-open-source bot added the size:M This PR changes 30-99 lines, ignoring generated files label Mar 16, 2026
@codeant-ai-for-open-source
Copy link
Contributor

Sequence Diagram

This PR updates timeseries option generation to adapt chart padding and y axis rendering based on chart height tiers. The flow ensures compact and micro charts hide nonessential axis and legend elements so the plot remains readable in dense dashboard layouts.

sequenceDiagram
    participant User
    participant Chart
    participant TransformProps
    participant ECharts

    User->>Chart: Resize chart to a smaller height
    Chart->>TransformProps: Build timeseries options with current height
    TransformProps->>TransformProps: Apply height thresholds from timeseries constants
    alt Height is at least 100
        TransformProps->>TransformProps: Use proportional y axis ticks and keep legend
    else Height is 60 to 99
        TransformProps->>TransformProps: Reduce padding and hide y axis lines ticks and title
    else Height is below 60
        TransformProps->>TransformProps: Hide y axis labels and other decorations
    end
    TransformProps-->>ECharts: Return responsive chart options
    ECharts-->>User: Render readable compact timeseries chart
Loading

Generated by CodeAnt AI

@pull-request-size pull-request-size bot added size/L and removed size/M labels Mar 16, 2026
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Mar 16, 2026

Code Review Agent Run #2d6b47

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 648f6ae..758ab65
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/constants.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ 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

Copy link
Member

@msyavuz msyavuz left a comment

Choose a reason for hiding this comment

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

This looks good to me!

@msyavuz msyavuz added the hold:testing! On hold for testing label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold:testing! On hold for testing plugins size/L size:M This PR changes 30-99 lines, ignoring generated files testenv-up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants