Skip to main content
100%

JSON into tree layout

✓ Published0🌍 Public
663anp3ca
Last edited Oct 9, 2018
Created on Oct 9, 2018

This example demonstrates a hierarchical tree layout that visualizes JSON data as a branching structure, with a root node at the top and nested child nodes representing categories and subcategories. A pair of buttons switches between the standard tree and cluster layouts, both rendered as left-to-right node-link diagrams. The code uses the D3.js v3 library, specifically `d3.layout.tree` and `d3.layout.cluster`, along with `d3.svg.diagonal` for the curved link paths. The JSON data is defined inline and rendered with monospaced text labels and thin gray links.

AI-generated description

Aim

Produce a tree layout that will display json data from spreedsheet data

ROOT  
       |   
       ·―― A  
       |   |  
       |   ·―― A 01  
       |   |  
       |   ·―― A 02  
       |   |  
       |   ·―― A 03  
       |   |  
       |   ·―― A 04  
       |   |  
       |   ·―― A 05  
       |  
       ·―― B  
       |   |  
       |   ·―― B 01  
       |   |  
       |   ·―― B 02  
       |   |  
       |   ·―― B 02.1  
       |   |  
       |   ·―― B 02.2  
       |   |  
       |   ·―― B 02.3  
       |   |  
       |   ·―― B 02.4  
       |   |  
       |   ·―― B 03  
       |   |  
       |   ·―― B 04  
       |   |  
       |   ·―― B 05  
       |   |  
       ·―― C   
       |   |  
       |   ·―― C 01  
       |   |  
       |   ·―― C 01.1  
       |   |  
       |   ·―― C 01.2  
       |   |  
       |   ·―― C 01.3  
       |   |  
       |   ·―― C 01.4  
       |   |  
       |   ·―― C 01.5  
       |   |  
       ·―― D   
       |   | 
           ·―― D 01  
           |  
           ·―― D 02  
           |  
           ·―― D 03  
               |  
               ·―― D 03.1  
               |  
               ·―― D 03.2  

Info and sources

Based on From tree to cluster and radial projectionn

Collapsible Tree

forked from <a href='http://bl.ocks.org/eesur/'>eesur</a>'s block: <a href='http://bl.ocks.org/eesur/9957493'>d3 | JSON data to tree layout</a>

mit Licensed

Similar vizzes