Published
Edited
Oct 31, 2020
Fork of Template
Insert cell
Insert cell
data = d3.json("https://vega.github.io/vega-datasets/data/cars.json")
Insert cell
cars = data.filter( d => d.Name.split(" ")[0] == "chevrolet" || d.Name.split(" ")[0] == "ford")
Insert cell
cars2 = cars.filter(d => d.Miles_per_Gallon != null)
Insert cell
d3.extent(cars2, d => d.Miles_per_Gallon )
Insert cell
svg = {
const svg = html`<svg id = "svg"></svg>`
const container = d3.select(svg)
const xScale = d3.scaleLinear().domain([10, 36.1]).range([30,570])
const xAxis = container.append("g").attr("transform", "translate(0, 150)"
d3.axisBottom(xScale)(xAxis)

return svg
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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