Public
Edited
Mar 21, 2023
2 forks
Insert cell
Insert cell
<svg width="1000" height="300">
<rect x="20" y="20" width="250" height="150"></rect>
</svg>
Insert cell
Insert cell
Insert cell
Insert cell
<svg width="1000" height="300">
<rect x="20" y="20" width=${width} height="150"></rect>
</svg>
Insert cell
width=250
Insert cell
Insert cell
Insert cell
<svg width="1000" height="300">
<rect x="20" y="20" width=${width_slider} height="150"></rect>
</svg>
Insert cell
viewof width_slider = Inputs.range([0, 500], {label: "Width", step: 1})
Insert cell
Insert cell
Insert cell
<svg width="1000" height="300">
<rect x="20" y="20" width="250" height="150"></rect>
</svg>
Insert cell
myRectangle = d3.select(mySVG4).select("rect")
Insert cell
myRectangle.attr("width", 350)
Insert cell
Insert cell
Insert cell
<svg width="1000" height="300">
<rect x="20" y="20" width="250" height="150"></rect>
<circle cx="50" cy="50" r="10" style="fill: yellow"></circle>
</svg>
Insert cell
myCircle = d3.select(mySVG5).select("circle")
Insert cell
myCircle.attr("r", 50)
Insert cell
Insert cell
myCircle.style("fill","red")
Insert cell
Insert cell
Insert cell
<svg width="1000" height="300">
<rect x="20" y="20" width="250" height="150"></rect>
<circle cx="50" cy="50" r="10" style="fill: yellow"></circle>
</svg>
Insert cell
myRectangle2 = d3.select(mySVG6).select("rect")
Insert cell
myRectangle2.attr("x", 500)
Insert cell
myRectangle2.attr("x", 50)
Insert cell
Insert cell
Insert cell
Insert cell
myRectangle3 = d3.select(mySVG7).select("rect")
Insert cell
myRectangle3.transition().duration(1000).attr("x", 500)
Insert cell
myRectangle3.transition().duration(1000).attr("x", 50)
Insert cell
myRectangle3.transition().ease(d3.easeLinear).duration(1000).attr("x", 500)
Insert cell
myRectangle3.transition().ease(d3.easeBounce).duration(1000).attr("x", 50)
Insert cell
Insert cell
Insert cell
Insert cell
myCircle2 = d3.select(mySVG8).select("circle")
Insert cell
myCircle2.transition().duration(1000).attr("cx", 500).attr("r", 150).style("fill","red")
Insert cell
myCircle2.transition().duration(1000).attr("cx", 50).attr("r", 20).style("fill","yellow")
Insert cell
Insert cell
Insert cell
<svg width="1000" height="300">
<rect x="20" y="20" width="250" height="150"></rect>
<circle cx="50" cy="50" r="10" style="fill: yellow"></circle>
<line x1="500" x2="600" y1="150" y2="150" style="stroke: blue; stroke-width: 2px"></line>
</svg>
Insert cell
myLine = d3.select(mySVG9).select("line")
Insert cell
myLine.attr("transform", "rotate(30 500,150)")
Insert cell
Insert cell
Insert cell
tick = ticker(10)
Insert cell
myLine.attr("transform", "rotate(" + tick + " 500,150)")
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