fix(viz): display offset metrics as dashed lines regardless of compar…
SUMMARY
Fixes #36806
This PR fixes a regression where offset metrics (time comparisons like "1 year ago") were not displayed as dashed lines when charts have no dimensions.
Root Cause:
The isDerivedSeries function only applied dashed styling when comparison_type === "Values", and hasTimeOffset didn't detect series where the name exactly matched a time offset (which happens when there are no dimensions).
Changes:
- Removed the restrictive
comparison_type === "Values"check inisDerivedSeries.ts - Added exact match handling in
timeOffset.tsfor dimension-less charts - Updated tests to reflect new behavior
BEFORE/AFTER
BEFORE
**AFTER **
TESTING INSTRUCTIONS
- Create a new Line Chart
- Select a dataset with a time column (e.g.,
birth_nameswithds) - Add a metric (e.g.,
COUNT(*)) - Set Time Range to a valid range (e.g.,
2005-01-01 to 2008-12-31) - In Advanced Analytics, add Time Comparison:
1 year ago - Do NOT add any dimensions (leave Dimensions empty)
- Click "Update Chart"
- Verify the offset metric line (
1 year ago) appears dashed, not solid
ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #36806
- [ ] Required feature flags: None
- [x] Changes UI
- [ ] Includes DB Migration
- [ ] 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 is reviewing your PR.
Thanks for using CodeAnt! 🎉
We're free for open-source projects. if you're enjoying it, help us grow by sharing.
Share on X · Reddit · LinkedIn
Deploy Preview for superset-docs-preview canceled.
| Name | Link |
|---|---|
| Latest commit | 845701eefc75961a33be499c6ab77bbec603ee02 |
| Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/695cea981190d60008f288ce |
Code Review Agent Run #ff9a91
Actionable Suggestions - 0
Review Details
-
Files reviewed - 3 · Commit Range:
845701e..845701e- superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/isDerivedSeries.ts
- superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/timeOffset.ts
- superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/isDerivedSeries.test.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 [email protected].
Documentation & Help
Nitpicks 🔍
| 🔒 No security issues identified |
⚡ Recommended areas for review
|
CodeAnt AI finished reviewing your PR.
CodeAnt AI is running Incremental review
Thanks for using CodeAnt! 🎉
We're free for open-source projects. if you're enjoying it, help us grow by sharing.
Share on X · Reddit · LinkedIn
Code Review Agent Run #e4959d
Actionable Suggestions - 0
Review Details
-
Files reviewed - 3 · Commit Range:
845701e..94997dd- superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/isDerivedSeries.ts
- superset-frontend/packages/superset-ui-chart-controls/src/operators/utils/timeOffset.ts
- superset-frontend/packages/superset-ui-chart-controls/test/operators/utils/isDerivedSeries.test.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 [email protected].
Documentation & Help