Published
Edited
Sep 13, 2020
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3 = require("d3@6")
Insert cell
Insert cell
Insert cell
html`
<svg id="vis2" width="450" height="120">
<circle id="ponto1" cx="40" cy="8" r="7" />
<circle id="ponto2" cx="80" cy="24" r="7" fill="crimson" />
<circle cx="150" cy="40" r="7" fill="crimson" />
<circle cx="160" cy="56" r="7" fill="crimson" />
<circle cx="230" cy="72" r="7" fill="crimson" />
<circle cx="420" cy="88" r="7" fill="crimson" />
</svg>
`
Insert cell
Insert cell
d3.select("#ponto1")
.attr("fill", "crimson")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// d3.selectAll("circle")
// .attr("r", 20)
Insert cell
Insert cell
// d3.selectAll("#vis2 > circle")
// .attr("r", 12)
Insert cell
Insert cell
Insert cell
Insert cell
viewof corEscolhida = html`<input type="color" value="#0000ff">`
Insert cell
d3.selectAll("#vis3 circle")
.attr("fill", corEscolhida)
Insert cell
html`
<svg id="vis3" width="450" height="120" class="ptos3">
<g fill-opacity="0.5" stroke="black">
<circle cx="40" cy="60" r="7" />
<circle cx="80" cy="60" r="7" />
<circle cx="150" cy="60" r="7" />
<circle cx="160" cy="60" r="7" />
<circle cx="230" cy="60" r="7" />
<circle cx="420" cy="60" r="7" />
</g>
</svg>
`
Insert cell
viewof tamanho = html`<input type=range min=1 max=20 step=2>`
Insert cell
d3.selectAll("#vis3 circle")
.attr("r", tamanho)
Insert cell
Insert cell
Insert cell
html`
<svg id="vis4" width=1000 height=100>
<rect id="meAnime" width=50 height=50 x=10 y=10 fill="steelblue" />
</svg>
`
Insert cell
Insert cell
// d3.select("#meAnime").transition()
// .duration(2000) // 2000 milliseconds => 2 seconds
// .attr("x", 700)
// .attr("y", 50)
// .attr("width", 100)
// .attr("fill", "firebrick");
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