# freeCodeCamp Challenge Guide: Add Attributes to the Circle Elements

**URL:** <https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-attributes-to-the-circle-elements/301471>\
**Category:** freeCodeCamp Contributors\
**Tags:** guide\
**Created:** [August 3, 2019, 1:05pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-attributes-to-the-circle-elements/301471 "2019-08-03T13:05:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![camperbot](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/camperbot/32/18364_2.png) [@camperbot](https://forum.freecodecamp.org/u/camperbot)\
**Post date:** [August 3, 2019, 1:05pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-attributes-to-the-circle-elements/301471/1 "2019-08-03T13:05:34Z")

</div>

# [Add Attributes to the Circle Elements](https://www.freecodecamp.org/learn/data-visualization/data-visualization-with-d3/add-attributes-to-the-circle-elements)

* * *

## Solutions

> **Solution 1 (Click to Show/Hide)**
>
> ```html
> <body>
> <script>
> const dataset = [
> [34, 78],
> [109, 280],
> [310, 120],
> [79, 411],
> [420, 220],
> [233, 145],
> [333, 96],
> [222, 333],
> [78, 320],
> [21, 123]
> ];
> 
> const w = 500;
> const h = 500;
> const svg = d3.select("body")
> .append("svg")
> .attr("width", w)
> .attr("height", h);
>     
> svg.selectAll("circle")
> .data(dataset)
> .enter()
> .append("circle")
> .attr("cx", (d) => d[0])
> .attr("cy", (d) => h - d[1])
> .attr("r", 5)
> </script>
> </body>
> 
> ```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 8, 2025, 3:58pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-attributes-to-the-circle-elements/301471/2 "2025-01-08T15:58:17Z")

</div>

Closed on January 8, 2025, 3:58pm UTC


