Skip to content

Instantly share code, notes, and snippets.

@russelllim22
Created September 4, 2021 21:47
Show Gist options
  • Save russelllim22/9450c58b932f780db4bd671f01d8de45 to your computer and use it in GitHub Desktop.
Save russelllim22/9450c58b932f780db4bd671f01d8de45 to your computer and use it in GitHub Desktop.
svg.selectAll(".bubble")
.data(articleData) // bind each element of the data array to one SVG circle
.join("circle")
.attr("class", "bubble")
.attr("cx", d => xScale(d.views)) // set the x position based on the number of claps
.attr("cy", d => yScale(d.reads)) // set the y position based on the number of views
.attr("r", d => d.readingTime) // set the radius based on the article reading time
.attr("stroke", "darkblue")
.attr("fill", d => "lightblue")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment