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

[PR] fix(timeshiftcolor): Time shift color to match the original color [superset]

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

   ### SUMMARY
   When using the "Match time shift color with original series" checkbox in Time Series charts, the color matching only worked for Line Charts. For Bar Charts and Area Charts, the time-shifted series (e.g., "1 year ago") would display a different color than the original series, even with the checkbox enabled.
   
   #### Root Cause
   
   The `getOriginalSeries()` function in `timeOffset.ts` was missing one of the three time offset naming patterns used by the backend.
   
   When the "Match time shift color with original series" checkbox is enabled, both the original series (e.g., `"COUNT(*)"`) and the derived series (e.g., `"COUNT(*), 1 year ago"`) need to produce the **same color key** so they get assigned the same color.
   
   The `getOriginalSeries()` function strips the time offset suffix to produce this key. However, it only handled two of the three patterns:
   
   | Pattern | Example | Handled? |
   | --- | --- | --- |
   | `<offset>,` | `"1 year ago, groupby_value"` | ✅ Yes |
   | `__<offset>` | `"sum__1 year ago"` | ✅ Yes |
   | `, <offset>` | `"COUNT(*), 1 year ago"` | ❌ **No** |
   
   The third pattern (`, <offset>`) is used when there's a single metric with no groupby dimensions - which is a common case for bar/area charts. Since this pattern wasn't being stripped, the derived series kept its full name as the color key, resulting in a different color than the original series.
   
   #### Solution
   
   Add the missing `, <offset>` pattern to `getOriginalSeries()` and `getTimeOffset()` in `timeOffset.ts`:
   
   ```
   // In getOriginalSeries()
   result = result.replace(`, ${compare}`, '');
   
   // In getTimeOffset()
   series.name.includes(`, ${timeOffset}`)
   ```
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   #### BEFORE
   
   https://github.com/user-attachments/assets/ba6612d4-73ee-48a0-ab79-8bbaa1b21515
   
   #### AFTER
   
   https://github.com/user-attachments/assets/abd68029-11a5-4c37-8c1f-753ddd85212e
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] 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
   


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   ## **Sequence Diagram**
   
   This PR fixes time shift color matching by normalizing additional derived series name patterns before color assignment. As a result, original and time-shifted series now resolve to the same color key across line, bar, and area charts.
   
   ```mermaid
   sequenceDiagram
       participant User
       participant Backend
       participant Transform
       participant TimeOffsetUtil
       participant ColorScale
   
       User->>Backend: Request timeseries with time compare
       Backend-->>Transform: Return original and shifted series names
       Transform->>TimeOffsetUtil: Detect offset and strip offset patterns
       TimeOffsetUtil-->>Transform: Return normalized base series key
       Transform->>Transform: Remove metric prefix for single metric with dimensions
       Transform->>ColorScale: Get color by normalized key
       ColorScale-->>Transform: Same color for original and shifted series
   ```
   
   ---
   *Generated by [CodeAnt AI](https://codeant.ai)*
   


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   @alexandrusoare Ephemeral environment spinning up at http://35.91.206.103:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/22895911423) for [375d10d](https://github.com/apache/superset/commit/375d10d)
   
   • **Environment:** http://35.89.229.130:8080 (admin/admin)
   • **Lifetime:** 48h auto-cleanup
   • **Updates:** New commits create fresh environments automatically


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/22895911423) for [375d10d](https://github.com/apache/superset/commit/375d10d)


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   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(timeshiftcolor): Time shift color to match the original color [superset]

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

   ⚠️ **DEPRECATED WORKFLOW** ⚠️
   
   @EnxDev This workflow is deprecated! Please use the new **Superset Showtime** system instead:
   
   - Replace "testenv-up" label with "🎪 trigger-start"
   - Better reliability and easier management
   - See https://github.com/mistercrunch/superset-showtime for details
   
   Processing your ephemeral environment request [here](https://github.com/apache/superset/actions/runs/23042622176). Action: **up**. More information on [how to use or configure ephemeral environments](https://superset.apache.org/docs/contributing/howtos/#github-ephemeral-environments)


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | 3ef48249980aec081619796ff0be71e6ba6c90bb |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69b3f70f4192d8000832b4ab |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-38473--superset-docs-preview.netlify.app](https://deploy-preview-38473--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.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTM4NDczLS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.AB8BOWNuHd7kaPpkCppU7R8hP9DmqF4_0q-wcNypZtA)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-38473--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(timeshiftcolor): Time shift color to match the original color [superset]

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

   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(timeshiftcolor): Time shift color to match the original color [superset]

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

   @EnxDev Ephemeral environment spinning up at http://44.245.214.179:8080. Credentials are 'admin'/'admin'. Please allow several minutes for bootstrapping and startup.


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   ## **Sequence Diagram**
   
   This PR fixes how time-shifted series are detected and mapped back to their original series so that derived series (like "1 year ago") reuse the same color as the original for all ECharts timeseries variants, including bar and area charts.
   
   ```mermaid
   sequenceDiagram
       participant User
       participant Frontend
       participant Backend
       participant ChartTransform
       participant TimeOffsetUtils
       participant ColorScale
   
       User->>Frontend: Configure timeseries with time compare and match color
       Frontend->>Backend: Run query with time comparison offsets
       Backend-->>Frontend: Return series data with offset labels
       Frontend->>ChartTransform: Render ECharts timeseries chart
       ChartTransform->>TimeOffsetUtils: Extract original series key from series name
       TimeOffsetUtils-->>ChartTransform: Original series key for color matching
       ChartTransform->>ColorScale: Get color using original series key
       ColorScale-->>ChartTransform: Shared color for original and shifted series
       ChartTransform-->>Frontend: Render chart with matching colors for time shifts
   ```
   
   ---
   *Generated by [CodeAnt AI](https://codeant.ai)*
   


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/22845844040) for [c42fedc](https://github.com/apache/superset/commit/c42fedc)


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   ⚠️ **DEPRECATED WORKFLOW** ⚠️
   
   @alexandrusoare This workflow is deprecated! Please use the new **Superset Showtime** system instead:
   
   - Replace "testenv-up" label with "🎪 trigger-start"
   - Better reliability and easier management
   - See https://github.com/mistercrunch/superset-showtime for details
   
   Processing your ephemeral environment request [here](https://github.com/apache/superset/actions/runs/23049457328). Action: **up**. More information on [how to use or configure ephemeral environments](https://superset.apache.org/docs/contributing/howtos/#github-ephemeral-environments)


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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

   The testing for this task was completed. The application is working as expected. The color for the charts are updated when the user checks/unchecks the "Match time shift color with original series" checkbox.
   
   # Scenario
   Verify the color is updated to match time shift color, when using the "Match time shift color with original series" checkbox in Time Series charts.
   
   ## Variants
   | Area Chart Variant| Status |
   | -------- | -------- |
   | 1 metric, 0 dimensions | :white_check_mark:  |
   | 1 metric, 1 dimensions | :white_check_mark:  |
   | 2+ metric, 1 dimensions | :white_check_mark:  |
   | 1 metric, 2+ dimensions | :white_check_mark:  |
   
   | Bar Chart Variant| Status |
   | -------- | -------- |
   | 1 metric, 0 dimensions | :white_check_mark:  |
   | 1 metric, 1 dimensions | :white_check_mark:  |
   | 2+ metric, 1 dimensions | :white_check_mark:  |
   | 1 metric, 2+ dimensions | :white_check_mark:  |
   
   | Lines Chart Variant| Status |
   | -------- | -------- |
   | 1 metric, 0 dimensions | :white_check_mark:  |
   | 1 metric, 1 dimensions | :white_check_mark:  |
   | 2+ metric, 1 dimensions | :white_check_mark:  |
   | 1 metric, 2+ dimensions | :white_check_mark:  |
   
   Note: It is important to mention that I also tested all the previous mentioned variants with the different "Time Shift"
   
   ## Steps
   1. Go to superset app
   2. Create a Lines/Area/Bar chart (with a valid dataset, I used "public.cleaned_sales_data")
   3. Add the following values in the "Data" tab: 
       1. X-Axis (i.e. "order date").
       2. Time Grain (i.e. "month").
       3. Metrics (i.e. "SUM(sales)")
       4. Dimensions (i.e. "deal_size")
       5. Time Shift (i.e. "28 days ago")
   4. Check/Uncheck the "Match time shift color with original series" checkbox in the "Customize" tab.
   
   ## Current result
   The chart lines/bars/areas colors are correctly updated to match the original series based on if the "Match time shift color with original series" checkbox is checked or not.
   
   ## Evidence
   Updated colors for area charts
   https://github.com/user-attachments/assets/1bcbe82f-d1b3-4278-80c8-a3bd790a074d
   
   Updated colors for bar charts
   https://github.com/user-attachments/assets/556405ea-517c-4f0e-b774-f747b4542e2a
   
   Updated colors for lines chart
   https://github.com/user-attachments/assets/7287e6b2-5590-4bf9-b448-2540ff660a1e


-- 
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(timeshiftcolor): Time shift color to match the original color [superset]

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


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