0

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) {

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


d3.selectAll("path")
  .transition()
  .duration(1000)
  .style("opacity", 1)
  .each("end", function() {
          d3.select(this).on("mouseover", mouseover);
        });

d3.select("#explanation")
  .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.

Jamie
  • 165
  • 1
  • 3
  • 11

1 Answers1

2

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: https://stackoverflow.com/a/38537982/343261

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

Community
  • 1
  • 1
Nixie
  • 637
  • 4
  • 9