-
Notifications
You must be signed in to change notification settings - Fork 19.7k
feat(axis): support dataMin/dataMax to calc a nice axis range #20838
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
base: master
Are you sure you want to change the base?
Conversation
Thanks for your contribution! Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the |
I’ve experienced this problem as a user so interested to see how this PR progresses, I will say the naming here is a bit confusing, especially since ECharts already supports a different concept as: |
I intentionally use the terms
|
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.
This seems a little unexpected to me. Have you tried with the callback of axis.min?
yAxis: {
max: value => Math.max(value, 1000)
}
or simply
yAxis: {
max: 'dataMax'
}
Neither approach works in this case. |
@Justin-ZS Can you further explain in which case should I set max value to be some rounded value larger than my given value, instead of not setting |
When comparing multiple similar charts. (like sales data from different stores, one chart for one store) |
Brief Information
This pull request is in the type of:
What does this PR do?
Add
dataMin
anddataMax
properties for value axes to extend the axis range while preserving nice scale algorithm.Fixed issues
Details
Before: What was the problem?
Currently, ECharts provides two ways to set axis range:
min
/max
to set fixed values, but this disables the nice scale algorithmThere was no way to ensure a specific data point would be included in the axis range while still benefiting from the nice scale algorithm.
After: How does it behave after the fixing?
With the new
dataMin
/dataMax
properties, users can:These properties are only effective for value axes (
value
,log
) and have no effect on category axes.Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
Test cases have been included in
test/axis-data-min-max.html
to verify different scenarios including:Others
Merging options
Other information