-
Notifications
You must be signed in to change notification settings - Fork 314
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
d3-pack throws error at extendBasis for the given data #150
Comments
@mbostock Please respond to this issue! |
This is an issue of non-robust arithmetic. There’s no simple fix for this. |
Here is some code that reproduces the error: d3.packSiblings([
{r: 5.473061352023348e+12},
{r: 1.1729457180068344e+12},
{r: 1023}
]) @robinhouston and I spent some time looking at this before, and perhaps this is my fault for tweaking the enclosure tests. I’d like to fix this, but I’m not entirely sure how to do it. And even if we wanted to adopt robust-predicates, I’m not entirely sure how we’d apply the incircle test here (and also, adding that as a dependency would be significant and likely make this layout slower where a fast approximate solution would suffice). |
Hey @mbostock, @aarthi0808. I found a fix for this issue in https://github.com/carbon-design-system/carbon-charts Going through https://observablehq.com/@mourner/non-robust-arithmetic-as-art I realized that if the chart dimensions Now you might not intend to have a chart at <1px width & height, I didn't either, but for some reason in 1 of the frames in Firefox the chart is actually much smaller than that, So I just wait in my renders until the chart dimensions are larger than 1px and voila! it works Also to add some context, this issue usually shows up when you add .padding() to the d3 pack |
Facing same kind of issue in using d3-hierarchy for pack layout. Please check the data i am using,
["a",5.473061352023348e+21], ["b", 1.1729457180068344e+21], ["c", 1023]
Checkout the error stack messages
Need a fix for this issue @mbostock
Originally posted by @aarthi0808 in #100 (comment)
The text was updated successfully, but these errors were encountered: