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 crash on missing top bin #248

Merged
merged 5 commits into from Apr 7, 2022
Merged

fix crash on missing top bin #248

merged 5 commits into from Apr 7, 2022

Conversation

Fil
Copy link
Member

@Fil Fil commented Apr 7, 2022

d3.bin().domain([4, 5])([5]) crashes

the issue is that we have removed the last bin, but then want to assign the largest value to it because floor(x1) === x1
I'm not sure if the fix catches all cases…

issue reported by weiglemc at https://observablehq.com/@weiglemc/demonstrating-issue-with-d3-bins-in-d3v7-4-1-update

…ns-in-d3v7-4-1-update

unit test: d3.bin().domain([4, 5])([5])
the issue is that we have removed the last bin, but then want to assign the largest value to it because floor(x1) === x1

I'm not sure if the fix catches all cases…
@Fil Fil requested a review from mbostock April 7, 2022 15:59
src/bin.js Outdated Show resolved Hide resolved
@Fil
Copy link
Member Author

Fil commented Apr 7, 2022

hmmm this is only fixing one of the two original cases… adding a test 🤔

@Fil
Copy link
Member Author

Fil commented Apr 7, 2022

I don't understand why the test fails with 17 eights, but not with 16 eights!

src/bin.js Show resolved Hide resolved
@Fil Fil merged commit 68fb588 into main Apr 7, 2022
@Fil Fil deleted the fil/fix-top-bin branch April 7, 2022 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants