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.
Making your graphic responsive - D3.js Tutorial
From the course: D3.js Essential Training
Making your graphic responsive
- [Instructor] Can you see how this website redraws as I change the size of the screen, including changing the layout entirely? So that's because it's responsive, and this is a general aim of web development, whether or not there's a D3 graphic on the page. We are now going to look at how to keep your visualization in step with your screen using View Box. And we're going to start off using our tree map code. Now, if you look, it's a fixed width at the moment. The SVG says 100%, but we'll look in the code in a second, and you can see what happens if I change the size of the screen, we just lose part of the graphic, and if I toggle device simulation on and off, we can see all of it, but there's a lot of white space at the bottom of the page, which is not ideal. So let's look at the code that is driving that. So in this tree map code, we have a fixed width and height. The SVG is set to 100% of the screen, and you have to have that in order for View Box to work. It doesn't have to be…
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)
Making your graphic responsive4m 57s
-
(Locked)
Using CSS to create transitions4m 40s
-
(Locked)
Making sense of D3 transitions7m 49s
-
(Locked)
D3 events and the data they expose7m 33s
-
(Locked)
Introducing zooming, dragging, and brushing with D34m 25s
-
(Locked)
Challenge: Hovering and tool tips1m 21s
-
(Locked)
Solution: Hovering and tool tips8m 47s
-
(Locked)
-