Published
Edited
Oct 22, 2021
Insert cell
Insert cell
Insert cell
"Hello World"
Insert cell
Insert cell
Insert cell
x = 100
Insert cell
Insert cell
y = x * 5
Insert cell
Insert cell
Insert cell
a = {
const output = 1;
return output;
}
Insert cell
Insert cell
Insert cell
z = Promise.resolve(x * 10) // fetch, etc
Insert cell
Insert cell
today = {
const result = await new Promise((resolve) => {
resolve({ today: new Date() });
});

return result.today;
}
Insert cell
Insert cell
Insert cell
counter = {
let value = 1;

while (true) {
await new Promise((resolve) => setTimeout(resolve, 1000)); // wait for 1 second
yield value++;
}
}
Insert cell
Insert cell
Insert cell
<marquee>🦖</marquee>
Insert cell
Insert cell
Insert cell
mutable clicks = 2
Insert cell
Insert cell
Insert cell
handleClick = () => {
mutable clicks++;
}
Insert cell
Insert cell
Insert cell
htl.html`<button onclick=${handleClick}>Click me</button>`
Insert cell
Insert cell
Insert cell
viewof color = Inputs.color({ value: "#24c64d" })
Insert cell
Insert cell
viewof text = Inputs.text({ value: "Hello World" })
Insert cell
viewof size = Inputs.range([50, 400], { value: 200, step: 1 })
Insert cell
viewof zoom = Inputs.range([-100, 100], { value: 0, step: 1 })
Insert cell
viewof angle = Inputs.range([0, 360], { value: 0, step: 1 })
Insert cell
Insert cell
<div style="perspective:800px;width:${y*2}px;height:${x*2}px;display:flex;align-items:center;justify-content:center;">
<div style="background:${color};width:${y}px;height:${x}px;display:flex;align-items:center;justify-content:center;color:white;box-shadow:0 2px 3px #aaa;font-size:${size}%;transform: perspective(500px) translate3d(0, 0, ${zoom}px) rotate(${angle}deg);">${text}</div>
</div>
Insert cell
Insert cell
Insert cell
items = [
{ weight: 100, height: 200, country: "A" },
{ weight: 200, height: 150, country: "A" },
{ weight: 300, height: 100, country: "B" },
{ weight: 50, height: 20, country: "C" }
]
Insert cell
Plot.dot(items, {
x: "weight",
y: "height",
fill: "country"
}).plot()
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