Published
Edited
May 19, 2020
Importers
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function differentScore(metric) {
if (metric == "User_Score") {
var groupByGenre = d3
.nest()
.key(d => d.Genre)
.entries(data)
.map(d => {
return {
Genre: d.key,
mean_user_score: d3.mean(d.values, d => d.User_Score)
};
})
.slice(0,7)
} else if (metric == "Critic_Score") {
var groupByGenre = d3
.nest()
.key(d => d.Genre)
.entries(data)
.map(d => {
return {
Genre: d.key,
mean_user_score: d3.mean(d.values, d => d.Critic_Score)
};
})
.slice(0,7)
}
return groupByGenre;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
chart2.update(metric)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 300
Insert cell
Insert cell
Insert cell
md`### Axes`
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