Jamie Jamie - 6 months ago 115
Javascript Question

How can I update the D3 sunburst sequence partition to v4?

I have been trying to update the d3 sunburst sequence partition to d3 V4, :

the one at: https://bl.ocks.org/kerryrodden/7090426

I have switched most of it over and it is mostly working working but it breaks on mouseleave function. The error I get is: d3.js:7616 Uncaught TypeError: callback.call is not a function

function mouseleave(d) {

.style("visibility", "hidden");
d3.selectAll("path").on("mouseover", null);

.style("opacity", 1)
.each("end", function() {
d3.select(this).on("mouseover", mouseover);

.style("visibility", "hidden");

Does anyone know if there is something there which does not work in in d3 V4 - I couldn't find it in the docs. Or even better, if any one knows of an updated d3 V4 version of this somewhere.


You might need to use on("end", ...) instead of .each. See the documentation here: https://github.com/d3/d3-transition#transition_on

See also an answer here: http://stackoverflow.com/a/38537982/343261

An example of slightly different Sunburst (though without on-end): Zoomable Sunburst on d3.js v4