Plot = import("https://cdn.jsdelivr.net/npm/@observablehq/plot/+esm")
/* source data */
narrative_data = FileAttachment("country_visuals/country_narratives.csv").csv({ "typed": true });
bar_data = FileAttachment("country_visuals/bar_data_index.csv").csv({ "typed": true });
radar_grid = FileAttachment("country_visuals/radar_grid.csv").csv({ "typed": true });
radar_axes = FileAttachment("country_visuals/radar_axes.csv").csv({ "typed": true });
radar_data = FileAttachment("country_visuals/radar_data_full.csv").csv({ "typed": true });
radar_imputed = FileAttachment("country_visuals/radar_imputed.csv").csv({ "typed": true });
/* country selectors */
country_codes = [
"AUS", "AUT", "BEL", "BGR", "CAN", "CHL", "HRV", "CZE", "DNK", "EST", "FIN",
"FRA", "DEU", "GRC", "HUN", "ISL", "IRL", "ISR", "ITA", "JPN", "LVA", "LTU",
"MEX", "NLD", "NZL", "NOR", "POL", "PRT", "ROU", "SVK", "SVN", "KOR", "ESP",
"SWE", "CHE", "TUR", "GBR", "USA"
]
countries = [
"Australia", "Austria", "Belgium", "Bulgaria", "Canada", "Chile", "Croatia",
"Czechia", "Denmark", "Estonia", "Finland", "France", "Germany", "Greece",
"Hungary", "Iceland", "Ireland", "Israel", "Italy", "Japan", "Latvia",
"Lithuania", "Mexico", "Netherlands", "New Zealand", "Norway", "Poland",
"Portugal", "Romania", "Slovakia", "Slovenia", "South Korea", "Spain",
"Sweden", "Switzerland", "Turkey", "United Kingdom",
"United States of America"
]
/* InCiSE data points */
incise_bar = bar_data.filter(function(df){
return "InCiSE" == df.cc_iso3c
});
incise_radar = radar_data.filter(function(df){
return "InCiSE" == df.cc_iso3c
});
set_val = function(input, value) {
input.value = value;
input.dispatchEvent(new Event("input"))
};
bar_plot.addEventListener("mousedown", (event) => {
if (bar_plot.value != null) {
if (bar_plot.value.cc_iso3c == "InCiSE") {
return null
}
var sel_country = countries[country_codes.indexOf(bar_plot.value.cc_iso3c)]
set_val(viewof usr_country, sel_country)
}
});
country_codes = Array(38) ["AUS", "AUT", "BEL", "BGR", "CAN", "CHL", "HRV", "CZE", "DNK", "EST", "FIN", "FRA", "DEU", "GRC", "HUN", "ISL", "IRL", "ISR", "ITA", "JPN", …]
countries = Array(38) ["Australia", "Austria", "Belgium", "Bulgaria", "Canada", "Chile", "Croatia", "Czechia", "Denmark", "Estonia", "Finland", "France", "Germany", "Greece", "Hungary", "Iceland", "Ireland", "Israel", "Italy", "Japan", …]
set_val = ƒ(input, value)