Public
Edited
Jul 15, 2024
Paused
Comments locked
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
inline = ({
style: [
["--width", "var(--scale) * var(--cqw)"],
["--height", "var(--scale) * var(--cqh)"],
["width", "min(var(--width), var(--aspect-ratio) * var(--height))"],
["height", "min(var(--height), var(--width) / (var(--aspect-ratio)))"],
["background", "var(--has-conic-gradient, none) currentColor"]
]
.map((declaration) => declaration.join(": "))
.join("; ")
})
Insert cell
available = CSS.supports("(aspect-ratio: 1)")
Insert cell
ratios = ["16:9", "4:3", "3:4", "2:3", "1:3", "1"]
Insert cell
cqw = (width - padding * 2) / 100
Insert cell
cqh = (height - padding * 2) / 100
Insert cell
padding = 50
Insert cell
height = Math.min(Math.floor(width / 2), 480)
Insert cell
(root.style.setProperty("--angle", angle), angle)
Insert cell
(root.style.setProperty("--tint", hue), hue)
Insert cell
root = document.documentElement
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