Skip to content

Instantly share code, notes, and snippets.

@russelllim22
Last active September 4, 2021 12:19
Show Gist options
  • Save russelllim22/e292941bc9577d39376edd270d99def7 to your computer and use it in GitHub Desktop.
Save russelllim22/e292941bc9577d39376edd270d99def7 to your computer and use it in GitHub Desktop.
let svg = d3.select("#plotSVG")
svg.selectAll(".bubble")
.data(articleData) // bind each element of the data array to one SVG circle
.join("circle")
.attr("class", "bubble")
.attr("cx", d => d.views) // set the x position based on the number of claps
.attr("cy", d => 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