Displaying a tree

In this recipe, we will take a look into how to display data in a tree-like layout. We are going to visualize a small family tree of Linux represented via JSON file. Additionally, will be using the D3.js file for manipulating the DOM to display the data.

Displaying a tree

Getting ready

First, we need to have the data that is going to be used for the visualization. We need to get the tree.json file that is part of the examples for this recipe.

How to do it...

We will write the HTML and the backing JavaScript code that should generate data from a JSON file:

  1. Let's first take a look a the structure of the JSON data:
    { "name": "GNU/Linux", "url": "http://en.wikipedia.org/wiki/Linux", ...

Get HTML5 Data and Services Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.