Public
Edited
Jan 25, 2023
3 forks
98 stars
Insert cell
Insert cell
data = d3.csv("https://gist.githubusercontent.com/mbostock/ddc6d50c313ebe6edb45519f43358c6c/raw/c443ed14c34c5c1b544949a546dd9d0acd05bad3/temperatures.csv")
Insert cell
Insert cell
data.map(d => +d.Year)
Insert cell
Insert cell
Promises
Insert cell
Insert cell
Promises.delay(3000, "Hello, world!")
Insert cell
Insert cell
{
let i = 0;
while (true) {
yield Promises.tick(1000, ++i);
}
}
Insert cell
Insert cell
{
let promise = Promises.delay(3000, "Hello, ");
return promise + "world!"; // 💥 Oops!
}
Insert cell
Insert cell
{
let greeting = await Promises.delay(3000, "Hello, ");
return greeting + "world!";
}
Insert cell
Insert cell
Promises.delay(3000, "Hello, ").then(greeting => greeting + "world!")
Insert cell
Insert cell
d3 = require("d3-fetch@1")
Insert cell
Insert cell
new Promise((resolve, reject) => {
setTimeout(() => {
resolve("Time’s up!");
}, 5000);
})
Insert cell
Insert cell
new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error("😱"))
}, 1000);
}).catch(e => "caught the error! " + e.message)
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