Output SVG Elements with D3 v4

Share this video with your friends

Send Tweet

D3 is capable of creating regular DOM elements like divs and buttons, and can even render to canvas, but by far the most common type of output is SVG. In this lesson we’ll convert from DOM elements to SVG elements, and make the updates necessary for maintaining a consistent appearance between the two.

Andrew
Andrew
~ 8 years ago

I am really enjoying this course, thank you. In this example, your text doesn't render if a child of rect. Searching around on StackOverflow, it seems like one needs to add a group (g) and append the rect and text elements as siblings within the group. I would like to hear your input.

Ben Clinkinbeard
Ben Clinkinbeard(instructor)
~ 8 years ago

Watch the next video. :)

Ian Hollands
Ian Hollands
~ 7 years ago

I'm new to SVG, but it seems like a lot of the behavior is different between browsers. Something for users to be aware of while they go through these lessons

Benedicte  Raae
Benedicte Raae
~ 5 years ago

I had use height/width attributes to make it work in Firefox on Linux.