This example shows how to align the leaves of the tree.
- for documentation, go to https://github.com/EE2dev/d3-indented-tree
- for other examples, go to https://github.com/EE2dev/d3-indented-tree#examples
Acknowledgements:
| license: mit |
This example shows how to align the leaves of the tree.
Acknowledgements:
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <head> | |
| <script src="https://d3js.org/d3.v6.min.js"></script> | |
| <script src="https://cdn.jsdelivr.net/gh/EE2dev/d3-indented-tree/dist/latest/d3-indented-tree.min.js"></script> | |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/EE2dev/d3-indented-tree/dist/latest/d3-indented-tree.css"> | |
| </head> | |
| <body> | |
| <script> | |
| const dataSpec = { | |
| source: "https://cdn.jsdelivr.net/gh/EE2dev/d3-indented-tree/test/data/flare.json", | |
| key: "name", | |
| }; | |
| const myChart = d3.indentedTree(dataSpec) | |
| .propagateValue("size"); | |
| showChart(myChart); | |
| window.setTimeout(function() { | |
| myChart.alignLeaves(true); | |
| }, 2000); | |
| function showChart(_chart) { | |
| d3.select("body") | |
| .append("div") | |
| .attr("class", "chart") | |
| .call(_chart); | |
| } | |
| </script> | |
| </body> | |
| </html> |