-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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 stacked areas overflow on null values when connectNulls is true #19602
base: master
Are you sure you want to change the base?
Fix stacked areas overflow on null values when connectNulls is true #19602
Conversation
Thanks for your contribution! |
The purpose of stacked lines is to show totals. This PR would make totals at all red points incorrect. |
@helgasoft thanks for your feedback. In my pull request I addressed areas stacking when Manually interpolating values would break the To summarize
Based on these points, I believe this change is valid to be merged to the library code. |
I think connectNulls should not be enabled in stacked area charts since it makes ECharts display fake totals. Here are the two methods of data preprocessing - approximate or remove missing values, Demo Code |
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19602@536da2c |
e4ed74c
to
194a793
Compare
194a793
to
536da2c
Compare
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.
While I do agree with @helgasoft that stacked null values make the sum value misleading, I personally think this PR provides a much better solution than our current implementation. And the viewer can judge from the broken area to see that you can't take y values as sums, which I think should be better if the developers don't know how or don't bother to remove null values. Let's see what others think about this feature.
A strong argument in favor would be to find out whether another charting library (highcharts, amcharts, ?) has taken a chance on implementing it. |
f1a67c7
to
934cb6a
Compare
approximate solution fixed my problem: 💯 👍The data preprocessing - approximate solution fixed my problem: In my case, when rendering the area range (minimum value, maximum value), and latest, I used the solution shown in the code before and applied a function to approximate the values. After approximate null values 👍 I added a custom tooltip to render the original value instead of the approximate value. |
@gooroodev review |
1. Summary of ChangesThe pull request addresses an issue where stacked areas overflow on null values when the
2. Issues, Bugs, or TyposIssue 1: Unnecessary Check on
|
Brief Information
This pull request is in the type of:
What does this PR do?
Minimal reproduction
Fix on the preview branch
The pull request fixes the logic of computing stacked on points of stacked areas which fixes areas overflow on null values when
connectNulls
is true.Stacked on value can be
NaN
when:stackStrategy
NaN
The
getStackedOnPoint
function behaved the same in both scenarios, when the stacked on value isNaN
it decided that the area should be stacked on thevalueStart
of the series coordinates. However, when the value of series itself isNaN
the stacked on value should be NaN as well forconnectNulls
option to work correctly and just connect the line without dropping it to the start of coordinates.Fixed issues
Closes #19598
Closes #17135
Details
There is an existing test case
area-stack.html
which has a chart affected by the issue.Before: What was the problem?
Yellow and blue areas have enabled
connectNulls
so the lines in the middle are connected but areas drop to the start of coordinates.After: How does it behave after the fixing?
After the fix not only the lines are connected but also areas.
Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
area-stack.html -> line break
Others
Merging options
Other information