Published
Edited
Sep 4, 2020
Insert cell
Insert cell
svg = {
const svg = html`<svg id = "svg"></svg>`
const container = d3.select(svg)
const drag = d3.drag()
.on("drag",function(){
const target = d3.select(this)
const x = d3.event.x
const y = d3.event.y
target.attr("cx",x).attr("cy",y)
})
container.append("circle")
.attr("r",50)
.attr("fill","cornflowerblue")
.attr("stroke","black")
.attr("cx",300)
.attr("cy",150)
.call(drag)
container.append("circle")
.attr("r",50)
.attr("fill","tomato")
.attr("stroke","black")
.attr("cx",100)
.attr("cy",200)
.call(drag)
return svg
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more