superset
superset copied to clipboard
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