|
|
@ -94,33 +94,33 @@ const Diagram = { |
|
|
|
return chords; |
|
|
|
return chords; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
swapGroups: (data, eventIndex, chords, i, j) => { |
|
|
|
swapGroups: (data, eventKey, chords, i, j) => { |
|
|
|
Diagram.swapGroupArcs(chords, i, j); |
|
|
|
Diagram.swapGroupArcs(chords, i, j); |
|
|
|
Matrices.swapIndices(data.tourneys[eventIndex].teams, i, j); |
|
|
|
Matrices.swapIndices(data.tourneys[eventKey].teams, i, j); |
|
|
|
return chords; |
|
|
|
return chords; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCountryName: (data, eventIndex, n) => { |
|
|
|
getCountryName: (data, eventKey, n) => { |
|
|
|
const team = data.tourneys[eventIndex].teams[n]; |
|
|
|
const team = data.tourneys[eventKey].teams[n]; |
|
|
|
return data.countries[team.cId]; |
|
|
|
return data.countries[team.cId]; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getPopulation: (data, eventIndex, n) => { |
|
|
|
getPopulation: (data, eventKey, n) => { |
|
|
|
const team = data.tourneys[eventIndex].teams[n]; |
|
|
|
const team = data.tourneys[eventKey].teams[n]; |
|
|
|
return team.p; |
|
|
|
return team.p; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getGoalsFor: (data, eventIndex, n) => { |
|
|
|
getGoalsFor: (data, eventKey, n) => { |
|
|
|
const team = data.tourneys[eventIndex].teams[n]; |
|
|
|
const team = data.tourneys[eventKey].teams[n]; |
|
|
|
return team.ga; |
|
|
|
return team.ga; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getGoalsAgainst: (data, eventIndex, n) => { |
|
|
|
getGoalsAgainst: (data, eventKey, n) => { |
|
|
|
const team = data.tourneys[eventIndex].teams[n]; |
|
|
|
const team = data.tourneys[eventKey].teams[n]; |
|
|
|
return team.gf; |
|
|
|
return team.gf; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
build: (data, eventIndex, matrix) => { |
|
|
|
build: (data, eventKey, matrix) => { |
|
|
|
const svg = d3.select("svg"), |
|
|
|
const svg = d3.select("svg"), |
|
|
|
width = +svg.attr("width"), |
|
|
|
width = +svg.attr("width"), |
|
|
|
height = +svg.attr("height"), |
|
|
|
height = +svg.attr("height"), |
|
|
@ -132,14 +132,14 @@ const Diagram = { |
|
|
|
.padAngle(0.05) |
|
|
|
.padAngle(0.05) |
|
|
|
.call(null, matrix); |
|
|
|
.call(null, matrix); |
|
|
|
|
|
|
|
|
|
|
|
const sortedChords = Sorter.sort(chords, 0, chords.groups.length - 1, |
|
|
|
// const sortedChords = Sorter.sort(chords, 0, chords.groups.length - 1,
|
|
|
|
// Diagram.getCountryName.bind(null, data, eventIndex),
|
|
|
|
// // Diagram.getCountryName.bind(null, data, eventKey),
|
|
|
|
// Diagram.getGoalsFor.bind(null, data, eventIndex),
|
|
|
|
// // Diagram.getGoalsFor.bind(null, data, eventKey),
|
|
|
|
Diagram.getGoalsAgainst.bind(null, data, eventIndex), |
|
|
|
// Diagram.getGoalsAgainst.bind(null, data, eventKey),
|
|
|
|
// Diagram.getPopulation.bind(null, data, eventIndex),
|
|
|
|
// // Diagram.getPopulation.bind(null, data, eventKey),
|
|
|
|
Diagram.swapGroups.bind(null, data, eventIndex)); |
|
|
|
// Diagram.swapGroups.bind(null, data, eventKey));
|
|
|
|
|
|
|
|
|
|
|
|
// const sortedChords = chords;
|
|
|
|
const sortedChords = chords; // SORTED: "null"
|
|
|
|
// let sortedChords = Diagram.swapGroups(data, "1930", chords, 2, 10);
|
|
|
|
// let sortedChords = Diagram.swapGroups(data, "1930", chords, 2, 10);
|
|
|
|
// sortedChords = Diagram.swapGroups(data, "1930", chords, 2, 8);
|
|
|
|
// sortedChords = Diagram.swapGroups(data, "1930", chords, 2, 8);
|
|
|
|
// [ Romania, Belgium, Serbia, France, US, Mexico, Paraguay, Peru, Uruguay, Chile, Bolivia, Brazil, Argentina ]
|
|
|
|
// [ Romania, Belgium, Serbia, France, US, Mexico, Paraguay, Peru, Uruguay, Chile, Bolivia, Brazil, Argentina ]
|
|
|
@ -192,13 +192,13 @@ const Diagram = { |
|
|
|
.attr("class", "ribbon") |
|
|
|
.attr("class", "ribbon") |
|
|
|
.append("title") |
|
|
|
.append("title") |
|
|
|
.text(function(d) { |
|
|
|
.text(function(d) { |
|
|
|
const t1 = data.tourneys[eventIndex].teams[d.source.index]; |
|
|
|
const t1 = data.tourneys[eventKey].teams[d.source.index]; |
|
|
|
const t2 = data.tourneys[eventIndex].teams[d.target.index]; |
|
|
|
const t2 = data.tourneys[eventKey].teams[d.target.index]; |
|
|
|
|
|
|
|
|
|
|
|
const c1 = data.countries[t1.cId]; |
|
|
|
const c1 = data.countries[t1.cId]; |
|
|
|
const c2 = data.countries[t2.cId]; |
|
|
|
const c2 = data.countries[t2.cId]; |
|
|
|
|
|
|
|
|
|
|
|
const game = data.tourneys[eventIndex].games.find(v => { |
|
|
|
const game = data.tourneys[eventKey].games.find(v => { |
|
|
|
return (v.t1 === t1.tId || v.t1 === t2.tId) && (v.t2 === t1.tId || v.t2 === t2.tId); |
|
|
|
return (v.t1 === t1.tId || v.t1 === t2.tId) && (v.t2 === t1.tId || v.t2 === t2.tId); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -223,7 +223,7 @@ const Diagram = { |
|
|
|
.text(function(d) { |
|
|
|
.text(function(d) { |
|
|
|
// STRANGE EXTENDED TIME CHILE-BRAZIL (when? not 1930) - FIX BY HAND? IS BECAUE se1 IS SCORE __GOING INTO__ EXTENDED TIME
|
|
|
|
// STRANGE EXTENDED TIME CHILE-BRAZIL (when? not 1930) - FIX BY HAND? IS BECAUE se1 IS SCORE __GOING INTO__ EXTENDED TIME
|
|
|
|
|
|
|
|
|
|
|
|
const team = data.tourneys[eventIndex].teams[d.index]; |
|
|
|
const team = data.tourneys[eventKey].teams[d.index]; |
|
|
|
const country = data.countries[team.cId]; |
|
|
|
const country = data.countries[team.cId]; |
|
|
|
return data.countries[team.cId] + ' ' + team.p; |
|
|
|
return data.countries[team.cId] + ' ' + team.p; |
|
|
|
}); |
|
|
|
}); |
|
|
|