0

I have a d3 sunburst chart - based on this example:

https://bl.ocks.org/kerryrodden/7090426

I've added a condition to control d.depth however as this changes, I need the chart to be refreshed with the new d.depth value.

var nodes = partition.nodes(json)
          .filter(function(d) {
          return (d.dx > 0.005 && d.depth < $scope.detailLevelForChart); 
});

Is there a simple refresh() method built in or do i have do something like remove the div and redraw the same way as when the page loads?

Any help would be appreciated.

Thanks.

userMod2
  • 8,312
  • 13
  • 63
  • 115

1 Answers1

0

For sunburst charts you can found some examples of update by transition instead of remove and redraw all the graph.

Mike Bostock's Zoomable Sunburst example

https://bl.ocks.org/kerryrodden/477c1bfb081b783f80ad

Other link can be helpful

d3 - sunburst - transition given updated data -- trying to animate, not snap

Community
  • 1
  • 1
EA-Lille
  • 561
  • 7
  • 21