-
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
feat(chart): support negative values in logarithmic axes #16547
base: master
Are you sure you want to change the base?
feat(chart): support negative values in logarithmic axes #16547
Conversation
The logarithm of negative values is not defined. However, in the case of a logarithmic chart axis, it makes sense to define log(-x) as -log(x), to support logarithmic axes with negative values. Cf. 'symlog' in matplotlib Resolves: apache#15558
Thanks for your contribution! |
Copied from apache#16547
To reviewers: If this PR is going to be described in the changelog in the future release, please make sure this PR has one of the following labels: This message is shown because the PR description doesn't contain the document related template. |
0866148
to
ad7bc68
Compare
Hey @andreasgerstmayr, do you know if they have an estimated deadline for reviewing/merging the PR? I'm facing the same problem here |
I don't know, I'd also like to get this PR merged :) |
I would also love to see this merged. Is there anything we could do to help this along? |
@octoth0rpe was there something still missing from this PR? This feature would be highly appreciated ❤️ Tested this PR locally and it seems to be working well! |
Nothing from my perspective, but I'm not an echarts maintainer 🤷 Just another user who wants this feature! |
@Ovilia, it seems this PR has been lost in the pile of PRs. I checked that you had contributed to the log scaling before. Can you check this or maybe think of someone who could help make progress in this? |
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 the contribution!
There seems to be a bug with test/logScale.html
, where the minimal value of the yAxis should not be a negative value since the data are all positive.
And please also add zero in the test case in bar-log-negative
.
@andreasgerstmayr how are things on your plate? Are you able to fix that test page? |
@Antti-Palola I gave it a shot the other day but either the new |
The logarithm of negative values is not defined.
However, in the case of a logarithmic chart axis, it makes sense to
define log(-x) as -log(x), to support logarithmic axes with negative
values.
Cf. 'symlog' in matplotlib
Resolves: #15558
Resolves: #17459
Brief Information
This pull request is in the type of:
What does this PR do?
Supports negative values in logarithmic axes.
Fixed issues
Details
Before: What was the problem?
Axes with logarithmic scales didn't support negative values, because
Math.log()
of a negative number is undefined (NaN
). Therefore the ticks on the yAxis disappeared entirely.After: How is it fixed in this PR?
Negative values for logarithmic scales work by defining
log(-x) = -log(x)
and negative values are shown on logarithmic axes.Misc
Related test cases or examples to use the new APIs
test/bar-log-negative.html
Others
Merging options
Other information