Public
Edited
Jul 16, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data2 = data.filter(d => d.TIME_PERIOD === 2022 && d.UNIT_MULT === 3 && d.Measure !== "Total emissions including land use, land-use change and forestry" && d.Measure !== "Total emissions excluding land use, land-use change and forestry")

Insert cell
Insert cell
vl.markBar()
.data(New)
.title("Emission Amount Per Country in 2022")
.encode(
vl.x().fieldQ('Amount').title('Emission Amount (Tons)'),
vl.y().fieldN('Country').title('Countries'),
vl.tooltip(['Amount', 'Measure']),
vl.color().fieldN('Measure').title('Source')
)
.render()
Insert cell
Insert cell
Insert cell
Insert cell
usaData = data.filter(d => d.REF_AREA === "USA" && d.UNIT_MULT === 3 && d.Measure !== "Total emissions including land use, land-use change and forestry" && d.Measure !== "Total emissions excluding land use, land-use change and forestry")
Insert cell
vl.markPoint()
.title("Emission Source Amount Per Year in America")
.data(usaData).encode(
vl.x().fieldN('TIME_PERIOD').title('Year'),
vl.y().fieldQ('OBS_VALUE').title('Emissions Amount (Tons)'),
vl.color().fieldN('Measure').title('Source'),
vl.tooltip([
{field: 'TIME_PERIOD', title: 'Year'}, {field: 'Pollutant', title: 'Pollutant'},
{field: 'OBS_VALUE', title: 'Amount (Tons)'},
{field: 'Measure', title: 'Source'}
])
).render()
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