You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/07/20 16:22:54 UTC

[PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

rusackas opened a new pull request, #42247:
URL: https://github.com/apache/superset/pull/42247

   ### 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:
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5025359769

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/29765043672) for [f351c08](https://github.com/apache/superset/commit/f351c08)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5028090020

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/29784968694) for [ab71b7a](https://github.com/apache/superset/commit/ab71b7a)
   
   • **Environment:** http://18.236.179.233:8080 (admin/admin)
   • **Lifetime:** 48h auto-cleanup
   • **Updates:** New commits create fresh environments automatically


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5025539212

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/29765043672) for [f351c08](https://github.com/apache/superset/commit/f351c08)
   
   • **Environment:** http://35.163.59.152:8080 (admin/admin)
   • **Lifetime:** 48h auto-cleanup
   • **Updates:** New commits create fresh environments automatically


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5024940381

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/42247?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `57.50000%` with `34 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 64.81%. Comparing base ([`65d2ea5`](https://app.codecov.io/gh/apache/superset/commit/65d2ea51ffc9296af0c572f6e77f163e366d8a34?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`f351c08`](https://app.codecov.io/gh/apache/superset/commit/f351c08e3a8df370060b5dd32fb9cbb52974edee?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/42247?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...chart-echarts/src/Timeseries/EchartsTimeseries.tsx](https://app.codecov.io/gh/apache/superset/pull/42247?src=pr&el=tree&filepath=superset-frontend%2Fplugins%2Fplugin-chart-echarts%2Fsrc%2FTimeseries%2FEchartsTimeseries.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvVGltZXNlcmllcy9FY2hhcnRzVGltZXNlcmllcy50c3g=) | 9.09% | [30 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/42247?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...perset/migrations/shared/migrate\_viz/processors.py](https://app.codecov.io/gh/apache/superset/pull/42247?src=pr&el=tree&filepath=superset%2Fmigrations%2Fshared%2Fmigrate_viz%2Fprocessors.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWlncmF0aW9ucy9zaGFyZWQvbWlncmF0ZV92aXovcHJvY2Vzc29ycy5weQ==) | 33.33% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/42247?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...ugin-chart-echarts/src/Timeseries/percentChange.ts](https://app.codecov.io/gh/apache/superset/pull/42247?src=pr&el=tree&filepath=superset-frontend%2Fplugins%2Fplugin-chart-echarts%2Fsrc%2FTimeseries%2FpercentChange.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvVGltZXNlcmllcy9wZXJjZW50Q2hhbmdlLnRz) | 97.29% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/42247?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...gin-chart-echarts/src/Timeseries/transformProps.ts](https://app.codecov.io/gh/apache/superset/pull/42247?src=pr&el=tree&filepath=superset-frontend%2Fplugins%2Fplugin-chart-echarts%2Fsrc%2FTimeseries%2FtransformProps.ts&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvVGltZXNlcmllcy90cmFuc2Zvcm1Qcm9wcy50cw==) | 85.71% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/42247?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@                      Coverage Diff                       @@
   ##           remove-legacy-viz-pipeline   #42247      +/-   ##
   ==============================================================
   - Coverage                       65.42%   64.81%   -0.62%     
   ==============================================================
     Files                            2786     2787       +1     
     Lines                          154933   155011      +78     
     Branches                        35623    35649      +26     
   ==============================================================
   - Hits                           101372   100469     -903     
   - Misses                          51677    52657     +980     
   - Partials                         1884     1885       +1     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `38.91% <33.33%> (-0.01%)` | :arrow_down: |
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `71.10% <58.44%> (-0.02%)` | :arrow_down: |
   | [mysql](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [postgres](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.88% <33.33%> (+<0.01%)` | :arrow_up: |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.89% <33.33%> (-0.01%)` | :arrow_down: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `58.05% <33.33%> (-1.27%)` | :arrow_down: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `57.48% <33.33%> (-0.01%)` | :arrow_down: |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/42247/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/42247?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5028143431

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/29786363266) for [b74b3eb](https://github.com/apache/superset/commit/b74b3eb)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5026069117

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/29768888440) for [214f953](https://github.com/apache/superset/commit/214f953)
   
   • **Environment:** http://54.186.110.43:8080 (admin/admin)
   • **Lifetime:** 48h auto-cleanup
   • **Updates:** New commits create fresh environments automatically


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #42247:
URL: https://github.com/apache/superset/pull/42247#discussion_r3616743191


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:
##########
@@ -63,10 +69,97 @@ export default function EchartsTimeseries({
   onLegendScroll,
 }: TimeseriesChartTransformedProps) {
   const { stack } = formData;
+  const theme = useTheme();
   const echartRef = useRef<EchartsHandler | null>(null);
   // eslint-disable-next-line no-param-reassign
   refs.echartRef = echartRef;
   const clickTimer = useRef<ReturnType<typeof setTimeout>>();
+
+  // Draggable percent-change baseline: when the rebase view is active, a
+  // vertical line is drawn on the plot; dragging it re-indexes every series
+  // to the hovered point via the composable rebase, entirely client-side.
+  const rebaseEnabled = Boolean(
+    (formData as { rebasePercentChange?: boolean }).rebasePercentChange,
+  );
+  useEffect(() => {
+    if (!rebaseEnabled) return undefined;
+    const chart = echartRef.current?.getEchartInstance?.();
+    if (!chart) return undefined;
+
+    const option = chart.getOption() as {
+      series?: { data?: SeriesDataPoint[] }[];
+    };
+    const baseSeries = (option.series ?? []).map(s =>
+      Array.isArray(s.data) ? (s.data as SeriesDataPoint[]) : [],
+    );
+    const xs = Array.from(
+      new Set(baseSeries.flat().map(([x]) => Number(x))),
+    ).sort((a, b) => a - b);

Review Comment:
   **Suggestion:** The x-values are coerced with `Number(x)` before snapping, which turns common datetime strings (for example ISO timestamps) into `NaN`; that makes baseline initialization/snap logic invalid and can break dragging behavior. Normalize/parsing should preserve valid time values instead of blind numeric coercion. [type error]
   
   <details>
   <summary><b>Severity Level:</b> Critical 🚨</summary>
   
   ```mdx
   - ❌ Percent-change baseline fails on string-based time axes.
   - ⚠️ Dragging baseline may not update series correctly.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open a Time-series Line chart in Explore that uses the ECharts renderer, which mounts
   `EchartsTimeseries` from
   `superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:50`
   for the visualization.
   
   2. Configure the chart so the x-axis values in the underlying `series.data` are datetime
   strings (for example ISO timestamps returned under `DTTM_ALIAS`), not pre-parsed numbers;
   these are read back from the chart via `chart.getOption()` in the effect at lines 89–93.
   
   3. Enable the Percent change / rebase view so `rebaseEnabled` at lines 81–83 is true,
   causing the `useEffect` at lines 84–162 to run and compute `xs` at lines 95–97 via
   `baseSeries.flat().map(([x]) => Number(x))`.
   
   4. Observe that `Number(x)` on string timestamps yields `NaN`, so `xs` contains `NaN`
   values and `baselineX = xs[0]` at line 99 becomes `NaN`; the subsequent
   `chart.convertToPixel({ xAxisIndex: 0 }, baselineX)` in `drawHandle()` at lines 110–115
   fails and the draggable baseline either does not render or behaves incorrectly when
   dragging.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=2658bc4c99a844ca8806e66195e88040&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=2658bc4c99a844ca8806e66195e88040&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
   **Line:** 95:97
   **Comment:**
   	*Type Error: The x-values are coerced with `Number(x)` before snapping, which turns common datetime strings (for example ISO timestamps) into `NaN`; that makes baseline initialization/snap logic invalid and can break dragging behavior. Normalize/parsing should preserve valid time values instead of blind numeric coercion.
   
   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
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42247&comment_hash=2c6aa33c2cbe97774f72bcdcf8eb45cbefbd95c8a3ad781ad773ac6481c3ae4d&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42247&comment_hash=2c6aa33c2cbe97774f72bcdcf8eb45cbefbd95c8a3ad781ad773ac6481c3ae4d&reaction=dislike'>👎</a>



##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:
##########
@@ -63,10 +69,97 @@ export default function EchartsTimeseries({
   onLegendScroll,
 }: TimeseriesChartTransformedProps) {
   const { stack } = formData;
+  const theme = useTheme();
   const echartRef = useRef<EchartsHandler | null>(null);
   // eslint-disable-next-line no-param-reassign
   refs.echartRef = echartRef;
   const clickTimer = useRef<ReturnType<typeof setTimeout>>();
+
+  // Draggable percent-change baseline: when the rebase view is active, a
+  // vertical line is drawn on the plot; dragging it re-indexes every series
+  // to the hovered point via the composable rebase, entirely client-side.
+  const rebaseEnabled = Boolean(
+    (formData as { rebasePercentChange?: boolean }).rebasePercentChange,
+  );
+  useEffect(() => {
+    if (!rebaseEnabled) return undefined;
+    const chart = echartRef.current?.getEchartInstance?.();
+    if (!chart) return undefined;
+
+    const option = chart.getOption() as {
+      series?: { data?: SeriesDataPoint[] }[];
+    };
+    const baseSeries = (option.series ?? []).map(s =>
+      Array.isArray(s.data) ? (s.data as SeriesDataPoint[]) : [],
+    );
+    const xs = Array.from(
+      new Set(baseSeries.flat().map(([x]) => Number(x))),
+    ).sort((a, b) => a - b);
+    if (xs.length === 0) return undefined;
+    let baselineX = xs[0];

Review Comment:
   **Suggestion:** The baseline position is stored in a local variable inside the effect, so any dependency-triggered rerun resets it to the first x-value and discards the user's dragged baseline. Persist the selected baseline in React state/ref and reapply it after rerenders/resizes. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ User-chosen baseline resets on resize or option changes.
   - ⚠️ Rebasing state cannot persist across chart re-renders.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Render a Percent change Line chart so that `EchartsTimeseries` (file
   `superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:50`)
   receives `formData.rebasePercentChange` true, making `rebaseEnabled` true at lines 81–83
   and activating the baseline effect.
   
   2. Drag the vertical baseline handle to a later x-position; the `ondrag` handler at lines
   130–139 snaps to a new x via `snapToNearestX(xs, dataX)` and calls
   `applyBaseline(snapped)` at line 138, which updates the series and assigns the new value
   to the local `baselineX` variable at line 102.
   
   3. Cause a prop change that affects the effect dependencies, such as resizing the chart
   container (changing `width`/`height` passed into `EchartsTimeseries` at lines 52–54) or
   changing `echartOptions` by interacting with controls; the `useEffect` at lines 84–162
   depends on `[rebaseEnabled, echartOptions, width, height, theme]` (line 162) and therefore
   reruns.
   
   4. On rerun, `xs` is recomputed at lines 95–97 and `baselineX` is reset to `xs[0]` at line
   99 before `drawHandle()` is called, so the handle is redrawn at the first x-value and the
   previously user-selected baseline position is lost.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b16b823ef5d441b0a20cd3d8dfbf4b0e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b16b823ef5d441b0a20cd3d8dfbf4b0e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
   **Line:** 99:99
   **Comment:**
   	*Logic Error: The baseline position is stored in a local variable inside the effect, so any dependency-triggered rerun resets it to the first x-value and discards the user's dragged baseline. Persist the selected baseline in React state/ref and reapply it after rerenders/resizes.
   
   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
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42247&comment_hash=28f6901a2ec7a0b646f23a3131a62f2691d5783233d4a4c0ace5440fa810311a&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42247&comment_hash=28f6901a2ec7a0b646f23a3131a62f2691d5783233d4a4c0ace5440fa810311a&reaction=dislike'>👎</a>



##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:
##########
@@ -63,10 +69,97 @@ export default function EchartsTimeseries({
   onLegendScroll,
 }: TimeseriesChartTransformedProps) {
   const { stack } = formData;
+  const theme = useTheme();
   const echartRef = useRef<EchartsHandler | null>(null);
   // eslint-disable-next-line no-param-reassign
   refs.echartRef = echartRef;
   const clickTimer = useRef<ReturnType<typeof setTimeout>>();
+
+  // Draggable percent-change baseline: when the rebase view is active, a
+  // vertical line is drawn on the plot; dragging it re-indexes every series
+  // to the hovered point via the composable rebase, entirely client-side.
+  const rebaseEnabled = Boolean(
+    (formData as { rebasePercentChange?: boolean }).rebasePercentChange,
+  );
+  useEffect(() => {
+    if (!rebaseEnabled) return undefined;
+    const chart = echartRef.current?.getEchartInstance?.();
+    if (!chart) return undefined;
+
+    const option = chart.getOption() as {
+      series?: { data?: SeriesDataPoint[] }[];
+    };
+    const baseSeries = (option.series ?? []).map(s =>
+      Array.isArray(s.data) ? (s.data as SeriesDataPoint[]) : [],
+    );
+    const xs = Array.from(
+      new Set(baseSeries.flat().map(([x]) => Number(x))),
+    ).sort((a, b) => a - b);
+    if (xs.length === 0) return undefined;
+    let baselineX = xs[0];
+
+    const applyBaseline = (newX: number) => {
+      baselineX = newX;
+      chart.setOption({
+        series: baseSeries.map(data => ({
+          data: rebaseSeriesData(data, newX),
+        })),
+      });
+    };
+
+    const drawHandle = () => {
+      const gridRect = { top: 0, height: chart.getHeight() };
+      let px: number;
+      try {
+        [px] = [chart.convertToPixel({ xAxisIndex: 0 }, baselineX) as number];
+      } catch {
+        return;
+      }
+      chart.setOption({
+        graphic: [
+          {
+            id: 'percent-change-baseline',
+            type: 'rect',
+            x: px - 4,
+            y: gridRect.top,
+            shape: { width: 8, height: gridRect.height },
+            style: { fill: theme.colorFillQuaternary },
+            cursor: 'ew-resize',
+            draggable: true,
+            z: 100,
+            ondrag(this: { x: number; y: number }) {
+              this.y = gridRect.top;
+              const dataX = chart.convertFromPixel(
+                { xAxisIndex: 0 },
+                this.x + 4,
+              ) as number;
+              const snapped = snapToNearestX(xs, dataX);
+              if (snapped !== undefined && snapped !== baselineX) {
+                applyBaseline(snapped);
+              }

Review Comment:
   **Suggestion:** Rebasing every series on every `ondrag` event causes repeated full `setOption` updates while the pointer moves, which can freeze or stutter large charts. Throttle/debounce drag updates (or apply on drag end with lightweight preview) to avoid a high-frequency full-series recomputation loop. [possible bug]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Dragging baseline on large charts visibly stutters.
   - ⚠️ Interactive rebasing feels laggy for heavy datasets.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Render a Percent change time-series chart using the ECharts Line chart so that
   `EchartsTimeseries` in
   `superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:50`
   is mounted with `rebaseEnabled` true (lines 81–83).
   
   2. Use a dataset that produces many series points (large `baseSeries` array built at lines
   92–94) so rebasing involves substantial data (thousands of points across series).
   
   3. Drag the vertical baseline handle drawn by `drawHandle()` at lines 110–155; during the
   drag, ECharts continuously invokes the `ondrag` handler defined at lines 130–139.
   
   4. For each drag frame where `snapToNearestX(xs, dataX)` at line 136 returns a new value,
   `applyBaseline(snapped)` at line 138 runs, calling `chart.setOption({ series:
   baseSeries.map(...) })` at lines 101–107; this repeated full-series recomputation and
   re-render on a hot interaction path causes visible stutter or freezing while the baseline
   is dragged.
   ```
   </details>
   
   [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=a16723fae8ca46fa967e3d0f95c66a16&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=a16723fae8ca46fa967e3d0f95c66a16&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx
   **Line:** 130:139
   **Comment:**
   	*Possible Bug: Rebasing every series on every `ondrag` event causes repeated full `setOption` updates while the pointer moves, which can freeze or stutter large charts. Throttle/debounce drag updates (or apply on drag end with lightweight preview) to avoid a high-frequency full-series recomputation loop.
   
   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
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42247&comment_hash=9c3949af6aca6a97e7313f4b0c7bc708dc68685bdef70603b00727ad87090815&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42247&comment_hash=9c3949af6aca6a97e7313f4b0c7bc708dc68685bdef70603b00727ad87090815&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #42247:
URL: https://github.com/apache/superset/pull/42247


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5027996408

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/29784968694) for [ab71b7a](https://github.com/apache/superset/commit/ab71b7a)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #42247:
URL: https://github.com/apache/superset/pull/42247#discussion_r3618175197


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:
##########
@@ -63,10 +69,97 @@ export default function EchartsTimeseries({
   onLegendScroll,
 }: TimeseriesChartTransformedProps) {
   const { stack } = formData;
+  const theme = useTheme();
   const echartRef = useRef<EchartsHandler | null>(null);
   // eslint-disable-next-line no-param-reassign
   refs.echartRef = echartRef;
   const clickTimer = useRef<ReturnType<typeof setTimeout>>();
+
+  // Draggable percent-change baseline: when the rebase view is active, a
+  // vertical line is drawn on the plot; dragging it re-indexes every series
+  // to the hovered point via the composable rebase, entirely client-side.
+  const rebaseEnabled = Boolean(
+    (formData as { rebasePercentChange?: boolean }).rebasePercentChange,
+  );
+  useEffect(() => {
+    if (!rebaseEnabled) return undefined;
+    const chart = echartRef.current?.getEchartInstance?.();
+    if (!chart) return undefined;
+
+    const option = chart.getOption() as {
+      series?: { data?: SeriesDataPoint[] }[];
+    };
+    const baseSeries = (option.series ?? []).map(s =>
+      Array.isArray(s.data) ? (s.data as SeriesDataPoint[]) : [],
+    );
+    const xs = Array.from(
+      new Set(baseSeries.flat().map(([x]) => Number(x))),
+    ).sort((a, b) => a - b);

Review Comment:
   Fixed — `snapToNearestX` was blindly coercing the drag target with `Number()`, which turns category-axis values (or anything non-numeric) into `NaN`. It now validates category values against the known x set instead of doing numeric distance math on them.



##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:
##########
@@ -63,10 +69,97 @@ export default function EchartsTimeseries({
   onLegendScroll,
 }: TimeseriesChartTransformedProps) {
   const { stack } = formData;
+  const theme = useTheme();
   const echartRef = useRef<EchartsHandler | null>(null);
   // eslint-disable-next-line no-param-reassign
   refs.echartRef = echartRef;
   const clickTimer = useRef<ReturnType<typeof setTimeout>>();
+
+  // Draggable percent-change baseline: when the rebase view is active, a
+  // vertical line is drawn on the plot; dragging it re-indexes every series
+  // to the hovered point via the composable rebase, entirely client-side.
+  const rebaseEnabled = Boolean(
+    (formData as { rebasePercentChange?: boolean }).rebasePercentChange,
+  );
+  useEffect(() => {
+    if (!rebaseEnabled) return undefined;
+    const chart = echartRef.current?.getEchartInstance?.();
+    if (!chart) return undefined;
+
+    const option = chart.getOption() as {
+      series?: { data?: SeriesDataPoint[] }[];
+    };
+    const baseSeries = (option.series ?? []).map(s =>
+      Array.isArray(s.data) ? (s.data as SeriesDataPoint[]) : [],
+    );
+    const xs = Array.from(
+      new Set(baseSeries.flat().map(([x]) => Number(x))),
+    ).sort((a, b) => a - b);
+    if (xs.length === 0) return undefined;
+    let baselineX = xs[0];

Review Comment:
   Fixed — the baseline position now lives in a ref so an effect rerun (resize, other option changes) reapplies the previously dragged position instead of resetting to the first x.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5024535461

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5025890676

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/29768888440) for [214f953](https://github.com/apache/superset/commit/214f953)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5024552723

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | f351c08e3a8df370060b5dd32fb9cbb52974edee |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a5e4b5e7d9fb20008ea7805 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-42247--superset-docs-preview.netlify.app](https://deploy-preview-42247--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQyMjQ3LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.Aa2RmsusLexktr8Rx2yZ1Tlhh3feznn6EoLGK4GVLBQ)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcrBDYAgDEDRXXrWpDEi6AaOUUqVgwJpuBjj7vb28_NeaFrv1mEDGCAqFc7WbI9UxibKUvrImcopJpK0qz57MrOQkzk68Wk94oSIQcgHdPD9) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-42247--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5028382713

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/29787843666) for [e6b46b5](https://github.com/apache/superset/commit/e6b46b5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5028278225

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/29786363266) for [b74b3eb](https://github.com/apache/superset/commit/b74b3eb)
   
   • **Environment:** http://16.148.127.167:8080 (admin/admin)
   • **Lifetime:** 48h auto-cleanup
   • **Updates:** New commits create fresh environments automatically


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #42247:
URL: https://github.com/apache/superset/pull/42247#discussion_r3618175855


##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.tsx:
##########
@@ -63,10 +69,97 @@ export default function EchartsTimeseries({
   onLegendScroll,
 }: TimeseriesChartTransformedProps) {
   const { stack } = formData;
+  const theme = useTheme();
   const echartRef = useRef<EchartsHandler | null>(null);
   // eslint-disable-next-line no-param-reassign
   refs.echartRef = echartRef;
   const clickTimer = useRef<ReturnType<typeof setTimeout>>();
+
+  // Draggable percent-change baseline: when the rebase view is active, a
+  // vertical line is drawn on the plot; dragging it re-indexes every series
+  // to the hovered point via the composable rebase, entirely client-side.
+  const rebaseEnabled = Boolean(
+    (formData as { rebasePercentChange?: boolean }).rebasePercentChange,
+  );
+  useEffect(() => {
+    if (!rebaseEnabled) return undefined;
+    const chart = echartRef.current?.getEchartInstance?.();
+    if (!chart) return undefined;
+
+    const option = chart.getOption() as {
+      series?: { data?: SeriesDataPoint[] }[];
+    };
+    const baseSeries = (option.series ?? []).map(s =>
+      Array.isArray(s.data) ? (s.data as SeriesDataPoint[]) : [],
+    );
+    const xs = Array.from(
+      new Set(baseSeries.flat().map(([x]) => Number(x))),
+    ).sort((a, b) => a - b);
+    if (xs.length === 0) return undefined;
+    let baselineX = xs[0];
+
+    const applyBaseline = (newX: number) => {
+      baselineX = newX;
+      chart.setOption({
+        series: baseSeries.map(data => ({
+          data: rebaseSeriesData(data, newX),
+        })),
+      });
+    };
+
+    const drawHandle = () => {
+      const gridRect = { top: 0, height: chart.getHeight() };
+      let px: number;
+      try {
+        [px] = [chart.convertToPixel({ xAxisIndex: 0 }, baselineX) as number];
+      } catch {
+        return;
+      }
+      chart.setOption({
+        graphic: [
+          {
+            id: 'percent-change-baseline',
+            type: 'rect',
+            x: px - 4,
+            y: gridRect.top,
+            shape: { width: 8, height: gridRect.height },
+            style: { fill: theme.colorFillQuaternary },
+            cursor: 'ew-resize',
+            draggable: true,
+            z: 100,
+            ondrag(this: { x: number; y: number }) {
+              this.y = gridRect.top;
+              const dataX = chart.convertFromPixel(
+                { xAxisIndex: 0 },
+                this.x + 4,
+              ) as number;
+              const snapped = snapToNearestX(xs, dataX);
+              if (snapped !== undefined && snapped !== baselineX) {
+                applyBaseline(snapped);
+              }

Review Comment:
   Fixed — ondrag now coalesces to at most one setOption per animation frame instead of rebasing every series on every raw pointer-move event.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5028199663

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/29786869841) for [40f0081](https://github.com/apache/superset/commit/40f0081)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] feat(timeseries): percent-change rebasing with a draggable baseline [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #42247:
URL: https://github.com/apache/superset/pull/42247#issuecomment-5028580843

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/29787843666) for [e6b46b5](https://github.com/apache/superset/commit/e6b46b5)
   
   • **Environment:** http://52.89.216.10:8080 (admin/admin)
   • **Lifetime:** 48h auto-cleanup
   • **Updates:** New commits create fresh environments automatically


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org