From the course: D3.js Essential Training
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Manipulating data with. group() and .rollup() - D3.js Tutorial
From the course: D3.js Essential Training
Manipulating data with. group() and .rollup()
- [Instructor] Being great with D3 means being great with data, and there are a lot of D3 functions to help you in this objective. Of course, you can also use vanilla JavaScript on your data, but D3 makes some things a lot easier. In this video, we're going to learn how to nest flat data using group and rollup, a much faster and cleaner alternative to reorganizing your files or writing custom code in JavaScript. In the exercise file, I have provided a function to generate some data and that's going to generate flat data. So, let's start just by looking at what that provides us. It's given us this array of length 120, and each item in the array has a Date object, a Month, and a Value. So, the data types are already correct and it's ready for us to use. So, let's start by grouping by Month. So, we can say const groupedData is d3.group, and then we pass in the data we want which is generatedData. And we say for each object, I want you to group by Month. And then, let's see what we get…
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)
Drawing a stack area with D3.stack() and D3.area()9m 53s
-
(Locked)
Drawing a stack area chart7m 26s
-
(Locked)
Handling data changes with enter and exit selections7m 58s
-
(Locked)
Streamline enter and exit selections with merge() and join()9m 37s
-
(Locked)
Manipulating data with. group() and .rollup()4m 39s
-
(Locked)
Mastering merge(), map(), sort() and .filter()9m 4s
-
(Locked)
Challenge: Create a stack chart1m 24s
-
(Locked)
Solution: Create a stack chart13m 2s
-
(Locked)
-
-