-
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(axis): allow stacking on value xAxis #19653
base: master
Are you sure you want to change the base?
fix(axis): allow stacking on value xAxis #19653
Conversation
…nd Y are stackable
Thanks for your contribution! |
Hello! Thanks! |
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19653@02a682d |
@gooroodev review |
1. Summary of ChangesThe pull request aims to enable stacking on the value xAxis. The changes include:
2. Issues, Bugs, or TyposIssue 1: Typo in Comments
Issue 2: Potential Redundancy in the
3. General Review of Code Quality and Style
Overall, the pull request is well-implemented and makes the necessary changes to allow stacking on the value xAxis while maintaining compatibility with existing functionality. The suggested improvements are minor and primarily focused on readability and slight optimization. Yours, Gooroo.dev. To receive reviews automatically, install Github App |
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 for making this pull request! A lot of developers are asking for this feature so it's nice to see this PR~
There seems to be a problem when the first series doesn't contain value while the second series has. See the demo.
Please add more test cases to ensure we considered enough marginal conditions.
Hi, I need similar feature for my project. it seems we already have PR for the issue, when can we expect to get it committed? |
Brief Information
This pull request is in the type of:
What does this PR do?
On cartesian charts when both X and Y axes have type
value
the stack dimension is selected incorrectly which leads to broken stacked charts. This PR prevents X-axis coord dimension when Y-axis coord dimension is also stackable which allows having stacked vertical charts while not changing the API.Further, to properly support stacked horizontal charts with both stackable axes, the API should be extended.
Minimal reproduction
ECharts supports stacking on the other continuous scale
time
so it would make sense to support it forvalue
as well. Multiple created issues requesting the feature validate the needs of the community.Why not to approximate it with the
category
scale?Approximating continuous
value
scale withcategory
one is not a great option because there is limitless set of sparse datasets which require adding many fake values to make the scale look continuous which affects performance. At the same time, the added fake empty values will be no distinguishable with real empty values coming from the dataset. This affectsconnectNulls
option. Finally, besides the inability to provide the same functionality and experience with the approximation, it also disproportionately complicates the client code: find gcd of each interval, consider number of intervals per pixel, handle x-axis ticks so it shows only "nice" values, etc.Fixed issues
Details
Before: What was the problem?
Stacking did not work on
value
xAxis. There are two stacked bar series on this screenshot:After: How does it behave after the fixing?
Stacking works correctly on
value
xAxis:Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
N.A.
Others
Merging options
Other information
If I understand the code correctly, existing API of ECharts does not let explicitly define whether a 2d cartesian chart is vertical or horizontal. It is decided based on X and Y axes types: if X-axis is ordinal or time, then it is a vertical chart but if Y-axis is one of these types then it is a horizontal chart. This leads to the undefined behavior when both X and Y axes have value type and there should be an option to set it explicitly for such cases. This PR strives to provide a minimalistic fix without changing API and breaking any existing defined behavior. It follows already existing logic of giving preference to X-axis dimension as the one to be stacked on dimension.