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

Inverted histogram cuts off the first bar and leaves extra space at the bottom of the axis #11955

Closed
wenyichen opened this issue Sep 12, 2019 · 5 comments · Fixed by #11998
Closed
Assignees

Comments

@wenyichen
Copy link

wenyichen commented Sep 12, 2019

Expected behaviour

When inverted, the histogram should display all the bars with the same width

Actual behaviour

When inverted, the histogram cuts off the first bar and leaves extra space at the bottom.

Live demo with steps to reproduce

https://jsfiddle.net/jeq4ycwn/
Renders incorrectly with inverted set to false, correctly with inverted set to true
The bar that represents 3.10-3.92 lines up with the label such that 3.10 < 3.

Product version

Highcharts/Highstock 7

Affected browser(s)

Chrome, Firefox, Safari, did not test Edge

@pawelfus
Copy link
Contributor

Hi @wenyichen

Thanks for reporting the issue. @Denyllon - could you take a look?

Workaround:
Set series.pointPlacement = 0, demo: https://jsfiddle.net/BlackLabel/n0mrc4xo/

@wenyichen
Copy link
Author

Hi @pawelfus

Nice workaround, fixed the bar cutting off for me, but there is still the issue of the alignment with the axis labels.

Screen Shot 2019-09-13 at 9 50 39 AM

@pawelfus
Copy link
Contributor

Hard to say without seeing this live. Could you create a demo? Thanks!

@Denyllon
Copy link
Contributor

Denyllon commented Sep 16, 2019

The problem is in the way of how the pointPlacement property is working with inverted chart in general, and it applies to all series types, e.g basic column, and even line with category axis. To make this issue much easier to understand, the pointPlacement positive values are always moving the points to the right side of the axis. In case when the chart is inverted (which results in reversing xAxis), then points should be also moved in agree with axis direction, but they are positioned in the opposite direction.

Internal Note:
The most possible place to fix that issue could be the Series.pointPlacementToXValue prototype function, because regardless whether the xAxis is reversed or not, the pointPlacement value is always mapped to 0.5 when user set it equal to between.

highcharts/js/parts/Series.js

Lines 4404 to 4406 in 638ec15

if (pointPlacement === 'between') {
pointPlacement = 0.5;
}

Live example (based on histogram) with fix applied: https://jsfiddle.net/BlackLabel/ejLa10m9/

Kind regards!

@wenyichen
Copy link
Author

Makes sense. Thanks for the fix!

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

Successfully merging a pull request may close this issue.

4 participants