Published
Edited
Feb 1, 2020
27 stars
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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
2 + 2
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
x = 2
Insert cell
x + 2
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
add2 = function(y) {
return y + 2
}
Insert cell
Insert cell
add2(2)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
arrow2 = y => y + 2
Insert cell
Insert cell
Insert cell
arrow2(2)
Insert cell
Insert cell
arrow2(x)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
html`<p>The value of x is ${x}</p>`
Insert cell
Insert cell
html`<p>The value of x is <b>${x}</b></p>`
Insert cell
Insert cell
html`<p>The value of x is <b style="color:blue">${x}</b></p>`
Insert cell
Insert cell
html`<p>The value of x times 100 is ${x*100}</p>`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {chart as globe} from "@palewire/newport-beach-california"
Insert cell
Insert cell
Insert cell
Insert cell
import {tweets} from "@palewire/trump-tweets"
Insert cell
Insert cell
Insert cell
Insert cell
tweets
Insert cell
Insert cell
Insert cell
numberOfTweets = tweets.length
Insert cell
Insert cell
firstTweet = tweets[0]
Insert cell
Insert cell
latestTweet = tweets[tweets.length - 1]
Insert cell
Insert cell
Insert cell
import {tweet as embed_tweet} from "@mbostock/tweet"
Insert cell
Insert cell
latestEmbed = embed_tweet(latestTweet.id_str)
Insert cell
Insert cell
html`President Trump has sent <b>${numberOfTweets}</b> tweets since <b>${new Date(firstTweet.created_at)}</b>.`
Insert cell
html`He sent is most recent tweet on <b>${new Date(latestTweet.created_at)}</b>, when he wrote:

${latestEmbed}`
Insert cell
Insert cell
Insert cell
import {slider} from "@jashkenas/inputs"
Insert cell
Insert cell
firstslider = slider()
Insert cell
Insert cell
configuredSlider = slider({
min: 0,
max: 100,
step: 1
})
Insert cell
Insert cell
configuredSlider.value
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof viewSlider = slider()
Insert cell
Insert cell
Insert cell
md`The value of this slider is ${viewSlider}`
Insert cell
Insert cell
viewof trumpSlider = slider({
min: 1,
max: numberOfTweets,
step: 1,
value: 1
})
Insert cell
Insert cell
embed_tweet(tweets[trumpSlider-1].id_str)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof box = text()
Insert cell
Insert cell
box
Insert cell
Insert cell
Insert cell
tweets.filter
Insert cell
Insert cell
boxTweets = tweets.filter(x => x.contains(box))
Insert cell
Insert cell
Insert cell
md`President Donald Trump has made ${boxTweets.length} tweets containing "${box}"`
Insert cell
Insert cell
embed_tweet(boxTweets.getRandomTweet().id_str)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {color} from "@jashkenas/inputs"
Insert cell
viewof areaColor = color({
value: "#fff3d6"
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof filter = text({
title: "Filter Trump's tweets",
placeholder: "Enter a word, like 'Sad!'",
value: "Witch Hunt"
})
Insert cell
filteredTweets = tweets.filter(t => t.contains(filter))
Insert cell
Insert cell
Insert cell
md`${filteredTweets.length} matches`
Insert cell
Insert cell
Insert cell
Insert cell
import {serialize} from "@mbostock/saving-svg"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {rasterize} from "@mbostock/saving-svg"
Insert cell
Insert cell
Insert cell
Insert cell
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