d3 / d3

Bring data to life with SVG, Canvas and HTML. :bar_chart::chart_with_upwards_trend::tada:

Home Page:https://d3js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transition to pie chart with 2 slices crashes

skaphan opened this issue · comments

So I have a pie chart where I am gradually reducing the number of slices, using a transition to go from one to the next. It works fine until you get down to the final two slices. The problem there seems to be caused if any of the slices has more than 50% of the size. See the comments in the code. If you put in a hand-written transition it works fine, but it does not work when doing it the "easy way."

Svelte component file is attached. I had to rename it .txt to get it to upload here. You can easily adapt it to your environment. Just load it, then click the mouse until you get down to two slices and it'll crash.
CrazyPie.txt

--Shel Kaphan
skaphan@gmail.com

Also, the "easy way" transition looks bad. I don't know what it is doing, but it should handle the radius and angles separately, not all together.