|
29 | 29 | .selectAll() |
30 | 30 | .data(root.leaves()) |
31 | 31 | .join("g") |
32 | | - .attr("transform", d => `rotate(${d.x * 180 / Math.PI - 90}) translate(${d.y},0)`) |
| 32 | + .attr("transform", (d) => `rotate(${d.x * 180 / Math.PI - 90}) translate(${d.y},0)`) |
33 | 33 | .append("text") |
34 | 34 | .attr("dy", "0.31em") |
35 | | - .attr("x", d => d.x < Math.PI ? 6 : -6) |
36 | | - .attr("text-anchor", d => d.x < Math.PI ? "start" : "end") |
37 | | - .attr("transform", d => d.x >= Math.PI ? "rotate(180)" : null) |
| 35 | + .attr("x", (d) => d.x < Math.PI ? 6 : -6) |
| 36 | + .attr("text-anchor", (d) => d.x < Math.PI ? "start" : "end") |
| 37 | + .attr("transform", (d) => d.x >= Math.PI ? "rotate(180)" : null) |
38 | 38 | .text((d) => d.data.name) |
39 | 39 | .each(function(d) { d.text = this; }) |
40 | 40 | .on("mouseover", overed) |
41 | 41 | .on("mouseout", outed) |
42 | | - .call(text => text.append("title").text((d) => `${id(d)} |
| 42 | + .call((text) => text.append("title").text((d) => `${id(d)} |
43 | 43 | ${d.outgoing.length} outgoing |
44 | 44 | ${d.incoming.length} incoming`)); |
45 | 45 |
|
|
52 | 52 | .attr("stroke", colornone) |
53 | 53 | .attr("fill", "none") |
54 | 54 | .selectAll() |
55 | | - .data(root.leaves().flatMap(leaf => leaf.outgoing)) |
| 55 | + .data(root.leaves().flatMap((leaf) => leaf.outgoing)) |
56 | 56 | .join("path") |
57 | 57 | .style("mix-blend-mode", "multiply") |
58 | 58 | .attr("d", ([i, o]) => line(i.path(o))) |
|
96 | 96 | }); |
97 | 97 | const root = d3.hierarchy(rootData); |
98 | 98 | const nodeById = new Map(root.leaves().map((d) => [id(d), d])); |
99 | | - for (const d of root.leaves()) d.incoming = [], d.outgoing = d.data.imports.map(i => [d, nodeById.get(i)]); |
| 99 | + for (const d of root.leaves()) d.incoming = [], d.outgoing = d.data.imports.map((i) => [d, nodeById.get(i)]); |
100 | 100 | for (const d of root.leaves()) for (const o of d.outgoing) o[1].incoming.push(o); |
101 | 101 | root.sort((a, b) => d3.ascending(a.height, b.height) || d3.ascending(a.data.name, b.data.name)); |
102 | 102 | return root; |
|
0 commit comments