Public
Edited
Jan 18, 2024
Insert cell
Insert cell
Insert cell
Insert cell
another_dataset_1920@1.csv
Type Table, 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
function type_changing(data) {
for (let i = 0; i < data.length; i++){
// data[i].year = Number(data[i].year)
data[i].year =String(data[i].year)
}
}
Insert cell
type_changing(data)
Insert cell
Insert cell
function yAccessor_for_barplot(m) {
if (m == 'Total')
{
return 'Co2';
} else if (m == 'Coal CO2')
{
return 'Coal_co2';
} else if (m == 'Oil CO2')
{
return 'Oil_co2';
} else if (m == 'Gas CO2')
{
return 'Gas_co2';
} else if (m == 'Cement CO2')
{
return 'cement_co2';
} else if (m == 'Flaring CO2')
{
return 'Flaring_co2';
}
};
Insert cell
function yAccessor(measure, d) {
if (measure == 'Total') {
return Number(d.co2);
} else if (measure == 'Coal CO2') {
return Number(d.coal_co2);
} else if (measure == 'Oil CO2') {
return Number(d.oil_co2);
} else if (measure == 'Gas CO2') {
return Number(d.gas_co2);
} else if (measure == 'Cement CO2') {
return Number(d.cement_co2);
} else if (measure == 'Flaring CO2') {
return Number(d.flaring_co2);
}
};
Insert cell
Insert cell
import {interval} from "@mootari/range-slider@1781"
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