You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Svg arc.cornerRadius causing invalid paths with attrTween #2183
I use the partition layout to create a sunburst chart where the arcs have rounded corners. The animation works pretty well (except a flickering of the arc which becomes a full circle), but in the console of safari 7.1 and chrome 39.0 a lots of errors are thrown (NOT in firefox).
The animation works but an error occurs in d3.js:8699 "this.setAttribute(name, f(t));"
The log output of chrome:
Error: Invalid value for attribute d="MNaN,NaNANaN,NaN 0 1,1 NaN,NaNLNaN,NaNANaN,NaN 0 0,1 NaN,NaNZ"
Without a test case (a self-contained example on bl.ocks.org or jsfiddle.net, etc.) to verify this bug, I can’t investigate further. My guess is that one of the arc properties you’re specifying is NaN, so that NaN is being propagated into the resulting path string. I would use a debugger to step through your code and see what values you are passing to the arc generator, and then work backwards from there to see why the property is NaN.
Here you’ve defined range by coercing a scale’s range (which is typically an array of numbers) to a number. That probably means that range’s value is NaN. Then you’re using d3.interpolate to interpolate from NaN to an array of two numbers. That probably means that the interpolator is always returning the latter array, regardless of the value of t.
I debugged and i recognized at "this.attribute(name, f(t))" that f(t) returns this error path when t=1 and f=return o(d) (the arc(d))
)
Diggin deeper i found that there a very small x values in the d3.svg.arg function, where calulation results of other vars get NaN:
Further investigation points me to the d3_geom_polygonIntersect(c,d,a,b) method where the parameters have values but it returns NaN array because the variable ua is undefined:
So, at least i found a possible workaround/fix: when i add if(!ua) ua = 1; no errors occurr anymore. :)
I did miss the link, thank you. And thank you for debugging the divide-by-zero. You can see that the two lines being intersected are coincident, hence the zero denominator. I think your fix probably isn’t what we want, but I haven’t thought through the appropriate fix to svg/arc.js yet.
Activity
mbostock commentedon Jan 13, 2015
Without a test case (a self-contained example on bl.ocks.org or jsfiddle.net, etc.) to verify this bug, I can’t investigate further. My guess is that one of the arc properties you’re specifying is NaN, so that NaN is being propagated into the resulting path string. I would use a debugger to step through your code and see what values you are passing to the arc generator, and then work backwards from there to see why the property is NaN.
I did notice one bug in your code:
Here you’ve defined
rangeby coercing a scale’s range (which is typically an array of numbers) to a number. That probably means thatrange’s value is NaN. Then you’re using d3.interpolate to interpolate from NaN to an array of two numbers. That probably means that the interpolator is always returning the latter array, regardless of the value of t.wassx commentedon Jan 14, 2015
Hi, sry to ask again, but maybe you haven't noticed, there is a example of the zoomable sunburst on codepen in the issue: " and a codepen to test made by user VividD: http://codepen.io/VividD/pen/myRWRY "
Is this one helpful for you?
I debugged and i recognized at "this.attribute(name, f(t))" that f(t) returns this error path when t=1 and f=return o(d) (the arc(d))

)
Diggin deeper i found that there a very small x values in the d3.svg.arg function, where calulation results of other vars get NaN:
Further investigation points me to the d3_geom_polygonIntersect(c,d,a,b) method where the parameters have values but it returns NaN array because the variable ua is undefined:


So, at least i found a possible workaround/fix: when i add if(!ua) ua = 1; no errors occurr anymore. :)

mbostock commentedon Jan 14, 2015
I did miss the link, thank you. And thank you for debugging the divide-by-zero. You can see that the two lines being intersected are coincident, hence the zero denominator. I think your fix probably isn’t what we want, but I haven’t thought through the appropriate fix to svg/arc.js yet.
geofflancaster commentedon Aug 27, 2015
Any idea when this will be released? I'm having this issue trying to draw a simple arc with rounded corners
Don’t try to round corners on tiny arcs.
mbostock commentedon Oct 22, 2015
Fix merged into #2591.