Skip to main content
100%

d3-indented-tree API example #28

✓ Published0🌍 Public
EEE2dev
Last edited Dec 30, 2020
Created on Sep 15, 2019

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 description

API 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.


Acknowledgements:

mit Licensed

Similar vizzes