Added D3 solution to scatterplot challenge (#19609)
* Update index.md * Update index.mdpull/19634/head
parent
a177e02988
commit
f46e517eb7
|
@ -3,8 +3,32 @@ title: Create a Scatterplot with SVG Circles
|
|||
---
|
||||
## Create a Scatterplot with SVG Circles
|
||||
|
||||
This is a stub. <a href='https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/data-visualization/data-visualization-with-d3/create-a-scatterplot-with-svg-circles/index.md' target='_blank' rel='nofollow'>Help our community expand it</a>.
|
||||
### Hint 1
|
||||
|
||||
<a href='https://github.com/freecodecamp/guides/blob/master/README.md' target='_blank' rel='nofollow'>This quick style guide will help ensure your pull request gets accepted</a>.
|
||||
Use the ` data() `, ` enter() `, and ` append() ` methods.
|
||||
|
||||
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
|
||||
### Hint 2
|
||||
|
||||
Append circles in the ` append() ` method.
|
||||
|
||||
### Solution
|
||||
|
||||
Chain the following lines of code in the ` svg.selectAll("circle") ` chain:
|
||||
|
||||
```javascript
|
||||
.data(dataset)
|
||||
.enter()
|
||||
.append("circle")
|
||||
```
|
||||
|
||||
The ` svg.selectAll("circle") ` chain should look like:
|
||||
|
||||
```javascript
|
||||
svg.selectAll("circle")
|
||||
.data(dataset)
|
||||
.enter()
|
||||
.append("circle")
|
||||
```
|
||||
|
||||
##### Note
|
||||
The circles won't be visible because we haven't set their attributes yet. We'll do that in the next challenge.
|
||||
|
|
Loading…
Reference in New Issue