Labels on bilevel D3 partition / sunburst layout

前端 未结 3 686
隐瞒了意图╮
隐瞒了意图╮ 2021-01-16 09:35

I am trying to add labels to the bilevel sunburst / partition shown here - http://bl.ocks.org/mbostock/5944371:

<script

3条回答
  •  生来不讨喜
    2021-01-16 10:15

    Indeed one modified line is missing in "2.". In function zoom(root, p), you should also add a line after path = path.data(partition ... .key; });:

            path = path.data(partition.nodes(root).slice(1), function (d) {
                return d.key;
            });
    
            text = text.data(partition.nodes(root).slice(1), function (d) {
                return d.key;
            });
    

提交回复
热议问题