From the course: DC.js for Data Science Essential Training
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Making a map (choropleth) - JavaScript Tutorial
From the course: DC.js for Data Science Essential Training
Making a map (choropleth)
- [Instructor] DC uses D3 to draw its maps. D3 draws these states that you see here as path elements within an SVG element. So just to repeat that, D3 is drawing these states, it's not downloading images and arranging them. This state here is created as a path element. And the path element tells the browser to put the pen down, as it were, at an X coordinate of about 230 and a Y coordinate of about 28.5, and then to draw a line, represented by L, meaning line two, to the next set of X, Y coordinates. And so on and so forth, you can see there's quite a few coordinates there. So what does that mean for us? When we we create a choropleth, which is the proper name for this map or heat map, we need at least two data files. One to contain the coordinate data to actually draw the map with, and the second one to contain value data to help us color it in. And we're going to need new data because none of the data that we've looked at so far has been split by state. So, we'll use the data that…
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.