Skip to content

feat(timeseries): percent-change rebasing with a draggable baseline - #42247

Merged
rusackas merged 6 commits into
remove-legacy-viz-pipelinefrom
compare-percent-change
Jul 21, 2026
Merged

rusackas merged 6 commits into
remove-legacy-viz-pipelinefrom
compare-percent-change

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

Stacked on #41714. Restores the functionality lost when saved "Time-series Percent Change" (compare) charts were migrated to the ECharts line chart — including the draggable baseline the nvd3 cumulativeLineChart was known for.

A new Percent change control on the Line chart rebases every series client-side to its percent change from the first point (y / y0 − 1, computed in transformProps exactly where the nvd3 renderer used to do it), and joins the existing forcePercentFormatter path so the y-axis and tooltips format as percentages automatically. A draggable vertical baseline is installed on the plot (ECharts graphic + convertFromPixel, snapped to the nearest data point); dragging re-indexes every series via the composable rebase identity (1+v)/(1+vk) − 1, so re-indexing needs no re-query and no raw-data retention.

MigrateCompareChart now sets the flag, so migrated compare charts come out rendering their percent-change view rather than degrading to a plain line chart — resolving the form_data_bak-fragility concern, since the intent is materialized in live form data.

TESTING INSTRUCTIONS

  • npx jest plugins/plugin-chart-echarts/test/Timeseries/percentChange.test.ts — rebase math incl. baseline-zero, leading nulls, and the composability identity.
  • pytest tests/unit_tests/migrations/viz/nvd3_compare_chart_to_echarts_test.py — migration sets the flag.
  • Manual: Line chart on birth_names (sum__num by state), tick Percent change, then drag the vertical baseline across the plot.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

@dosubot dosubot Bot added change:frontend Requires changing the frontend explore:design Related to the Explore UI/UX viz:charts:timeseries Related to Timeseries labels Jul 20, 2026
@bito-code-review

bito-code-review Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped - Branch Excluded

Bito didn't auto-review because the source or target branch is excluded from automatic reviews.
No action is needed if you didn't intend for the agent to review it. Otherwise, to manually trigger a review, type /review in a comment and save.
You can change the branch exclusion settings here, or contact your Bito workspace admin at evan@preset.io.

@netlify

netlify Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit e6b46b5
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a5eb1767a783e0008b95f74
😎 Deploy Preview https://deploy-preview-42247--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.

@github-actions github-actions Bot added risk:db-migration PRs that require a DB migration plugins labels Jul 20, 2026
@codecov

codecov Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.48515% with 49 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.49%. Comparing base (059eabe) to head (e6b46b5).

Files with missing lines Patch % Lines
...chart-echarts/src/Timeseries/EchartsTimeseries.tsx 10.00% 45 Missing ⚠️
...perset/migrations/shared/migrate_viz/processors.py 33.33% 2 Missing ⚠️
...ugin-chart-echarts/src/Timeseries/percentChange.ts 97.56% 1 Missing ⚠️
...gin-chart-echarts/src/Timeseries/transformProps.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           remove-legacy-viz-pipeline   #42247      +/-   ##
==============================================================
- Coverage                       65.50%   65.49%   -0.02%     
==============================================================
  Files                            2786     2787       +1     
  Lines                          155137   155236      +99     
  Branches                        35675    35711      +36     
==============================================================
+ Hits                           101617   101666      +49     
- Misses                          51633    51683      +50     
  Partials                         1887     1887              
Flag Coverage Δ
hive 38.96% <33.33%> (-0.01%) ⬇️
javascript 71.17% <52.04%> (-0.03%) ⬇️
mysql 57.87% <33.33%> (-0.01%) ⬇️
postgres 57.93% <33.33%> (-0.01%) ⬇️
presto 40.95% <33.33%> (-0.01%) ⬇️
python 59.37% <33.33%> (-0.01%) ⬇️
sqlite 57.53% <33.33%> (-0.01%) ⬇️
unit 100.00% <ø> (ø)

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 rusackas added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Jul 20, 2026
@github-actions github-actions Bot added 🎪 f351c08 🚦 building 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Jul 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for f351c08

@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for ab71b7a

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

@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for b74b3eb

@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 40f0081

@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for b74b3eb

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

claude and others added 6 commits July 20, 2026 16:38
Restores the legacy nvd3 "Time-series Percent Change" view on the ECharts
line chart. A new "Percent change" control rebases every series client-side
to its percent change from the first point (y/y0 - 1, computed in
transformProps like the nvd3 renderer did), with the y-axis and tooltips
switching to percent formatting via the existing forcePercentFormatter
path. A draggable vertical baseline is installed on the chart; dragging it
re-indexes every series to the hovered point using the composable rebase
identity (1+v)/(1+vk) - 1, so no re-query or raw-data retention is needed.
MigrateCompareChart sets the flag, so saved compare charts regain their
percent-change view instead of degrading to a plain line chart.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…eline

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tuple points

Only group elements accept children in the ECharts graphic API; the rect
baseline crashed with 'e.add is not a function' when percent change was
enabled. Non-tuple series points are filtered before destructuring.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…g zone

The literal rgba(0, 0, 0, 0.02) fill tripped the custom-rules-frontend
pre-commit lint (no literal colors). Swap it for theme.colorFillSecondary.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…, throttle drag updates

Address three review findings on the percent-change draggable baseline:
- snapToNearestX no longer coerces category-axis x values with Number(),
  which produced NaN and broke baseline positioning/snapping on
  non-temporal x-axes; it now validates the (already-snapped) category
  value against the known points instead.
- the dragged baseline position is now persisted in a ref so effect
  reruns (resizes, other option changes) don't silently snap it back to
  the first point.
- ondrag updates are coalesced to one setOption per animation frame
  instead of rebasing every series on every raw pointer-move event.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The handle spanned the full chart height, running through the legend and
x-axis labels; it now uses the grid's actual rect, falling back to full
height if the internal API is unavailable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for e6b46b5

@github-actions

Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for e6b46b5

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

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

Labels

change:frontend Requires changing the frontend explore:design Related to the Explore UI/UX plugins risk:db-migration PRs that require a DB migration size/L viz:charts:timeseries Related to Timeseries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants