Skip to content
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

Support negative values for log Scale. #20872

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Antti-Palola
Copy link

@Antti-Palola Antti-Palola commented Mar 27, 2025

Support implemented by inverting the extents at input and handling the input as absolute value and finally mapping everything back to negative axes in inverted order.

Added test cases for passing through 0 power and new a new file logScale-negative.html.

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Add support for plotting negative values on Log scales.

Fixed issues

Fix a previous PR #16547 more generically and correctly.

Details

Before: What was the problem?

Negative values could not be plotted with log scaling.

After: How does it behave after the fixing?

Log scale can now be used

Before: nothing is drawn
Screenshot 2025-03-27 at 23 06 24

After
Screenshot 2025-03-27 at 23 04 38

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

There is no mention of negative values having problems in docs.

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

  • Please squash the commits into a single one when merging.

Other information

Copy link

echarts-bot bot commented Mar 27, 2025

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

@Antti-Palola Antti-Palola force-pushed the fix-logarithmic-scale-negative-below-one branch from c021cff to c67121f Compare March 27, 2025 21:16
Support implemented by inverting the extents at input and handling the
input as absolute value and finally mapping everything back to negative
axes in inverted order.

Added test cases for passing through 0 power and new a new file ogScale-negative.html.
Properly inherit IntervalScale and inline the only thing
that really was required from Scale base class `unionExtent`.
@Antti-Palola Antti-Palola force-pushed the fix-logarithmic-scale-negative-below-one branch from c67121f to 17b68f2 Compare March 28, 2025 07:48
@Antti-Palola Antti-Palola marked this pull request as ready for review March 28, 2025 08:50
Copy link
Contributor

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-20872@17b68f2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Support negative and zero when axis type is 'log' Display negative value in Logarithmic axis
1 participant