You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "jesperct (via GitHub)" <gi...@apache.org> on 2026/05/08 17:11:31 UTC

[PR] fix(echarts): hide phantom sub-minute ticks on temporal x-axis with no time grain [superset]

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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(echarts): hide phantom sub-minute ticks on temporal x-axis with no time grain [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39972:
URL: https://github.com/apache/superset/pull/39972#issuecomment-4408364982

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(echarts): suppress phantom x-axis label at axis edge when no time grain [superset]

Posted by "jesperct (via GitHub)" <gi...@apache.org>.
jesperct commented on PR #39972:
URL: https://github.com/apache/superset/pull/39972#issuecomment-4409283703

   > The flagged issue is correct—the new no-grain branch in getSmartDateFormatter suppresses all axis labels for timestamps with non-zero seconds, hiding legitimate second-level data in Gantt and BigNumber charts that don't pass a time grain. To resolve, restrict suppression by removing the blank return for non-zero seconds in no-grain contexts, reverting to the original baseFormatter behavior. This prevents valid labels from becoming blank while addressing phantom ticks through other means if needed.
   > 
   > **superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts**
   > 
   > ```
   > export const getSmartDateFormatter = (timeGrain?: string) => {
   >   const baseFormatter = getTimeFormatter(SMART_DATE_ID);
   > 
   >   return new TimeFormatter({
   >     id: SMART_DATE_ID,
   >     label: baseFormatter.label,
   >     formatFunc: (date: Date) => {
   >       const normalizedDate = new Date(date);
   >       normalizedDate.setMilliseconds(0);
   > 
   >       if (!timeGrain) {
   >         return baseFormatter(normalizedDate);
   >       }
   > 
   >       if (timeGrain === TimeGranularity.YEAR) {
   >         // Set to January 1st at midnight UTC - smart formatter will show year
   >         const year = normalizedDate.getUTCFullYear();
   > ```
   
   Actual good feedback from the bot, already addressed by going deeper into the code and finding the root cause


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(echarts): suppress phantom x-axis label at axis edge when no time grain [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe merged PR #39972:
URL: https://github.com/apache/superset/pull/39972


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(echarts): hide phantom sub-minute ticks on temporal x-axis with no time grain [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #39972:
URL: https://github.com/apache/superset/pull/39972#issuecomment-4408374237

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | f5944dd47bef229e05e872978da5acb92ebf92a2 |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69fe19444a488c000810de4e |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-39972--superset-docs-preview.netlify.app](https://deploy-preview-39972--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTM5OTcyLS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.xvFgq7wV6UVqMpiZ7wUGcXif7hzRutvyXAVdN2M_NpM)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcpLCoAgEADQu8y6IYMhrBt0jElHlD6KujCiu-fuLd4LKccrVVgBBtgz38Z3u9BGMZ5zLdiQWyh4FTyFj76spDM-m-1vXpxMCxExaW2UUnpSVkjg-wE) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-39972--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(echarts): suppress phantom x-axis label at axis edge when no time grain [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39972:
URL: https://github.com/apache/superset/pull/39972#issuecomment-4410701134

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(echarts): hide phantom sub-minute ticks on temporal x-axis with no time grain [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #39972:
URL: https://github.com/apache/superset/pull/39972#discussion_r3210610581


##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts:
##########
@@ -39,23 +39,20 @@ export const getSmartDateDetailedFormatter = () =>
 export const getSmartDateFormatter = (timeGrain?: string) => {
   const baseFormatter = getTimeFormatter(SMART_DATE_ID);
 
-  // If no time grain provided, use the standard smart date formatter
-  if (!timeGrain) {
-    return baseFormatter;
-  }
-
-  // Create a wrapper that normalizes dates based on time grain
   return new TimeFormatter({
     id: SMART_DATE_ID,
     label: baseFormatter.label,
     formatFunc: (date: Date) => {
-      // Create a normalized date based on time grain to ensure consistent smart formatting
       const normalizedDate = new Date(date);
-
-      // Always remove milliseconds to prevent .XXXms format
       normalizedDate.setMilliseconds(0);
 
-      // For all time grains, normalize using UTC methods to avoid timezone issues
+      if (!timeGrain) {
+        if (normalizedDate.getUTCSeconds() !== 0) {
+          return '';
+        }
+        return baseFormatter(normalizedDate);

Review Comment:
   **Suggestion:** This new no-grain branch drops every tick whose timestamp has non-zero seconds, which suppresses legitimate labels for real second-level data (not just phantom edge ticks). `getXAxisFormatter` is also used by charts like Gantt/BigNumber that do not pass a time grain, so valid axis labels can become blank across the chart. Restrict this suppression to proven synthetic edge ticks (or to contexts where minute alignment is guaranteed) instead of applying it to all no-grain temporal axes. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Gantt chart x-axis hides legitimate second-level time labels.
   - ⚠️ BigNumber trendline loses labels for second-resolution timestamps.
   - ⚠️ Timeseries charts without time grain suppress valid axis ticks.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Configure a Gantt chart using the ECharts Gantt plugin
   (`superset-frontend/plugins/plugin-chart-echarts/src/Gantt/index.ts`) on a dataset whose
   `startTime` column is a TIMESTAMP with non-zero seconds (e.g. `2025-04-15T12:34:56Z`); the
   chart's transform entrypoint is `transformProps` in `src/Gantt/transformProps.ts:111`.
   
   2. At `src/Gantt/transformProps.ts:50–53`, the form data is merged with
   `DEFAULT_FORM_DATA` from `src/constants.ts:116`, which re-exports
   `Timeseries/constants.ts:37–75` where `xAxisTimeFormat` defaults to `'smart_date'` (the
   `SMART_DATE_ID`), and at `src/Gantt/transformProps.ts:123` the code builds `const
   xAxisFormatter = getXAxisFormatter(xAxisTimeFormat);`.
   
   3. Later in the same file, the x-axis configuration sets `axisLabel.formatter:
   xAxisFormatter` (`src/Gantt/transformProps.ts:455–462`), so ECharts calls
   `getXAxisFormatter` from `src/utils/formatters.ts:172–177` with `format='smart_date'` and
   `timeGrain` omitted (`undefined`), which returns `getSmartDateFormatter(timeGrain)`.
   
   4. Inside `getSmartDateFormatter` (`src/utils/formatters.ts:39–55`), the new no-grain
   branch at lines 49–53 (`if (!timeGrain) { if (normalizedDate.getUTCSeconds() !== 0) return
   ''; ... }`) runs for all of these charts: for any axis tick at a timestamp with non-zero
   seconds, `formatFunc` returns an empty string, so legitimate second-level Gantt x-axis
   labels render blank; the same formatter is also used in BigNumber-with-trendline charts
   via `getXAxisFormatter(timeFormat)` at
   `src/BigNumber/BigNumberWithTrendline/transformProps.ts:245–247, 36–37`, causing the same
   blanking of valid second-resolution timestamps there.
   ```
   </details>
   
   [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fplugins%2Fplugin-chart-echarts%2Fsrc%2Futils%2Fformatters.ts%0A%2A%2ALine%3A%2A%2A%2049%3A53%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20This%20new%20no-grain%20branch%20drops%20every%20tick%20whose%20timestamp%20has%20non-zero%20seconds%2C%20which%20suppresses%20legitimate%20labels%20for%20real%20second-level%20data%20%28not%20just%20phantom%20edge%20ticks%29.%20%60getXAxisFormatter%60%20is%20also%20used%20by%20charts%20like%20Gantt%2FBigNumber%20that%20do%20not%20pass%20a%20time%20grain%2C%20so%20valid%20axis%20labels%20can%20become%20blank%20across%20the%20chart.%20Restrict%20this%20suppression%20to%20proven%20synthetic%20edge%20ticks%20%28or%20to%20contexts%20where%20minute%20alignment%20is%20guaranteed%29%20instead%20of%20applying%20it%20to%20all%20no-grain%20temporal%20axes.%0A%0AValidate%20th
 e%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fplugins%2Fplugin-chart-echarts%2Fsrc%2Futils%2Fformatters.ts%0A%2A%2ALine%3A%2A%2A%2049%3A53%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20This%20new%20no-grain%20branch%20drops%20every%20tick%20whose%20timestamp%20has%20non-zero%20seconds%2C%20which%20suppresses%20legitimate%2
 0labels%20for%20real%20second-level%20data%20%28not%20just%20phantom%20edge%20ticks%29.%20%60getXAxisFormatter%60%20is%20also%20used%20by%20charts%20like%20Gantt%2FBigNumber%20that%20do%20not%20pass%20a%20time%20grain%2C%20so%20valid%20axis%20labels%20can%20become%20blank%20across%20the%20chart.%20Restrict%20this%20suppression%20to%20proven%20synthetic%20edge%20ticks%20%28or%20to%20contexts%20where%20minute%20alignment%20is%20guaranteed%29%20instead%20of%20applying%20it%20to%20all%20no-grain%20temporal%20axes.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the
 %20correctness%20and%20implement%20a%20minimal%20fix%0A)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts
   **Line:** 49:53
   **Comment:**
   	*Logic Error: This new no-grain branch drops every tick whose timestamp has non-zero seconds, which suppresses legitimate labels for real second-level data (not just phantom edge ticks). `getXAxisFormatter` is also used by charts like Gantt/BigNumber that do not pass a time grain, so valid axis labels can become blank across the chart. Restrict this suppression to proven synthetic edge ticks (or to contexts where minute alignment is guaranteed) instead of applying it to all no-grain temporal axes.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39972&comment_hash=75390f58a805062e1bd6f278a854ddb5740601e0a8abf46b15da6f9721eeebde&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39972&comment_hash=75390f58a805062e1bd6f278a854ddb5740601e0a8abf46b15da6f9721eeebde&reaction=dislike'>👎</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(echarts): hide phantom sub-minute ticks on temporal x-axis with no time grain [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39972:
URL: https://github.com/apache/superset/pull/39972#issuecomment-4408925159

   <!-- Bito Reply -->
   The flagged issue is correct—the new no-grain branch in getSmartDateFormatter suppresses all axis labels for timestamps with non-zero seconds, hiding legitimate second-level data in Gantt and BigNumber charts that don't pass a time grain. To resolve, restrict suppression by removing the blank return for non-zero seconds in no-grain contexts, reverting to the original baseFormatter behavior. This prevents valid labels from becoming blank while addressing phantom ticks through other means if needed.
   
   **superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts**
   ```
   export const getSmartDateFormatter = (timeGrain?: string) => {
     const baseFormatter = getTimeFormatter(SMART_DATE_ID);
   
     return new TimeFormatter({
       id: SMART_DATE_ID,
       label: baseFormatter.label,
       formatFunc: (date: Date) => {
         const normalizedDate = new Date(date);
         normalizedDate.setMilliseconds(0);
   
         if (!timeGrain) {
           return baseFormatter(normalizedDate);
         }
   
         if (timeGrain === TimeGranularity.YEAR) {
           // Set to January 1st at midnight UTC - smart formatter will show year
           const year = normalizedDate.getUTCFullYear();
   ```


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org