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.
Positioning and formatting our axis - D3.js Tutorial
From the course: D3.js Essential Training
Positioning and formatting our axis
- [Instructor] D3 gives you powerful control over access formatting with simple commands like .nice to round off data values effortlessly. In this video we'll explore some key options that make D3's axis generator so flexible and useful. In the last video we made our first axis. Now let's check the DOM and see what we've been given. We have our svg, which contains our chart group. And you can see if you look at the webpage part as I hover, you can see that the group is just that sort of shaded blue section. So it's got the margins applied around it. And then if we drill down a bit further, we have our axis group and our line group. Now we want to focus in on the axis here. So let's see what we've been given. And bear in mind we didn't have to add any of these. We made one command, which was .call, and we've been given a path which runs from top to bottom and then a series of groups corresponding to our ticks. And if we expand each of these groups, we get a line and a label. So tick…
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)
Introducing scales3m 40s
-
(Locked)
Position elements with a linear scale5m 51s
-
(Locked)
Creating a linear axis6m 8s
-
(Locked)
Positioning and formatting our axis7m 29s
-
(Locked)
Creating a time scale7m 33s
-
(Locked)
Creating a time series axis6m 10s
-
(Locked)
Creating an ordinal scale and axis11m 16s
-
(Locked)
Using color scales13m 36s
-
(Locked)
Challenge: Add Fahrenheit scale1m 18s
-
(Locked)
Solution: Add Fahrenheit scale3m 6s
-
(Locked)
-
-
-
-
-