bikash-barnwal opened a new pull request, #43175: URL: https://github.com/apache/superset/pull/43175
### SUMMARY A sort-only metric — one set through `timeseries_limit_metric` / `x_axis_sort` that is not among the chart's metrics — is part of the query, so enabling time comparison makes the backend emit a derived column for it alongside the derived columns for the displayed metrics. `transformProps` built `extraMetricLabels` from the sort metric's base label only, so the shifted column survived the filter in `sortAndFilterSeries` and rendered as an extra series named `<metric>__<offset>` — visible in the chart and the legend, and counted into the stacked totals. Derived columns keep the *raw* metric label with an `__<offset>` suffix (verbose mapping applies to base columns only, see `rebaseForecastDatum`), so resolving the base label through `verboseMap` cannot match them. This adds one `<raw label>__<offset>` entry per configured offset to `extraMetricLabels`, and hoists `timeCompareOffsets` above its first use. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Before: series/legend include a `sort_metric__1 year ago` entry that was never asked for. After: only the chart's own metrics and their shifted counterparts are rendered. ### TESTING INSTRUCTIONS Unit test added next to the existing sort-only-metric coverage: ```bash cd superset-frontend npm run test -- plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts ``` Manually, on a Time-series chart: 1. Pick one or more metrics, then set **Sort by** (`timeseries_limit_metric`) to a metric that is *not* in the metrics list. 2. Under Advanced Analytics, add a time shift (e.g. `1 year ago`) with comparison type `values`. 3. Run the query. Before this change the legend carries an extra `<sort metric>__1 year ago` series; after it, only the chosen metrics and their shifted series appear. ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #43138 - [ ] Required feature flags: - [x] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] 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 🤖 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
