d3-indented-tree API example #28
This example demonstrates how to dynamically assign node images in a d3-indented-tree chart based on each node’s expanded or collapsed state, using white or black king icons respectively. The visualization reads hierarchical CSV data from an HTML `<aside>` element, with columns for parent-child relationships, size, weight, and two image fields. Built with D3.js v6 and the d3-indented-tree plugin, the chart uses the `.nodeImageFile()` API with a callback function that selects `image1` for collapsed nodes and `image2` for expanded ones. Additional encodings map the `weight` field to link thickness and label formatting.
AI-generated descriptionAPI examples for d3-indented-tree
myChart.nodeImageFile() - 2
This example shows how to set the the node image file based on the data. The expanded nodes are shown with a white king. If the node is collapsed, it changes to a black king.
- 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: