This example shows how to transition to a second numeric value with myChart.nodeBar(). This example also shows:
Acknowledgements:
xxxxxxxxxx
<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>
<style>
.node .node-image {
stroke: deeppink;
}
</style>
<body>
<!-- paste data in aside tag -->
<aside id="data">
key,parent,size,weight,color
Eve,,,-14,yellow
Cain,Eve,4.647,-20.3,black
Seth,Eve,13,-205.3,steelblue
</aside>
<script>
const dataSpec = {
source: "aside#data",
};
const myChart = d3.indentedTree(dataSpec)
.linkLabel("size")
.nodeSort("size")
;
showChart(myChart);
window.setTimeout(function() {
myChart.nodeBar("size");
}, 2000);
window.setTimeout(function() {
myChart.nodeBar("weight");
}, 4000);
function showChart(_chart) {
d3.select("body")
.append("div")
.attr("class", "chart")
.call(_chart);
}
</script>
</body>
</html>
Updated missing url https://cdn.jsdelivr.net/gh/EE2dev/d3-indented-tree/dist/latest/d3-indented-tree.min.js to https://cdn.jsdelivr.net/gh/ee2dev/d3-indented-tree/dist/latest/d3-indented-tree.min.js
https://d3js.org/d3.v6.min.js
https://cdn.jsdelivr.net/gh/EE2dev/d3-indented-tree/dist/latest/d3-indented-tree.min.js