Skip to content

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

Merged
EnxDev merged 6 commits intomasterfrom
enxdev/fix/matrixify-y-axis-responsive-ticks
Mar 31, 2026
Merged

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

Conversation

@EnxDev
Copy link
Copy Markdown
Contributor

@EnxDev EnxDev commented Mar 16, 2026

User description

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

Make compact timeseries charts easier to read in tight spaces

What Changed

  • Small charts now reduce axis clutter: legend, axis title, tick marks, and grid lines are hidden when there is not enough vertical space
  • Charts with some space left keep only the boundary labels so users can still read the scale
  • Very short charts switch to a sparkline-style view with no axis labels
  • Y-axis ticks now scale with chart height on taller charts instead of using a fixed count
  • Zoomable charts keep enough bottom space for the zoom control even when the chart is compact

Impact

✅ Clearer small dashboard charts
✅ Fewer overlapping labels in dense layouts
✅ Easier scale reading on compact charts

💡 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
Copy Markdown
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
Copy Markdown
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

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
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Mar 16, 2026
@bito-code-review
Copy link
Copy Markdown
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
Copy Markdown
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
@sadpandajoe sadpandajoe added 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR and removed testenv-up labels Mar 27, 2026
@michaelmorera-preset
Copy link
Copy Markdown

The application is working as expected.

Scenario

The Y axis ticks/lines appear correctly in Matrixify.

Steps

  1. Go to the Superset application
  2. Import the example chart (use matrixify)
  3. Update the row height to be either 60/90/120

Current result

After the step 3, the Y axis ticks/lines appear correctly in Matrixify.

Variants

Variant Status
Row height - 59
Row height - 60
Row height - 89
Row height - 90
Row height - 119
Row height - 120
Row height - 121

NOTE: the numbers on the Y Axis of each chart starting appearing at "Row height"=62.

Testing chart example

chart_export_20260316T112054.zip

Evidence

Row height 60
image

Row height 90
image

Row height 120
image

@codeant-ai-for-open-source codeant-ai-for-open-source Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:M This PR changes 30-99 lines, ignoring generated files labels Mar 31, 2026
@github-actions github-actions Bot removed the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Mar 31, 2026
@github-actions github-actions Bot added 🎪 7225ed1 🚦 building Environment 7225ed1 status: building 🎪 7225ed1 📅 2026-03-31T11-13 Environment 7225ed1 created at 2026-03-31T11-13 🎪 7225ed1 🤡 EnxDev Environment 7225ed1 requested by EnxDev 🎪 ⌛ 48h Environment expires after 48 hours (default) labels Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 7225ed1

// Preserve bottom padding when zoomable, since getPadding() reserves space for the dataZoom slider.
if (height < TIMESERIES_CONSTANTS.compactChartHeight) {
padding.top = Math.min(padding.top, 12);
if (!zoomable) {
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: In compact mode the legend is hidden later, but padding is still computed as if the legend is visible, so the chart can keep large reserved margins (especially with left/right legends) and lose plot area. Recompute compact padding with legend disabled so the drawing area actually expands. [logic error]

Severity Level: Major ⚠️
- ⚠️ Compact charts waste space reserved for hidden legend.
- ⚠️ Reduced plot area in dense dashboard layouts.
Suggested change
if (!zoomable) {
const compactPadding = getPadding(
false,
legendOrientation,
addYAxisLabelOffset,
zoomable,
effectiveLegendMargin,
addXAxisLabelOffset,
yAxisTitlePosition,
convertInteger(yAxisTitleMargin),
convertInteger(xAxisTitleMargin),
isHorizontal,
);
Object.assign(padding, compactPadding);
Steps of Reproduction ✅
1. Configure an ECharts time-series chart that uses `transformProps` (default export of
`superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts`) with
`showLegend = true` and a non-null `legendMargin`, and place it in a dashboard cell whose
height is below `TIMESERIES_CONSTANTS.compactChartHeight` (compact mode).

2. In `transformProps`, `padding` is first computed via `getPadding(showLegend,
legendOrientation, addYAxisLabelOffset, zoomable, effectiveLegendMargin,
addXAxisLabelOffset, ...)` (lines ~815–825), which reserves space for the legend based on
`showLegend` and `legendOrientation`.

3. Immediately after, the compact-mode block (lines 831–835) only clamps `padding.top` and
`padding.bottom` but does not recompute padding with `showLegend = false`, while the
legend configuration later passes `isSmallChart ? false : showLegend` into
`getLegendProps` (lines ~1097–1105), effectively hiding the legend in compact mode without
clearing the reserved padding.

4. Render the chart in the browser: the legend is not shown for compact heights, but the
grid (`grid: { ...defaultGrid, ...padding }` near the end of `transformProps`) still
includes space that had been reserved for the legend (especially on the side where the
legend orientation is configured), reducing the actual plot area available for the
time-series lines/bars.
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:** 832:832
**Comment:**
	*Logic Error: In compact mode the legend is hidden later, but `padding` is still computed as if the legend is visible, so the chart can keep large reserved margins (especially with left/right legends) and lose plot area. Recompute compact padding with legend disabled so the drawing area actually expands.

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

@github-actions github-actions Bot added 🎪 7225ed1 🚦 deploying Environment 7225ed1 status: deploying 🎪 7225ed1 🚦 running Environment 7225ed1 status: running 🎪 🎯 7225ed1 Active environment pointer - 7225ed1 is receiving traffic 🎪 7225ed1 🌐 54.244.96.75:8080 Environment 7225ed1 URL: http://54.244.96.75:8080 (click to visit) and removed 🎪 7225ed1 🚦 building Environment 7225ed1 status: building 🎪 7225ed1 🚦 deploying Environment 7225ed1 status: deploying 🎪 7225ed1 🚦 running Environment 7225ed1 status: running 🎪 🎯 7225ed1 Active environment pointer - 7225ed1 is receiving traffic labels Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for 7225ed1

Environment: http://54.244.96.75:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@EnxDev EnxDev removed the hold:testing! On hold for testing label Mar 31, 2026
@EnxDev EnxDev merged commit f0b20dc into master Mar 31, 2026
73 of 76 checks passed
@EnxDev EnxDev deleted the enxdev/fix/matrixify-y-axis-responsive-ticks branch March 31, 2026 15:44
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 31, 2026
michael-s-molina pushed a commit that referenced this pull request Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugins size/L size:L This PR changes 100-499 lines, ignoring generated files 🎪 ⌛ 48h Environment expires after 48 hours (default) 🎪 7225ed1 🤡 EnxDev Environment 7225ed1 requested by EnxDev 🎪 7225ed1 🚦 running Environment 7225ed1 status: running 🎪 7225ed1 🌐 54.244.96.75:8080 Environment 7225ed1 URL: http://54.244.96.75:8080 (click to visit) 🎪 7225ed1 📅 2026-03-31T11-13 Environment 7225ed1 created at 2026-03-31T11-13

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants