freeCodeCamp/curriculum/challenges/russian/04-data-visualization/data-visualization-with-d3/display-shapes-with-svg.rus...

2.3 KiB
Raw Blame History

id title challengeType videoUrl localeTitle
587d7fa8367417b2b2512bcc Display Shapes with SVG 6 Отображать фигуры с помощью SVG

Description

undefined

Instructions

Добавьте rect форму в svg используя append() , и присвойте ему атрибут width 25 и атрибут height 100. Также дайте атрибутам rect x и y каждый из которых установлен в 0.

Tests

tests:
  - text: В вашем документе должен быть 1 элемент <code>rect</code> .
    testString: 'assert($("rect").length == 1, "Your document should have 1 <code>rect</code> element.");'
  - text: Элемент <code>rect</code> должен иметь атрибут <code>width</code> равный 25.
    testString: 'assert($("rect").attr("width") == "25", "The <code>rect</code> element should have a <code>width</code> attribute set to 25.");'
  - text: Элемент <code>rect</code> должен иметь атрибут <code>height</code> равный 100.
    testString: 'assert($("rect").attr("height") == "100", "The <code>rect</code> element should have a <code>height</code> attribute set to 100.");'
  - text: Элемент <code>rect</code> должен иметь атрибут <code>x</code> равный 0.
    testString: 'assert($("rect").attr("x") == "0", "The <code>rect</code> element should have an <code>x</code> attribute set to 0.");'
  - text: ''
    testString: 'assert($("rect").attr("y") == "0", "The <code>rect</code> element should have a <code>y</code> attribute set to 0.");'

Challenge Seed

<body>
  <script>
    const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];

    const w = 500;
    const h = 100;

    const svg = d3.select("body")
                  .append("svg")
                  .attr("width", w)
                  .attr("height", h)
                  // Add your code below this line



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

Solution

// solution required