Public
Edited
Jun 5
Insert cell
Insert cell
printTable(data.slice(0, 15))
Insert cell
longData.slice(0, 10) //shows the first 10 rows
Insert cell
Object.keys(data[0])
Insert cell
import {vl} from '@vega/vega-lite-api-v5'
Insert cell
import {printTable} from '@uwdata/data-utilities'
Insert cell
longData = data.map(d => ({
Country: d['REF_AREA'], // country name
Year: +d['TIME_PERIOD'], // numeric year
Emissions: +d['OBS_VALUE'] // emission value (numeric)
}));


Insert cell
vl.markLine()
.data(longData)
.encode(
vl.x().fieldN('Year').title('Year').axis({labelAngle: 0}), // treat Year as nominal to show all years as categories
vl.y().fieldQ('Emissions').title('Emissions'),
vl.color().fieldN('Country').title('Country'),
vl.tooltip(['Country', 'Year', 'Emissions'])
)
.width(700)
.height(400)
.render();

Insert cell
data = FileAttachment("Greenhouseemission.csv").csv({typed: true})
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