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

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Prepare stack data using map

Prepare stack data using map - D3.js Tutorial

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

Start my 1-month free trial

Prepare stack data using map

- [Presenter] In this section we're going to prepare our data ready for making a stacked area chart. Stacked area charts are more complex to code than basic area charts because each layer has to sit precisely on top of the layer below. With our previous area chart we set the y nought value to height because we wanted to the bottom of the chart to run along the x axis but now any layer other than the bottom layer will need dynamic y nought values. D3 helps us to calculate these values with a generator called stack. We're going to go back to using d3.html now. So we can close voronoi.html and then we can create a new file which we're going to save as stack and then if we open d3.html we need to re-reference that like so. If you have access to the Exercise Files you can open up data2.xml and if you don't have access please copy what's on the screen in front of you. You don't need all of the data points that we have here. The first five or so will do but you do need to keep the structure.…

Contents