Public
Edited
Oct 24, 2023
1 fork
27 stars
Insert cell
Insert cell
d3.cross([1, 2, 3], ["x", "y"])
Insert cell
Insert cell
d3.cross([1, 2, 3], [4, 5, 6], [7, 8, 9])
Insert cell
Insert cell
d3.cross()
Insert cell
d3.cross([1, 2, 3])
Insert cell
Insert cell
{
const product = [];
for (let a of [1, 2, 3]) {
for (let b of ["x", "y"]) {
product.push([a, b]);
}
}
return product;
}
Insert cell
Insert cell
{
const product = [];
for (let a of [1, 2, 3]) {
for (let b of [4, 5, 6]) {
for (let c of [7, 8, 9]) {
product.push([a, b, c]);
}
}
}
return product;
}
Insert cell
Insert cell
d3.select(html`<svg width=100 height=100>`)
.call(svg => svg.selectAll("g")
.data(d3.range(10))
.join("g")
.attr("transform", j => `translate(0,${j * 10})`)
.selectAll("circle")
.data(d3.range(10))
.join("circle")
.attr("transform", i => `translate(${i * 10},0)`)
.attr("cx", 5)
.attr("cy", 5)
.attr("r", 2.5))
.node()
Insert cell
Insert cell
d3.select(html`<svg width=100 height=100>`)
.call(svg => svg.selectAll("circle")
.data(d3.cross(d3.range(10), d3.range(10)))
.join("circle")
.attr("transform", ([i, j]) => `translate(${i * 10},${j * 10})`)
.attr("cx", 5)
.attr("cy", 5)
.attr("r", 2.5))
.node()
Insert cell
Insert cell
Insert cell
d3.cross([1, 2], ["x", "y"], (a, b) => `${a}/${b}`)
Insert cell
Insert cell
svg`<svg width=400 height=400 viewBox="0 0 10 10">
${d3.cross(
d3.range(10),
d3.range(10),
(i, j) => svg`<rect x=${i} y=${j} width=0.9 height=0.9 fill=#9${i}${j}>`
)}`
Insert cell
Insert cell
svg`<svg width=400 height=400 viewBox="-1 -1 5 5">
${d3.cross(
d3.range(4),
d3.range(4),
d3.range(4),
(i, j, k) =>
svg`<rect
x=${i - k / 3}
y=${2 - j + k / 3} width=0.9 height=0.9
fill=#${9 - 2 * i}${9 - 2 * j}${9 - 2 * k}
stroke=white stroke-width=0.01>`
)}`
Insert cell
Insert cell
${d3.cross(
[
"l’accecante / globo / di fuoco",
"si espande / rapidamente",
"trenate volte / piú luminoso / del sole"
],
[
"la testa / premuta / sulla spalla",
"i capelli / tra le labbra"
],
[
"mentre la moltitudine / delle cose / accade",
"io contemplo / il loro ritorno",
"malgrado / che le cose / fioriscano"
],
(a, b, c) => `_${a}<br>${b}<br>${c}_`
).join("\n\n")}
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more