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

Logarithmic axis - negative values. #13914

Closed
Basts opened this issue Jul 15, 2020 · 8 comments
Closed

Logarithmic axis - negative values. #13914

Basts opened this issue Jul 15, 2020 · 8 comments

Comments

@Basts
Copy link
Contributor

Basts commented Jul 15, 2020

Expected behaviour

According to this article, the negative values should be displayed (thanks to this custom code), however, something is broken after the 8.0.4 version.

Last working version: http://jsfiddle.net/BlackLabel/bj3dwe4t/

Actual behaviour

The current version, the negative points are hidden: http://jsfiddle.net/BlackLabel/cdguh2zp/

Product version

Highcharts JS v8.1.2 (2020-06-16)

@pawelfus
Copy link
Contributor

Bisected to commit a31155e - not really helpful. It might be related to the way we refer log2lin and lin2log values. Any ideas @bre1470 ?

@bre1470
Copy link
Contributor

bre1470 commented Jul 16, 2020

Amazing. I have no idea yet, but I will look into that.

@bre1470 bre1470 self-assigned this Jul 16, 2020
@bre1470
Copy link
Contributor

bre1470 commented Jul 16, 2020

For me this is the breaking commit: daddf2e

@bre1470
Copy link
Contributor

bre1470 commented Jul 16, 2020

Okay, so I found the reason. It is not a bug, but just the wrong usage of the axis prototype. If you set the option yAxis.allowNegativeLog to true, everything is working as expected. See: http://jsfiddle.net/u3o2qaw0/

Highcharts.chart('container', {

    title: {
        text: 'Logarithmic axis with custom conversion allows negative values'
    },

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    yAxis: {
        type: 'logarithmic',
        allowNegativeLog: true
    },

    series: [{
        data: [-1000, -100, -10, -1, -0.1, 0, 0.1, 1, 10, 100, 1000]
    }]

});

@bre1470
Copy link
Contributor

bre1470 commented Jul 16, 2020

@Basts @pawelfus Can you confirm the solution?

@bre1470 bre1470 moved this from To do to In progress in Development-Flow Jul 16, 2020
@bre1470 bre1470 moved this from In progress to Pending Review in Development-Flow Jul 16, 2020
@Basts
Copy link
Contributor Author

Basts commented Jul 16, 2020

@bre1470
Yeah, it seems like the right option to set, however, this option doesn't exist in the API and it doesn't work in the previous versions: http://jsfiddle.net/BlackLabel/bj3dwe4t/, so I think that some update (in the API and article) is required to clearly explain to users how to use it.

Development-Flow automation moved this from Pending Review to Done Aug 3, 2020
@TorsteinHonsi
Copy link
Collaborator

Negative values on a log axis is (mathematically) not a thing, and we only keep this hidden option as a convenience so that our demo can work.

Please revert this commit, as we want to keep the footprint as low as possible, and don't need to support backwards compatibility.

@bre1470
Copy link
Contributor

bre1470 commented Aug 10, 2020

@TorsteinHonsi Please note, that without this change the LogarithmicAxis composition always have redundant conversion functions directly on the axis to allow the demo in its current state to work with ES6. See https://github.com/highcharts/highcharts/blob/master/ts/Core/Axis/LogarithmicAxis.ts#L227-L233

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

No branches or pull requests

5 participants