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

Fix bug when calculating if steps fit into scale as a whole number th… #3685

Merged
merged 1 commit into from
Dec 14, 2016

Conversation

Tarqwyn
Copy link
Contributor

@Tarqwyn Tarqwyn commented Dec 6, 2016

This PR fixes an error where if generationOptions.max or generationOptions.min is calculated to an almost whole number (ie 9.999) then we display the number as 10 on the scale, but calculating an evenly spaced scale is not possible (eg stepSize is 2) as the check fails.

By applying an almost whole check we are able to mitigate for FP arithmetic inconsistencies that would cause this behaviour

Please consider the following before submitting a pull request:

Guidelines for contributing: https://github.com/chartjs/Chart.js/blob/master/CONTRIBUTING.md

Example of changes on an interactive website such as the following:

@Tarqwyn Tarqwyn force-pushed the floating_point_bug branch 2 times, most recently from 8249534 to 8f73bd2 Compare December 6, 2016 15:32
…en smal floating point errors make the consition pass false
Copy link
Member

@etimberg etimberg left a comment

Choose a reason for hiding this comment

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

I think this is fine. CC @chartjs/maintainers

@etimberg etimberg merged commit 34d26ea into chartjs:master Dec 14, 2016
@simonbrunel simonbrunel added this to the Version 2.5 milestone Jan 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants