Published
Edited
Sep 27, 2020
Fork of Gareth Bale
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mutable stat = null
Insert cell
mutable axis = null
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
maxValue = d3.max(_.flatten(val).map(d => d.value))
Insert cell
val = data.map(d => d.stats)
Insert cell
data = {
var dataS = []
dd3.forEach(function(stat) {if (stat == "Stefan de Vrij (Inter)") {dataS.push(Data4deVrij)}});
dd3.forEach(function(stat) {if (stat == "Milan Škriniar (Inter)") {dataS.push(Data4Skriniar)}});
dd3.forEach(function(stat) {if (stat == "Toby Alderweireld (Spurs)") {dataS.push(Data4Alderweireld)}});
dd3.forEach(function(stat) {if (stat == "Eric Dier (Spurs)") {dataS.push(Data4Dier)}});
dd3.forEach(function(stat) {if (stat == "Rúben Dias (Benfica)") {dataS.push(Data4Dias)}});
dd3.forEach(function(stat) {if (stat == "Davinson Sanchez (Spurs)") {dataS.push(Data4Sanchez)}});
return dataS
}
Insert cell
Insert cell
Insert cell
Insert cell
axesDomain = data[0].stats.map(d => d.axis)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Data4Bale19 = flatBale19.filter((row)=> dd2.includes(row.axis));
Insert cell
Insert cell
Insert cell
Insert cell
Data4Sanchez = d3.json("https://gist.githubusercontent.com/theojolliffe/c6413ec3e7b955d7cbde8d10f245bfbf/raw/f356586d6f4d474f7ad45aaee27bb772a7c70359/SanchezStats")
.then(
function success(allData) {
const data = allData.data.members[0].statistic_groups;
const name = allData.data.members[0].name;
const mins = allData.data.members[0].statistic_groups[0].statistics[1].value;
const flat = flatten(data);
const stats = flat.filter((row)=> dd2.includes(row.axis));
return {stats, name, mins}
},
function error(e) {
throw e;
}
)

Insert cell
Data4Alderweireld = d3.json("https://gist.githubusercontent.com/theojolliffe/72547244b46fa13fdacddc7e8a7d5c3d/raw/25dc318b66990c665a932e7a2d0cc2f711943e43/AlderweireldStats")
.then(
function success(allData) {
const data = allData.data.members[0].statistic_groups;
const name = allData.data.members[0].name;
const mins = allData.data.members[0].statistic_groups[0].statistics[1].value;
const flat = flatten(data);
const stats = flat.filter((row)=> dd2.includes(row.axis));
return {stats, name, mins}
},
function error(e) {
throw e;
}
)
Insert cell
Data4Dier = d3.json("https://gist.githubusercontent.com/theojolliffe/c7f80a56823cc2cc537f819b743bb4cc/raw/2f46901a8456c9f6c495b9aa00e5c6bb9d5b9e96/DierStats")
.then(
function success(allData) {
const data = allData.data.members[0].statistic_groups;
const name = allData.data.members[0].name;
const mins = allData.data.members[0].statistic_groups[0].statistics[1].value;
const flat = flatten(data);
const stats = flat.filter((row)=> dd2.includes(row.axis));
return {stats, name, mins}
},
function error(e) {
throw e;
}
)
Insert cell
Data4Dias = d3.json("https://gist.githubusercontent.com/theojolliffe/e65675f6dd4201ebb03c948015ee3478/raw/9084b2f8bf949450853eb70e5959678a3a059e31/RubenDiasStats")
.then(
function success(allData) {
const data = allData.data.members[0].statistic_groups;
const name = allData.data.members[0].name;
const mins = allData.data.members[0].statistic_groups[0].statistics[1].value;
const flat = flatten(data);
const stats = flat.filter((row)=> dd2.includes(row.axis));
return {stats, name, mins}
},
function error(e) {
throw e;
}
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
flatRonaldo[1].value
Insert cell
flatSon[1]
Insert cell
flatBale[1]
Insert cell
Insert cell
Insert cell
Insert cell
axesLength = data[0].stats.length
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 600
Insert cell
Insert cell
Insert cell
Insert cell
color = d3.scaleOrdinal()
.range(["#EDC951","#CC333F","#00A0B0", "green", "purple", "#FF1493"])
Insert cell
Insert cell
Insert cell
Insert cell
function radio(config = {}) {
let {
value: formValue,
title,
description,
submit,
options,
disabled
} = Array.isArray(config) ? { options: config } : config;
options = options.map(o =>
typeof o === "string" ? { value: o, label: o } : o
);
const form = input({
type: "radio",
title,
description,
submit,
getValue: input => {
if (input.checked) return input.value;
const checked = Array.prototype.find.call(input, radio => radio.checked);
return checked ? checked.value : undefined;
},
form: html`
<form>
${options.map(({ value, label }, i) => {
const input = html`<input type=radio name=input ${
value === formValue ? "checked" : ""
} style="vertical-align: top; ${
i === 0 ? `margin-left: 1px;` : ``
}" />`;
input.setAttribute("value", value);
if (disabled) input.setAttribute("value", disabled);
const tag = html`
<label style="display: inline-block; margin: 5px 10px 3px 0; font-size: 0.85em;">
${input}
${label}
</label>`;
return tag;
})}
</form>
`
});
form.output.remove();
return form;
}
Insert cell
d3format = require("d3-format@1")
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more