Skip to content

feat(rose): migrate rose chart to v1 chart data API - #41726

Merged
rusackas merged 2 commits into
remove-legacy-viz-pipelinefrom
legacy-viz-t2-rose
Jul 3, 2026
Merged

feat(rose): migrate rose chart to v1 chart data API#41726
rusackas merged 2 commits into
remove-legacy-viz-pipelinefrom
legacy-viz-t2-rose

Conversation

@rusackas

@rusackas rusackas commented Jul 3, 2026

Copy link
Copy Markdown
Member

SUMMARY

Tier 2 of #41714 (targets remove-legacy-viz-pipeline): migrate the Nightingale Rose Chart (rose) off explore_json onto /api/v1/chart/data.

Rose exposed the full legacy nvd3 line engine (resample, rolling windows, time comparison, contribution), so this migration leans on server-side post_processing for exact pandas semantics rather than re-implementing them in JS:

  • buildQuery.ts attaches the pipeline pivot → resample → rolling → compare → contribution → flatten using the shared @superset-ui/chart-controls operators (plus a small local contribution factory, since the legacy boolean contribution control predates contributionMode), and requests time_offsets for time comparisons — the same approach the nvd3→ECharts migrations used.
  • transformProps re-keys the flattened pivot records into the legacy {timestamp: [{key, value, name, time}]} shape: metric dropped from grouped single-metric keys, time-shifted (m__1 week ago) and comparison (difference__m__m__1 week ago) columns mapped to the legacy "<offset> offset" suffix, NaN collapsed to 0, series sorted by key.
  • useLegacyApi: true removed.
  • No DB migration: viz_type unchanged; legacy granularity_sqla/time_range handled by extractExtras.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No visual change — same renderer, same data shape, different endpoint.

TESTING INSTRUCTIONS

  • npm run test -- plugins/legacy-plugin-chart-rose — 9 Jest tests (post-processing pipeline composition incl. rolling/resample/contribution/compare, flattened-label parsing with escaped commas, offset/comparison key mapping, NaN→0, timestamp re-keying).
  • Manual: open a saved Nightingale Rose chart (incl. one with time shift / rolling window); network tab shows POST /api/v1/chart/data; rendering identical.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

The rose chart rode the full legacy nvd3 line engine, so its buildQuery
attaches the equivalent post_processing pipeline (pivot, resample,
rolling window, time compare, contribution, flatten) and requests
time_offsets for time comparisons, keeping the pandas semantics
server-side. transformProps then re-keys the flattened pivot records by
timestamp with the legacy shape: metric dropped from grouped
single-metric keys, time-shifted and comparison columns labeled with
the legacy '<offset> offset' suffix, NaN collapsed to 0, series sorted
by key. Legacy pre-shaped payloads pass through untouched.

No DB migration needed: viz_type is unchanged and legacy
granularity_sqla/time_range form data flows through extractExtras.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added the api:charts Related to the REST endpoints of charts label Jul 3, 2026
@bito-code-review

bito-code-review Bot commented Jul 3, 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.

Comment thread superset-frontend/plugins/legacy-plugin-chart-rose/src/transformProps.ts Outdated
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The comparisonType value "absolute" emitted by the control panel does not match the "difference" prefix used in the backend-generated column names, causing transformData to filter out all comparison series. To resolve this, normalize the comparisonType value to "difference" before passing it to transformData in transformProps.ts.

superset-frontend/plugins/legacy-plugin-chart-rose/src/transformProps.ts

metricLabels: ensureIsArray(metrics as QueryFormMetric[]).map(
          getMetricLabel,
        ),
        timeCompare: ensureIsArray(timeCompare),
        comparisonType: comparisonType === 'absolute' ? 'difference' : comparisonType,
      })

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.35802% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.10%. Comparing base (e318607) to head (d3f490c).
⚠️ Report is 7 commits behind head on remove-legacy-viz-pipeline.

Files with missing lines Patch % Lines
...ins/legacy-plugin-chart-rose/src/transformProps.ts 0.00% 5 Missing ⚠️
...tend/plugins/legacy-plugin-chart-rose/src/index.ts 0.00% 1 Missing ⚠️
...gins/legacy-plugin-chart-rose/src/transformData.ts 98.33% 1 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                       @@
##           remove-legacy-viz-pipeline   #41726      +/-   ##
==============================================================
+ Coverage                       64.08%   64.10%   +0.01%     
==============================================================
  Files                            2687     2689       +2     
  Lines                          148467   148548      +81     
  Branches                        34262    34289      +27     
==============================================================
+ Hits                            95147    95221      +74     
- Misses                          51558    51565       +7     
  Partials                         1762     1762              
Flag Coverage Δ
javascript 69.45% <91.35%> (+0.02%) ⬆️

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.

The legacy control emits 'absolute' where the v1 compare
post-processing operation expects 'difference'; both buildQuery and the
column-name mapping now normalize it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@rusackas
rusackas merged commit bc5417c into remove-legacy-viz-pipeline Jul 3, 2026
57 checks passed
@rusackas
rusackas deleted the legacy-viz-t2-rose branch July 3, 2026 06:35
rusackas added a commit that referenced this pull request Jul 7, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 7, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 8, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 10, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 13, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 14, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 15, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 15, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 16, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 17, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 20, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 21, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 21, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 23, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
rusackas added a commit that referenced this pull request Jul 27, 2026
Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api:charts Related to the REST endpoints of charts plugins size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants