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

Creating a time series axis - D3.js Tutorial

From the course: D3.js Essential Training for Data Scientists

Start my 1-month free trial

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…

Contents