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

   SUMMARY
   
   This PR adds two new time formatters for time-series charts that display 
dates as relative days from a reference point (Day 1 = 01/01/2000), enabling 
use cases where data is normalized to a common timeline but needs to display 
relative day labels instead of actual timestamps. Problem: Users working with 
normalized time-series data (e.g., clinical trials, A/B tests, cohort studies) 
often need to:
   
   - Keep datetime columns for proper time-based chart features (zooming, 
panning, time-grain aggregation)
   - Display X-axis labels as relative days ("Day 1", "Day -1", "Day 14") 
instead of raw timestamps
   - This was not possible with existing formatters, requiring users to choose 
between proper datetime functionality OR readable relative labels
   
   Solution: Added two new time formatters:
   
   1. Relative Day (Day 1: 12:00am) - Shows both day and time (e.g., "Day 4: 
6:30pm")
   2. Relative Day (Day 1) - Shows only the day (e.g., "Day 4")
   
   Both formatters:
   - Use 01/01/2000 00:00 UTC as the reference date (Day 1)
   - Skip Day 0 (go from Day -1 to Day 1)
   - Support negative days for dates before the reference
   - Work with any datetime/timestamp column that has been normalized to this 
reference
   
   Implementation:
   - Created new TimeFormatter implementations in @superset-ui/core/time-format
   - Registered formatters in the global formatter registry
   - Added to time format dropdown in chart controls
   - Wired into ECharts X-axis rendering logic
   
   BEFORE:
   - X-axis shows raw timestamps: "2000-01-01", "2000-01-04", "1999-12-31"
   - Users must choose between datetime features OR readable labels
   
   AFTER:
   - X-axis shows relative days: "Day 1", "Day 4", "Day -1"
   - Users get both datetime functionality AND readable relative labels
   - Available in the "Time format" dropdown under chart customization
   
   Run tests:
   ```
   cd superset-frontend
   npm run test -- relativeDayFormatter
   ```


-- 
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]

Reply via email to