From the course: D3.js Essential Training
Unlock this course with a free trial
Join today to access over 25,200 courses taught by industry experts.
Parsing and displaying nested JSON with nested selections - D3.js Tutorial
From the course: D3.js Essential Training
Parsing and displaying nested JSON with nested selections
- [Instructor] You may be able to guess that D3 has a built-in handler for JSON, but did you know that you can bind hierarchical data easily to hierarchical elements with what's called nested selections? So you can drill down into data. JSON is everywhere these days, particularly APIs. So if you want to work with real world data, you need to learn to handle JSON. And it unlocks more complicated visualizations too, like trees and hierarchies and so on. Now we are going to look at importing some JSON and using it for nested selections. So we start with a familiar process now hopefully, we take the URL to the data. And we're going to import it here with a handler that looks and works very similar to the CSV one. So d3.json, paste that, pop that down there so you can see it a bit better. And then we say take the data without a comma and do something with it. To begin with, we will just log it to the console. So let's refresh that and we have some data, which is good. Now a couple of notes…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Parsing a CSV file using promises()4m 26s
-
(Locked)
Drawing a line chart from CSV data7m 39s
-
(Locked)
Parsing and displaying nested JSON with nested selections15m 18s
-
(Locked)
Understanding and using D3 fetch6m 40s
-
(Locked)
Challenge: Line chart from scratch scales and generators1m 10s
-
(Locked)
Solution: Line chart from scratch scales and generators9m 17s
-
(Locked)
-
-
-
-