Published
Edited
Feb 24, 2021
Fork of Demo
1 star
Insert cell
Insert cell
Insert cell
1 + 1 // Edit me!
Insert cell
Insert cell
{
let sum = 0;
for (let i = 0; i < 100; ++i) {
sum += i;
}
return sum;
}
Insert cell
Insert cell
color = "red" // Edit me!
Insert cell
`My favorite color is ${color}.`
Insert cell
Insert cell
object = ({open: [atob("c2VzYW1l")]})
Insert cell
Insert cell
html`<span style="background:yellow;">
My favorite language is <i>HTML</i>.
</span>`
Insert cell
md`Hi Mom! It’s me, *Markdown*.`
Insert cell
Insert cell
html`My favorite color is <i style="background:${color};">${color}</i>.`
Insert cell
Insert cell
cars = fetch("https://raw.githubusercontent.com/vega/vega/v4.3.0/docs/data/cars.json")
.then(response => response.json())
Insert cell
Insert cell
d3 = require("d3-array@2")
Insert cell
Insert cell
d3.median(cars, d => d.Horsepower)
Insert cell
Insert cell
function greet(subject) {
return `Hello, ${subject}!`;
}
Insert cell
greet("world")
Insert cell
Insert cell
c = {
for (let i = 0; true; ++i) {
yield i;
}
}
Insert cell
Insert cell
Insert cell
{
const height = 33;
const context = DOM.context2d(width, height);
for (let i = 0; i < width; ++i) {
const t = i / width;
const r = Math.floor(255 * Math.sin(Math.PI * (t + 0 / 3)) ** 2);
const g = Math.floor(255 * Math.sin(Math.PI * (t + 1 / 3)) ** 2);
const b = Math.floor(255 * Math.sin(Math.PI * (t + 2 / 3)) ** 2);
context.fillStyle = `rgb(${r},${g},${b})`;
context.fillRect(i, 0, 1, height);
yield context.canvas;
}
}
Insert cell
Insert cell
tick = {
while (true) {
const date = new Date(Math.ceil(Date.now() / 1000) * 1000);
await Promises.when(date);
yield date;
}
}
Insert cell
Insert cell
slider = html`<input type=range>`
Insert cell
sliderValue = Generators.input(slider)
Insert cell
Insert cell
viewof d = html`<input type=range>` // Edit me! Try type=text.
Insert cell
Insert cell
Insert cell
import {tweet} from "@mbostock/tweet"
Insert cell
tweet("958726175123128321")
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