fix(echarts): correct time shift handling in Timeseries transformProps#38126
fix(echarts): correct time shift handling in Timeseries transformProps#38126YousufFFFF wants to merge 2 commits intoapache:masterfrom
Conversation
Code Review Agent Run #1b0812Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
5894a6d to
e5221d6
Compare
Code Review Agent Run #dc6bb3Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
e83c65c to
837d432
Compare
Code Review Agent Run #f8bf02Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
837d432 to
eb1b3be
Compare
There was a problem hiding this comment.
Code Review Agent Run #aee9e6
Actionable Suggestions - 1
-
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts - 1
- Add tests for time_shift feature · Line 684-702
Review Details
-
Files reviewed - 3 · Commit Range:
04d8cad..eb1b3be- superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
- superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
- superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ Successful
Bito Usage Guide
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 documentation for additional commands.
Configuration
This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.
Documentation & Help
| const shiftMs = parseTimeShiftToMs((layer as any)?.overrides?.time_shift); | ||
|
|
||
| const result = annotationData[name]; | ||
| const isHorizontal = orientation === OrientationType.Horizontal; | ||
| const { records } = result; | ||
| if (records) { | ||
| const data = records.map(record => { | ||
| const keys = Object.keys(record); | ||
| const x = keys.length > 0 ? record[keys[0]] : 0; | ||
|
|
||
| let x = keys.length > 0 ? record[keys[0]] : 0; | ||
| const y = keys.length > 1 ? record[keys[1]] : 0; | ||
|
|
||
| if (shiftMs !== 0 && x != null) { | ||
| const xMs = typeof x === 'string' ? new Date(x).getTime() : Number(x); | ||
|
|
||
| if (!Number.isNaN(xMs)) { | ||
| x = xMs + shiftMs; | ||
| } | ||
| } |
There was a problem hiding this comment.
The new time_shift feature in transformTimeseriesAnnotation lacks test coverage. Existing tests in transformers.test.ts verify data transformation but don't test the time shifting logic added here.
Code Review Run #aee9e6
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
SUMMARY
This PR fixes incorrect time shift behavior in the ECharts Timeseries path used by the Bar chart.
Fixes #36966.
Previously, when a time shift (e.g., 1 month, 5 months) was applied, the shifted series was not properly aligned during series construction inside
transformProps.ts. This caused incorrect rendering and misalignment of shifted data along the x-axis.This update corrects the time shift handling logic to ensure proper timestamp alignment and consistent rendering across different shift values and dimension combinations.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before (Time Shift Not Functioning Correctly)
After (Time Shift Working as Expected)
Base.Test.-.Google.Chrome.2026-02-20.23-36-29.mp4
TESTING INSTRUCTIONS
1 month,5 months)Tested locally using Docker environment.
ADDITIONAL INFORMATION