{
const height = 200
const svg = d3
.create("svg")
.attr("viewBox", [0, 0, width, height])
.style("width", "100%")
.style("height", "auto")
const genx = d3.randomInt(0,width)
const geny = d3.randomInt(0,height)
const genr = d3.randomInt(5,40)
const genh = d3.randomInt(0,360)
const points = d3.range(70).map(() => {
const hue = genh()
return {
x: genx(),
y: geny(),
r: genr(),
fc: d3.hsl(hue, 0.9, 0.5),
sc: d3.hsl((hue + 180) % 360, 0.4, 0.5),
}
})
svg.selectAll("circle")
.data(points)
.enter().append("circle")
.attr("cx", d => d.x)
.attr("cy", d => d.y)
.attr("r", d => d.r)
.attr("fill", d => d.fc.formatHsl())
.attr("stroke", d => d.sc.formatHsl())
.attr("stroke-width", d => d.r / 5)
.attr("data-tippy-content", d => html`color: <b>${d.fc.formatHsl()}</b></br>radius: <b>${d.r}</b>`.outerHTML)
.call(d => tippy(d.nodes(), { allowHTML: true }))
return svg.node()
}