score:0

For anyone interested I accomplished to get it working with v4. Here is my code:

``````// Recursively reposition the node at position x with scale k.
const reposition = (node:any, x: any, k:any) => {
node.x0 = x;
if (node.children && (n = node.children.length)) {
var i = -1, n;
while (++i < n) x += reposition(node.children[i], x, k);
}
node.x1 = node.x0 + node.value * k;
return node.value * k;
}

// Stash the old values for transition.
const stash = (d: any) => {
d.x00 = d.x0;
d.dx10 = d.x1;
return d;
}

// Interpolate the arcs in data space.
const arcTween = (a: any):any => {
var i = d3.interpolate({x00: a.x0, dx10: a.x1}, a);
return (t:any):any => {
var b = i(t);
a.x00 = b.x0;
a.dx10 = b.x1;
return arc(b);
};
}

const magnify = (node:any) => {
if (node.parent) {
var parent = node.parent,
x = parent.x0,
k = .8;
parent.children.forEach((sibling: any) => {
x += reposition(sibling, x, sibling === node
? (parent.x1 - parent.x0) * k / node.value
: (parent.x1 - parent.x0) * (1 - k) / (parent.value - node.value));
});
} else {
reposition(node, 0, node.x1 / node.value);
}

sunburst.selectAll("path")
.transition()
.duration(750)
.attrTween("d", arcTween)
}
``````