-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Time shifts calculation for ECharts plugins #28432
fix: Time shifts calculation for ECharts plugins #28432
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #28432 +/- ##
==========================================
+ Coverage 60.48% 70.18% +9.69%
==========================================
Files 1931 1944 +13
Lines 76236 77322 +1086
Branches 8568 8672 +104
==========================================
+ Hits 46114 54265 +8151
+ Misses 28017 20933 -7084
- Partials 2105 2124 +19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @michael-s-molina for the fix. Overall this LGTM, especially given we synced up offline to discuss the underlying logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Ephemeral environment shutdown and build artifacts deleted. |
(cherry picked from commit 821c7d7)
(cherry picked from commit b88a528)
SUMMARY
As part of of [SIP-50] Proposal for using ECharts as our main charting library, we're currently testing Line and Area chart migrations using Airbnb's production data. During these tests, we found many problems when comparing how legacy and ECharts plugins calculate and display time shifts. This PR fixes the following issues:
Time shifts when the their granularity do not match the chart's granularity
In this example, we have a chart with a monthly granularity but with a 52 weeks offset. This is how the legacy line chart correctly renders the chart:
The ECharts line chart was incorrectly calculating the time shift when applying the 52 weeks offset due to differences in terms of granularity. Observe how the peak in November 2003 (296) does not match the time shift in 2004 (70).
Now the ECharts line chart correctly calculates the time shift and matches its legacy version.
How time shifts are displayed when there's missing data
Previously, when time shift data was not available, the chart was rendered with line gaps which is different than the legacy version.
Now, the line gaps are gone and the dots are connected without a data point which is exactly how the legacy chart displays this scenario.
There is also an error about how the legacy version displays missing data depending on the chosen granularity. In this example we have a chart with daily granularity and we only have time shift data for some data points. The legacy chart displays a line for every data point and assumes that the time shift is the same as the series which is not correct.
With this fix, only available time shifts are displayed and the tooltip display the correct information when a time shift is not available.
How multiple time shifts are displayed
Previously, multiple time shifts were displayed using the same line pattern, which is confusing and require users to check the tooltips to see the actual time shift.
Now, it behaves exactly as the legacy version where each time shift is displayed using a different line pattern.
TESTING INSTRUCTIONS
To test the PR use the Advanced Analytics controls and play with different time shift settings. I tested the algorithm using Airbnb's production data using more than 100 charts and added extra unit tests.
ADDITIONAL INFORMATION