Public
Edited
May 11, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
chart_treemap_only_topics_dual = {if (data_github_treemap_only_topics_dual.length != 0) {
const chart_treemap_only_topics_dual = Treemap(data_github_treemap_only_topics_dual, {
path: d => d.topic,
value: d => d?.freq,
group: d => d.topic,
label: (d) => `${d["topic"]}\n${Math.round(d["freq"]*100)}%`,
title: (d, n) => `${d["topic"]}\n${Math.round(d["freq"]*100)}%`,
tile: d3.treemapBinary,
sort: d => d?.topic,
width: 1280,
height: 750,
round: true,
fillOpacity: 1.0,
colors: data_github_treemap_only_topics_dual.map(d=> colors_topics[d.topic])
});
return chart_treemap_only_topics_dual;
} else {
return html`<p>No Data available</p>`;
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
zoomable_treemap = zoomableTreemapAll(zoomable_data, 1280, 750, colors_topics, "en")
Insert cell
zoomable_treemap_mob = zoomableTreemapAll(zoomable_data, 520, 800, colors_topics, "en")
Insert cell
Insert cell
Insert cell
zoomable_treemap_all_data_incl = zoomableTreemapAll(speech_button_treemap_all_data_incl == "All Data" ? zoomable_data_all : zoomable_data_all_data_not_incl, 1280, 750, colors_topics, "en");
Insert cell
zoomable_treemap_all_data_incl_mob = zoomableTreemapAll(speech_button_treemap_all_data_incl == "All Data" ? zoomable_data_all : zoomable_data_all_data_not_incl, 520, 800, colors_topics, "en");
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// data_github_treemap_only_topics_dual = (speech_button_treemap_new !== "All Data") ? fetch(gh_path+index_pol_leaders_eng[pol_button_treemap]+"/"+speech_button_treemap_new+"/analysis/visuals/"+list_treemap_views[views_button_treemap]+".json").then((response) => response.json()) : fetch(gh_path+index_pol_leaders_eng[pol_button_treemap]+list_treemap_views[views_button_treemap]+".json").then((response) => response.json())

data_github_treemap_only_topics_dual = fetch(gh_path+index_pol_leaders_eng[pol_button_treemap]+"/"+speech_button_treemap+"/analysis/visuals/"+list_treemap_views[views_button_treemap]+".json").then((response) => response.json())
Insert cell
list_treemap_views[views_button_treemap]
Insert cell
Insert cell
Insert cell
Insert cell
categories_perc = topics_percentage_categories(pol_button_treemap, speech_button_treemap, list_treemap_perc_calc, "en")
Insert cell
Insert cell
Insert cell
zoomable_data_all_data_not_incl = calculateDataForAllDataIncl(pol_button_treemap, speech_button_treemap_all_data_incl, list_treemap_perc_calc, "en")
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
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
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
// colorScale = d3.scaleOrdinal(
// [...new Set(["No/Low "+ type_button_fraction, "Moderate "+ type_button_fraction, "High/Severe "+ type_button_fraction])],
// ["#e2e9e9", "#f7eab7", "#d35f3c"]
// )
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
// lineColorScale = ({
// Mitsotakis: "#0e3354",
// Velopoulos: "#75b9be",
// Koutsoumpas: "#7a2608",
// Androulakis: "#768948",
// Tsipras: "#af370b",
// Varoufakis: "#cc9ea6"
// })
Insert cell
Insert cell
Insert cell
Insert cell
stackedBarChart = stackedChartSentiment(labeled_my_data, sumTopicsSentiment(data_stacked_github), "en")
Insert cell
Insert cell
Insert cell
data_stacked_github = fetch(gh_path+index_pol_leaders_eng[pol_button_stacked]+"/"+speech_button_stacked+"/analysis/visuals/topic_sentiment.json").then((response) => response.json())
Insert cell
labeled_my_data = data_stacked_github.map(e => Object({topic: e.topic, sentiment: sentiment_score_to_label(e.sentiment)}))
Insert cell
Insert cell
Insert cell
PolarizationLinechart = PolarizationPlotAllSpeeches(data_polarization_all_github, "en")
Insert cell
Insert cell
Insert cell
data_polarization_all_github = get_polarization_per_speech(index_pol_leaders_eng[pol_button_polarizationlinechart], speeches_list_test)
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
gh_path_alldata
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
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700&display=swap" rel="stylesheet">
</head>
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