Published
Edited
Nov 19, 2020
40 stars
Insert cell
Insert cell
Insert cell
books = [
{ title: 'Broad Band', author: 'Claire L. Evans', rating: 4},
{ title: 'Americanah', author: 'Chimamanda Ngozi Adichie', rating: 5},
{ title: 'Another Country', author: 'James Baldwin', rating: 4.5}
]
Insert cell
Insert cell
d3.tsvParse(rawData)
Insert cell
d3 = require('d3-dsv')
Insert cell
Insert cell
file = FileAttachment("Racial Equity Resources.csv")
Insert cell
d3.csvParse(await file.text())
Insert cell
text = file.text()
Insert cell
d3.csvParse(text)
Insert cell
FileAttachment("weather.json").json()
Insert cell
FileAttachment("observable_banner.png").image()
Insert cell
Insert cell
import { alphabet } from '@observablehq/vega-lite-chart-types'
Insert cell
alphabet
Insert cell
Insert cell
url = 'https://data.sfgov.org/resource/xdgd-c79v.json'
Insert cell
response = fetch(url)
Insert cell
response.json()
Insert cell
jsonData = (await fetch(url)).json()
Insert cell
d3Fetch = require('d3-fetch')
Insert cell
d3Fetch.json(url)
Insert cell
marsData = d3Fetch.json(`https://api.nasa.gov/insight_weather/?api_key=${Secret("NASA_API_KEY")}&feedtype=json&ver=1.0`)
Insert cell
Insert cell
Insert cell
Insert cell
db = DatabaseClient("Weather")
Insert cell
db.describe('weather')
Insert cell
db.query(`select location, date, weather from weather where location='${location}' limit 20`)
Insert cell
// As an alternative to the above approach using ${} within the template literal, you can also pass an array of variables as a second arg to the DatabseClient.query() method.
// This version will do any needed escaping if your variable has any tricky characters like quotes (‘“) in it. See https://observablehq.com/@observablehq/connecting-to-databases#query for more details!
db.query('select location, date, weather from weather where location=$1 limit 20', [location])
Insert cell
viewof location = select(['Seattle', 'New York'])
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