From the course: D3.js Essential Training for Data Scientists
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Creating a time series axis - D3.js Tutorial
From the course: D3.js Essential Training for Data Scientists
Creating a time series axis
- [Instructor] Now we're going to add an X axis based on our X scale. So we can delete that console log thing that we had there. And we'll keep our structure by popping it under here. And it's as straight forward as it was before. For X axis, D3 dot axis, bottom. The scale is X. And that's all we need. Now that won't run until we call it so we're going to call it down here. Chart group append g. We'll give that a class attribute. There ya go. Class, axis X. And then we call our axis generator which is X axis. And then we check and refresh and low and behold we have an X axis. Now it's not where we wanted it but it is there and beautifully formatted as I'm sure you'll agree in purple and blue. So the X axis has been positioned at zero zero. So why isn't it showing up here which is the zero zero location of the page? And that's because we've added the X axis into chart group and chart group has been transformed. 50 pixels rightwards and 40 pixels downward. So although the X axis…
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
-
-
-
-
-
-
-
Introducing scales3m 10s
-
(Locked)
Creating a linear scale3m 11s
-
(Locked)
Creating a linear axis5m 57s
-
(Locked)
Positioning and formatting our axis5m
-
(Locked)
Creating a time scale5m 9s
-
(Locked)
Creating a time series axis3m 24s
-
(Locked)
Creating an ordinal scale and axis5m 53s
-
(Locked)
Using colour scales5m 17s
-
(Locked)
Introducing other scales2m 20s
-
-
-
-
-
-
-