D3 trim hierarchical data by depth?

I'm using D3 pack layout and my data is very large. So the problem is the data is too large to be rendered smoothly. I want to trim the data by it's depth but I'm totally at loss about how to do that. The only thing I can think of is to write a recursive function to trim the whole data at each fresh. [psudo] trim = function(node, depth){ if ( depth == 0 ) return null; foreach(node.child) node.child = trim(node.child, depth - 1); } But I think there must be ways to handle it here: vis.selectAll("circle") .data(nodes) .enter().append("svg:circle") .attr("class", ...)

以上就是D3 trim hierarchical data by depth?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准