Published
Edited
Oct 25, 2021
1 star
Insert cell
Insert cell
Insert cell
defaultData = (await FileAttachment("fifaData.csv.zip").zip())
.file("fifaData.csv")
.csv({ typed: true })
Insert cell
viewof data = dataInput({ value: defaultData })
Insert cell
Inputs.table(data)
Insert cell
navio(data, { attribWidth: 8, height: 400 })

Insert cell
attribs = Object.keys(data[0])
Insert cell
quantAttribs = attribs.filter(a => typeof data[0][a] === "number" && a.trim() !== "")
Insert cell
categoricalAttribs = attribs.filter(
a => typeof data[0][a] !== "number" && a.trim() !== ""
)
Insert cell
viewof xAttr = Inputs.select(quantAttribs, {
label: "X Attr",
value: "Overall"
})
Insert cell
scatterPlot = vl
.markPoint()
.data(data)
.encode(vl.x().fieldQ(xAttr), vl.y().fieldQ("Potential"))
.render()
Insert cell
// md`
// ### Here is my chart
// ${viewof xAttr}
// ${scatterPlot}
// `
Insert cell
Insert cell
histogram = vl
.markBar()
.data(data)
.encode(vl.y().fieldN(histX), vl.x().average("Overall"))
.height(600)
.render({ renderer: "SVG" })
Insert cell
Insert cell
import { navio } from "@john-guerra/navio"
Insert cell
import { dataInput } from "@john-guerra/data-input"
Insert cell
import { vl } from "@vega/vega-lite-api-v5"
Insert cell
Insert cell
viewof df = aq.from(data).view()
Insert cell
viewof filtered = df
.select(["Name", "Nationality", "Overall"])
.filter(d => d.Overall > 90)
.view()
Insert cell
import { aq } from "@uwdata/arquero"
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