Public
Edited
Sep 15, 2022
1 fork
Insert cell
Insert cell
x = 1 + 2
Insert cell
viewof y = Inputs.range([0, 100], {label: "Amount", step: 1})
Insert cell
x + y
Insert cell
<h1>Hello Observablehq </h1>
<p> This is written using html</p>
<p> ${y}</p>
Insert cell
# Hello Markdown
## Subheading h2
### Subheading h3
This is _written in italics_ using **markdown with bold**
You can reference a variable ${y}

- List 1
- List 2
- List 3

Insert cell
Insert cell
Insert cell
45
Insert cell
45 * foo
Insert cell
foo = 56
Insert cell
foo * foo
Insert cell
Insert cell
k = "hello"
Insert cell
z = "world"
Insert cell
k + z
Insert cell
`This is a string on two lines

hello there`
Insert cell
Insert cell
true
Insert cell
5 > 4
Insert cell
truth = 5
Insert cell
Insert cell
myrange = [32, 43, 22, 34, 43, 54]
Insert cell
myrange.length
Insert cell
myrange[0]
Insert cell
superpowers = ["india", "china", "us", "russia", "britian"]
Insert cell
superpowers[3]
Insert cell
## Objects {}
Insert cell
superera = ({
india: "past",
china: "upcoming",
us: "present",
russia: "may be not",
britain: "brexit"
})
Insert cell
superera.india
Insert cell
Insert cell
dataColumns = ({
area: ["North", "East", "West", "South", "Central"],
sales: [5, 25, 10, 20, 5],
profit: [2, 6, 8, 3, 5]
})
Insert cell
dataRows = [
{ area: "north", sales: 5, profit: 2 },
{ area: "east", sales: 25, profit: 6 },
{ area: "west", sales: 10, profit: 8 },
{ area: "south", sales: 20, profit: 3 },
{ area: "central", sales: 5, profit: 5 }
]
Insert cell
Insert cell
function sum(a, b) {
return a + b;
}
Insert cell
sum(3, 5)
Insert cell
Insert cell
url = "https://docs.google.com/spreadsheets/d/e/2PACX-1vTtkxwSfjDnHU4ngwXiXKzg_cEEoiiC6E1_lL4TkeciLlL36XoEKoSC6HBeO-K80yF-WtqepsbqK9GY/pub?gid=0&single=true&output=csv"
Insert cell
sample = d3.csv(url, d3.autoType)
Insert cell
viewof table = Inputs.table(sample)
Insert cell
## Attach Data
Insert cell
exampleData = FileAttachment("Example - data.csv").csv()
Insert cell
viewof param = Inputs.select(["Sales", "Profit"], { label: "Select one" })
Insert cell
Plot.plot({
marks: [
Plot.barY(sample, {
x: "Area",
y: param,
fill: "blue",
sort: { x: "y", reverse: true }
})
]
})
Insert cell
Plot.plot({
marks: [
Plot.barY(sample, {
x: "Area",
y: "Sales",
sort: { x: "y", reverse: true }
}),
Plot.barY(sample, {
x: "Area",
y: "Profit",
fill: "red",
sort: { x: "y", reverse: true }
})
]
})
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