D3.js Tree Example
✓ Published0🌍 Public
This example shows a static hierarchical tree layout rendered as SVG, with a root node branching into three categories (Animals, Vehicles, Countries) and their leaf children. It demonstrates the core D3.js v5 tree API, using `d3.hierarchy()` to structure the data, `d3.tree()` to compute node positions, and `d3.linkHorizontal()` to draw curved paths between parent and child nodes. The code explicitly sets SVG dimensions with margins, appends circles for nodes and text labels that align based on whether a node has children, and loads D3 via a CDN script tag.
AI-generated descriptionAn example showing the capabilities of VizHub:
- Loads D3 via UNPKG.
- Demonstrates use of
importfrom"d3". - Demonstrates use of
importfrom local ES6 modules.
MIT Licensed