freeCodeCamp/curriculum/challenges/arabic/04-data-visualization/data-visualization-with-d3/learn-about-svg-in-d3.arabi...

1.2 KiB

id title required challengeType videoUrl localeTitle
587d7fa8367417b2b2512bcb Learn About SVG in D3
src
https://cdnjs.cloudflare.com/ajax/libs/d3/4.3.0/d3.min.js
6

Description

undefined

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert($("svg").length == 1, "Your document should have 1 <code>svg</code> element.");'
  - text: ''
    testString: 'assert($("svg").attr("width") == "500", "The <code>svg</code> element should have a <code>width</code> attribute set to 500.");'
  - text: ''
    testString: 'assert($("svg").attr("height") == "100", "The <code>svg</code> element should have a <code>height</code> attribute set to 100.");'

Challenge Seed

<style>
  svg {
    background-color: pink;
  }
</style>
<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];

    const w = 500;
    const h = 100;

    const svg = d3.select("body")
                  // Add your code below this line



                  // Add your code above this line
  </script>
</body>

Solution

// solution required