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.

Introducing path

Introducing path - D3.js Tutorial

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

Start my 1-month free trial

Introducing path

- [Narrator] Path is a big deal in D3. A path is a line, essentially. It can be wiggly, or straight, and it can be open, such as in a line chart, or closed, as in an area chart. Paths can be filled, and they can make unusual, irregular shapes. Paths are crucial for making advanced graphics in D3. In this chapter, we're going to learn how to use path to add a shape that serves as an area chart, albeit one without axes. To create a path, we need to use something called a generator, so we'll take a look at those too. And I'll introduce you to groups, which are fundamental to making advanced graphics in D3. In chapter three, we looked at SVG shapes, which each have a set of mandatory attributes. For line, they were X1, Y1, and X2, Y2. Paths work differently. A path might contain 2000 points, so we can list them all out as attributes. Path takes one single attribute, D, or data. The data have to be presented in a particular way, as a string of x,y coordinates, separated by spaces. The…

Contents