Public
Edited
Jan 12, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
//viewof summary_raw_data = SummaryTable(emissions_raw, {label: "Emissions Data"})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
d3.max(heatMapValuesStruct[1], (d) => d.ghg);
Insert cell
d3.min(heatMapValuesStruct, (d, i) => d3.min(heatMapValuesStruct[i], (d) => d.ghg));
Insert cell
d3.max(heatMapValuesStruct[0], (d) => d[heatmapChosenData])
Insert cell
Insert cell
function accessHeatMapValue(index) {
debugger
const countryIdx = parseInt(index.slice(0, 2));
const yearIdx = parseInt(index.slice(-2));

return heatMapValuesStruct[countryIdx][yearIdx][heatmapChosenData];
}
Insert cell
Insert cell
accessHeatMapValue("0501")
Insert cell
Insert cell
Insert cell
data_UE_World
X
year
Y
sum
co2
Color
country
Size
Facet X
Facet Y
Mark
line
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
emissions_raw
X
year
Y
sum
co2
Color
Size
Facet X
Facet Y
Mark
line
Type Chart, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data1
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
data_UE_World = {
const countriesInData2 = data2.map(item => item.country);
countriesInData2.push('World'); // Add 'World' to the array

const copy_emissions_raw = emissions_raw

const filteredData = emissions_raw
.filter(item => countriesInData2.includes(item.country))
.filter(item => item.year >= 1950); // Filter for years >= 1950

// Replace all countries with 'UE' except 'World'
filteredData.forEach(item => {
if (item.country !== 'World') {
item.country = 'UE';
}
item.co2 = parseFloat(item.co2); // or use Number(item.co2);
});

return filteredData;
}

Insert cell
data_UE_World
select case when country <> 'World' then 'UE' else country end as country,year,co2 from data_UE_World
--group by case when country <> 'World' then 'UE' else country end,year
Insert cell
data_UE = {
const countriesInData2 = data2.map(item => item.country);

const filteredData = emissions.filter(item => countriesInData2.includes(item.country));
console.log(filteredData);

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