76 lines
1.1 KiB
Markdown
76 lines
1.1 KiB
Markdown
---
|
|
id: 587d7fa7367417b2b2512bc8
|
|
title: Add Classes with D3
|
|
required:
|
|
- src: 'https://cdnjs.cloudflare.com/ajax/libs/d3/4.3.0/d3.min.js'
|
|
challengeType: 6
|
|
videoUrl: ''
|
|
localeTitle: ''
|
|
---
|
|
|
|
## Description
|
|
undefined
|
|
|
|
## Instructions
|
|
undefined
|
|
|
|
## Tests
|
|
<section id='tests'>
|
|
|
|
```yml
|
|
tests:
|
|
- text: ''
|
|
testString: 'assert($("div").attr("class") == "bar", "Your <code>div</code> elements should have a class of <code>bar</code>.");'
|
|
- text: ''
|
|
testString: 'assert(code.match(/\.attr/g), "Your code should use the <code>attr()</code> method.");'
|
|
|
|
```
|
|
|
|
</section>
|
|
|
|
## Challenge Seed
|
|
<section id='challengeSeed'>
|
|
|
|
<div id='html-seed'>
|
|
|
|
```html
|
|
<style>
|
|
.bar {
|
|
width: 25px;
|
|
height: 100px;
|
|
display: inline-block;
|
|
background-color: blue;
|
|
}
|
|
</style>
|
|
<body>
|
|
<script>
|
|
const dataset = [12, 31, 22, 17, 25, 18, 29, 14, 9];
|
|
|
|
d3.select("body").selectAll("div")
|
|
.data(dataset)
|
|
.enter()
|
|
.append("div")
|
|
// Add your code below this line
|
|
|
|
|
|
|
|
// Add your code above this line
|
|
</script>
|
|
</body>
|
|
|
|
```
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
## Solution
|
|
<section id='solution'>
|
|
|
|
```js
|
|
// solution required
|
|
```
|
|
</section>
|