Learn About SVG in D3 helppp

Learn About SVG in D3 helppp


is it creating multiple svg elements?

Your code so far

  svg {
    background-color: pink;
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
    const w = 500;
    const h = 100;
    const svg = d3.select("body").selectAll('svg')
                  // Add your code below this line
                  // Add your code above this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:


One for each element of the array I think^^
When you say d3.select('body').selectAll('svg') you are selecting all the svg elements in the body (0) preparing them to hold the data you’re sending to.
Since they are 0 you will create a new element for each element of the dataset passed in, and those elements will be svg ( from append('svg'))

This as far as i remember, but I’m not 100% sure :confused: