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

   ### SUMMARY
   
   Stacked bar charts (and other ECharts time-series charts) configured with a 
temporal x-axis and Time Grain set to **None** could render a spurious label 
like `.345ms` or `:49s` at the right edge of the axis, after the last 
legitimate data label. The value comes from ECharts auto-generating an axis 
tick at the very end of the data range; that tick lands on a sub-minute 
timestamp, and the SMART_DATE multi-format renders it through its millisecond / 
second buckets (`.%Lms`, `:%Ss`) which then bleed into the visible labels.
   
   `getSmartDateFormatter` in 
`superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts` 
already had a wrapper that strips milliseconds, but it was only applied when an 
explicit `timeGrain` was provided — the no-time-grain branch returned the raw 
smart-date formatter and skipped the strip. This change always wraps, 
normalizes the date by zeroing milliseconds, and additionally returns an empty 
string for any tick that lands on a non-zero seconds boundary when no time 
grain is set. Real data points align to at least the minute level for any 
practical chart, so this only suppresses ECharts auto-generated artifacts at 
the axis edge.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before — rightmost label is `April.345ms`:
   
   
![before](https://media.app.shortcut.com/api/attachments/files/clubhouse-assets/5d8baaab-e1a8-4512-a9c7-12979c8cd1c9/69f3c081-4e82-486c-bcd2-b94cdea6d5ce/image.png)
   
   After — phantom label is gone, axis ends cleanly at `April`.
   
   ### TESTING INSTRUCTIONS
   
   1. Connect any database with a table containing a `DATE` or `TIMESTAMP` 
column.
   2. Create a new ECharts Bar Chart.
   3. Set X-axis to the date column.
   4. Set Time Grain to **None**.
   5. Add a numeric metric and a string dimension.
   6. In Customize, set Stacked Style to Stack.
   7. Update the chart and inspect the rightmost x-axis label. It should match 
the rest of the labels (e.g., a month or year) with no `.XXXms` or `:XXs` 
artifact appended.
   8. Run `npm test plugins/plugin-chart-echarts/test/utils/formatters.test.ts` 
— added regression test covers the formatter contract directly.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


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