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

allowDecimals: false ignored with flat data #6274

Closed
drmrbrewer opened this Issue Jan 20, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@drmrbrewer

drmrbrewer commented Jan 20, 2017

Expected behaviour

Setting allowDecimals: false on the yAxis should result in integer axis labels.

Actual behaviour

With flat high-precision data, this doesn't work.

Live demo with steps to reproduce

http://jsfiddle.net/xhs3fonh/2/

Affected browser(s)

Any, I assume.

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Jan 20, 2017

Contributor

Workaround:
Use yAxis.minRange, demo: http://jsfiddle.net/xhs3fonh/4/

Short explanation: it's not caused by high precision as in the title, but it's related to all points having the same value. If only one value will be a bit different, it will work correctly: http://jsfiddle.net/xhs3fonh/5/

Contributor

pawelfus commented Jan 20, 2017

Workaround:
Use yAxis.minRange, demo: http://jsfiddle.net/xhs3fonh/4/

Short explanation: it's not caused by high precision as in the title, but it's related to all points having the same value. If only one value will be a bit different, it will work correctly: http://jsfiddle.net/xhs3fonh/5/

@drmrbrewer

This comment has been minimized.

Show comment
Hide comment
@drmrbrewer

drmrbrewer Jan 20, 2017

@pawelfus OK. So this is recognised as a bug that will be fixed... hence no need for the workaround in future version?

drmrbrewer commented Jan 20, 2017

@pawelfus OK. So this is recognised as a bug that will be fixed... hence no need for the workaround in future version?

@drmrbrewer drmrbrewer changed the title from allowDecimals: false ignored with flat high-precision data to allowDecimals: false ignored with flat data Jan 20, 2017

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Jan 20, 2017

Contributor

I think this should be closed as duplicate of #5956. I know this is the report for allowDecimals, but under the hood it's issue with extremes for flat data. Also workaround from #5956 works for this issue: @http://jsfiddle.net/xhs3fonh/7/

It should be configurable, so we can choose if we want to get flat data in the middle of a chart, with just one tick, or we want to generate N-ticks anyway.

Contributor

pawelfus commented Jan 20, 2017

I think this should be closed as duplicate of #5956. I know this is the report for allowDecimals, but under the hood it's issue with extremes for flat data. Also workaround from #5956 works for this issue: @http://jsfiddle.net/xhs3fonh/7/

It should be configurable, so we can choose if we want to get flat data in the middle of a chart, with just one tick, or we want to generate N-ticks anyway.

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Jan 23, 2017

Collaborator

It should be configurable, so we can choose if we want to get flat data in the middle of a chart, with just one tick, or we want to generate N-ticks anyway

It looks like we've already got that option - by setting minRange. Do you think that's enough? In that case we just need to communicate it better, add it to the docs in appropriate places etc.

Collaborator

TorsteinHonsi commented Jan 23, 2017

It should be configurable, so we can choose if we want to get flat data in the middle of a chart, with just one tick, or we want to generate N-ticks anyway

It looks like we've already got that option - by setting minRange. Do you think that's enough? In that case we just need to communicate it better, add it to the docs in appropriate places etc.

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Jan 23, 2017

Contributor

It depends if we talk about allowDecimals or general solution? For allowDecimals it's perfectly fine, as we know the minimum range (one unit, without decimals), but not when considering extremes for a flat data. User may not know which minRange will be fine, let's consider these two examples:

Both examples can be created using the same config etc. on the same page (just data from backend can be different).

Contributor

pawelfus commented Jan 23, 2017

It depends if we talk about allowDecimals or general solution? For allowDecimals it's perfectly fine, as we know the minimum range (one unit, without decimals), but not when considering extremes for a flat data. User may not know which minRange will be fine, let's consider these two examples:

Both examples can be created using the same config etc. on the same page (just data from backend can be different).

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Jan 24, 2017

Collaborator

User may not know which minRange will be fine

The point with flat data is that there is no way that Highcharts can guess what the preferred scale is, that's why we chose to present it with one single tick in the first place. (Previously we added integer ticks if I remember correctly). But with using minRange, we offer the user an option to take some control and add a scale.

Collaborator

TorsteinHonsi commented Jan 24, 2017

User may not know which minRange will be fine

The point with flat data is that there is no way that Highcharts can guess what the preferred scale is, that's why we chose to present it with one single tick in the first place. (Previously we added integer ticks if I remember correctly). But with using minRange, we offer the user an option to take some control and add a scale.

@drmrbrewer

This comment has been minimized.

Show comment
Hide comment
@drmrbrewer

drmrbrewer Jan 24, 2017

Referring to my original post, my surprise was that with allowDecimals set to false and yet I was still seeing decimals on the axis label. At least where allowDecimals is set to false, you know that instead of just a single 1.3333333 as in my original example, you just put two ticks at 1 and 2 either side. With allowDecimals set to true I wouldn't have been surprised at the lack of scale (just a single tick), and if it bothered me I would probably have found minRange as the solution. So for me, the only issue that needs fixing relates to ensuring that allowDecimals = false always has the expected effect... i.e. no decimals on the axis, ever... shouldn't need the minRange workaround because allowDecimals = false should already impose that workaround.

drmrbrewer commented Jan 24, 2017

Referring to my original post, my surprise was that with allowDecimals set to false and yet I was still seeing decimals on the axis label. At least where allowDecimals is set to false, you know that instead of just a single 1.3333333 as in my original example, you just put two ticks at 1 and 2 either side. With allowDecimals set to true I wouldn't have been surprised at the lack of scale (just a single tick), and if it bothered me I would probably have found minRange as the solution. So for me, the only issue that needs fixing relates to ensuring that allowDecimals = false always has the expected effect... i.e. no decimals on the axis, ever... shouldn't need the minRange workaround because allowDecimals = false should already impose that workaround.

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Jan 24, 2017

Collaborator

Yes, I agree to that conclusion.

Collaborator

TorsteinHonsi commented Jan 24, 2017

Yes, I agree to that conclusion.

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