kokhlo commented on issue #44698:
URL: https://github.com/apache/superset/issues/44698#issuecomment-5845412319

   Reproduced and root-caused on main (the relevant code is unchanged since 
6.1.0):
   
   - The temporal x-axis formatter comes from 
`getXAxisFormatter(xAxisTimeFormat, resolvedTimeGrain)` in 
`plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts`. When no time 
grain is set — exactly this chart, where the temporal x-axis is the `year` 
column with no `time_grain_sqla` — `getSmartDateFormatter(undefined)` in 
`plugins/plugin-chart-echarts/src/utils/formatters.ts` returns the **raw** 
`smart_date` formatter: the `setMilliseconds(0)` normalization only exists 
inside the grain-aware wrapper, so the sub-second protection is unreachable 
precisely when no grain is known.
   - `smart_date`'s finest tier is `millisecond: '.%Lms'` 
(`packages/superset-ui-core/src/time-format/formatters/smartDate.ts`), so any 
tick value with a non-zero millisecond component renders as `.943ms`.
   - The ticks that carry sub-second noise are the axis-extent boundary labels: 
ECharts pads the time-axis extent, and the forced `showMaxLabel` boundary label 
formats that padded value. Confirmed against the repo's own echarts 6.1.0: a 
forced max label receives values like `2009-01-01T00:00:00.943Z`, and the raw 
smart_date renders them `.943ms` while grain-aware ticks stay clean years.
   - This is a regression of the family fixed for #38072 by #38083 (a 
floor-to-second wrapper on the axis formatter, with the comment "sub-second 
noise introduced by ECharts axis-extent padding"). The #38017/#41350 refactor 
moved millisecond-stripping into the grain-aware wrapper and dropped it from 
the no-grain path.
   
   Plan: in `getSmartDateFormatter`, make the no-grain path strip milliseconds 
(floor to the second) instead of returning the raw base formatter — restoring 
the #38083 protection grain-agnostically with no behavior change for grain-ful 
charts — plus a regression test in `test/utils/formatters.test.ts`: the 
no-grain formatter on a `...T00:00:00.943Z` value must render a year label, not 
`.943ms`. PR within the hour.


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