rusackas opened a new pull request, #44818:
URL: https://github.com/apache/superset/pull/44818
### SUMMARY
Follow-up to #44628. `getXAxisDomain` (used by `getGrainBarMaxWidth` and the
x-axis label spacing formatter) only recognized `typeof value === 'number'`
temporal x-axis values. A temporal column whose rows come through as `Date`
objects or ISO strings instead of raw epoch-ms numbers found no domain
bounds at all, so:
- `getGrainBarMaxWidth`'s grain-aware sparse-bar sizing (added in #44628)
silently fell back to the old flat 100px cap.
- `createSpacedXAxisFormatter`'s collision-avoidance spacing lost its
data-extent estimate.
This was flagged by codeant on #44628
([series.ts
thread](https://github.com/apache/superset/pull/44628#discussion_r4110029294),
[Timeseries/transformProps.ts
thread](https://github.com/apache/superset/pull/44628#discussion_r4110029298))
as real but pre-existing, not something #44628 introduced — it traces back
to `getXAxisDomain` itself, added in #43669.
`getTemporalTickValues` (also from #43669) already had the correct
number/`Date`/ISO-string coercion logic for exactly this problem. Rather than
duplicate it, this extracts it into a shared `coerceTemporalMs` helper in
`formatters.ts` and has both `getXAxisDomain` and `getTemporalTickValues`
call it, instead of `getTemporalTickValues` carrying its own private copy.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — internal data-extent computation, not a visual change for the
already-covered numeric case. Only changes behavior for temporal columns
whose values arrive as `Date`/ISO-string instead of epoch-ms numbers.
### TESTING INSTRUCTIONS
Automated:
```bash
npx jest plugins/plugin-chart-echarts/test/utils/formatters.test.ts \
plugins/plugin-chart-echarts/test/utils/series.test.ts \
plugins/plugin-chart-echarts/test/Timeseries/Bar/sparseSubDailyBarGeometry.test.ts
```
New `coerceTemporalMs`/`getXAxisDomain` tests in `formatters.test.ts` cover
numbers, `Date` objects, zoned/zone-less/date-only ISO strings, a mix of all
three across combined query results (the `MixedTimeseries` case), and
nullish/unparseable values. A new `getGrainBarMaxWidth` describe block in
`series.test.ts` confirms numeric, `Date`, and ISO-string x-columns all
produce the same grain-aware width. All 175 tests across the three affected
files pass locally, including the pre-existing `getTemporalTickValues` suite
(unchanged behavior, now sharing the extracted helper) and #44628's own
sparse-bar geometry regression test.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] 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]