1.4 KiB
1.4 KiB
id | title | required | challengeType | videoUrl | localeTitle | |||
---|---|---|---|---|---|---|---|---|
587d7fa8367417b2b2512bcd | Create a Bar for Each Data Point in the Set |
|
6 |
Description
undefined
Instructions
undefined
Tests
tests:
- text: ''
testString: 'assert($("rect").length == 9, "Your document should have 9 <code>rect</code> elements.");'
- text: ''
testString: 'assert(code.match(/\.data/g), "Your code should use the <code>data()</code> method.");'
- text: ''
testString: 'assert(code.match(/\.enter/g), "Your code should use the <code>enter()</code> method.");'
- text: ''
testString: 'assert(code.match(/\.append/g), "Your code should use the <code>append()</code> method.");'
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);
svg.selectAll("rect")
// Add your code below this line
// Add your code above this line
.attr("x", 0)
.attr("y", 0)
.attr("width", 25)
.attr("height", 100);
</script>
</body>
Solution
// solution required