d3js v4森伯斯特图

时间:2017-11-14 21:26:47

标签: javascript d3.js sunburst-diagram

我正在尝试使用[d3js zoomable sunburst] [1]

来映射一些数据

[1]:https://bl.ocks.org/mbostock/4348373。按照这个例子我做了同样的步骤。但我认为它无法正确读取数据。下面是我到目前为止的代码,由于无法读取数据,因此输出为黑色圆圈。

https://jsfiddle.net/snt1/mbszu1u5/3/

 root = d3.hierarchy(root);
          root.sum(function(d) { return d.count; });
          svg.selectAll("path")
              .data(partition(root).descendants())
              .enter().append("path")
              .attr("d", arc)
              .style("fill", function(d) { return color((d.children ? d : d.parent).data.name); })
              .on("click", click)
              .append("title")
              .text(function(d) { return d.data.name + "\n" + formatNumber(d.value); });

0 个答案:

没有答案
相关问题