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

feat(log): allows zero and negativ values #20266

Closed
wants to merge 1 commit into from

Conversation

callepaeth
Copy link

There are problems when using axis of type 'log' with zero and negative values.

This change allow zero and negative values, when useing type 'log' for an axis.

src/coord/axisAlignTicks.ts and src/scale/Log.ts will use log() as mathLog from src/util/math.ts.

Copy link

echarts-bot bot commented Aug 18, 2024

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.

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: PR: doc ready, PR: awaiting doc, PR: doc unchanged

This message is shown because the PR description doesn't contain the document related template.

Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logarithms of zero and negative numbers are not defined in the real numbers. So I don't think it's proper to support this.

@callepaeth
Copy link
Author

Logarithms of zero and negative numbers are not defined in the real numbers. So I don't think it's proper to support this.

I understand this. It was the minimal change to support it.
What about going deeper, and change only the functions where the special handling is needed ?

scale/Log.ts:{setExtent,unionExtent,contain,normalize}
coord/axisAlignTicks.ts:alignScaleTicks

If yes, how should it be done ? create a function ? programm it out ?
if using a function, how should it be named ?

regards.

@callepaeth
Copy link
Author

After thinking about it ...

What about naming the function in util/math.ts 'symlog' or 'synmetricLog' and use it only where it's needed in:
scale/Log.ts:{setExtent,unionExtent,contain,normalize}
coord/axisAlignTicks.ts:alignScaleTicks

regards.

@Ovilia
Copy link
Contributor

Ovilia commented Aug 19, 2024

Could you be more specific about in what scenerio do you need this feature?

@callepaeth
Copy link
Author

I will prepare an example.

@callepaeth
Copy link
Author

balance.txt

Here the example. The chart is more compact with 'log'.
I found some other problems, so the MR is not so good, I will change it.

regars

@callepaeth
Copy link
Author

I have done some test. Modifiy 'log' is not the solution, what I really want is 'logvalue'
that behave like 'value' but with a logarithmic scale.
I will prepare that and will make a new MR.

regards.

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.

2 participants