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.
Challenge: Line chart from scratch scales and generators - D3.js Tutorial
From the course: D3.js Essential Training
Challenge: Line chart from scratch scales and generators
(lively upbeat music) - [Instructor] So welcome to this challenge, which focuses on data. So for this challenge, I want you to create a line chart from scratch. And that means first that you need to go and get flatData.csv as your URL. And because that's a CSV, the first thing you're going to need to do in your JavaScript file is transform the data. So the string dates will need to become JavaScript date objects and the string numbers will need to become proper numbers. And once you've done that, you can declare your scales. You will need a timescale for your x-axis and a linear scale for your y-axis. And once you've done that, you can add a path element to the page using those scales and using the d3.line() generator. Now this is bringing together a lot of the things that we have learned, and therefore this challenge is likely to take you a bit longer. I would allow you yourself at least 10 minutes for this challenge. And if you get stuck, don't worry. Just check out the solution…
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)
-
-
-
-