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

   ### SUMMARY
   
   Fixes #28204
   
   On a temporal x-axis (any chart using a time grain), Superset hands ECharts 
`xAxis.type: 'time'`, a continuous linear scale. Bars/points are placed at 
their exact timestamp, but ECharts auto-computes "nice" tick positions (month 
boundaries, even N-day divisions) that don't coincide with the actual buckets. 
With weekly grain this is very visible: a bucket starting `Nov 30` renders 
right on top of the `Dec` tick, and 5 weekly bars can produce 8 misaligned 
ticks.
   
   Superset already has the right tool for this: the **Force categorical** 
toggle (`xAxisForceCategoricalControl`), which switches the axis to `type: 
'category'` so each bucket becomes a discrete, tick-aligned category. The 
transform layer already handles temporal data on a categorical axis (the date 
formatter is selected by column type, not axis type). The only thing blocking 
these users was the control's `visibility` gate, which only showed the toggle 
for **Numeric** x-axis columns.
   
   This PR expands that gate to include **Temporal** columns, so the toggle is 
exposed for time-grain charts. The numeric-only "auto-force when sorted" logic 
in `initialValue` is untouched, so existing temporal charts keep their 
continuous time scale unless the user explicitly opts in (default stays 
`false`).
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before: on weekly grain, the "Force categorical" toggle is hidden for date 
x-axes, so ticks land between the weekly markers (see [the reporter's 
screenshots](https://github.com/apache/superset/discussions/18338#discussioncomment-15871141)).
   
   After: the toggle appears for temporal x-axes; enabling it renders one 
category per bucket with aligned, date-formatted ticks.
   
   ### TESTING INSTRUCTIONS
   
   1. Create a Bar Chart (or Line/Area/Mixed) with a temporal x-axis and 
**Week** time grain.
   2. Confirm a new **Force categorical** checkbox now appears under the Query 
section (it previously only showed for numeric x-axes).
   3. Enable it and verify each weekly bucket gets its own tick, with labels 
formatted as dates and aligned to the bars/markers.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Fixes #28204
   - [ ] 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]

Reply via email to