Public
Edited
Dec 18, 2022
2 stars
Insert cell
Insert cell
Insert cell
data_faram = FileAttachment("competition.xlsx").xlsx()
Insert cell
data_faram_new0 = data_faram.sheet(0, {headers: true})
Insert cell
data_faram_new1 = data_faram.sheet(1, {headers: true})
Insert cell
Insert cell
LoL_2021 = FileAttachment("League of Legends 2021 World Championship Play-In Groups Statistics - Raw Data@1.csv").csv({typed:true})
Insert cell
Insert cell
Plot.plot({
width : 900,
height : 300,
grid : true,
facet: {
data: LoL_2021,
x: "Result",
margin: 30
},
marks: [
Plot.barY(LoL_2021, {x: "Team", y: "Dragons For", fill:"Team"}),
//Plot.ruleY([0, 2000,3000]),
//Plot.text(bd, {x: "data_b", y: "count_b", fill: "age" , dy: , text: d=>d["count_b"]}),
], color: { range: colors, legend: true},
margintop: 30})
Insert cell
colors = ["#7fa074","#90719f","#2c4b27","#2d223c","#dec5da","#c1d1aa","#574571","#0e2810","#b695bc","#466c4b","#ffa074","#9a719f","#2f4b27","#22223c", "orange", "brown","#af9980"]
Insert cell
Insert cell
viewof select_date = Inputs.select(new Set(LoL_2021.map(d => d["Team"])), {label: "Команда"})
Insert cell
Plot.plot({
width : 700,
height : 200,
grid : true,
marks: [
Plot.barX(LoL_2021.filter(y=> y.Team==select_date&& y.Result=='W' ), Plot.groupY({x: "mean"}, {y: "Player", x: "Kills", fill:"Player"})),
], color: { range: colors, legend: true},
margintop: 30})
Insert cell
Insert cell
Plot.plot({
x: {
percent: true
},
marks: [
Plot.barX(LoL_2021.filter(y=> y.Result=='W' ), Plot.stackX(Plot.groupZ({x: "proportion"}, {fill: "Team"}))),
Plot.text(LoL_2021.filter(y=> y.Result=='W' ), Plot.stackX(Plot.groupZ({x: "proportion", text: "first"}, {z: "Team", text: "Team"}))),
Plot.ruleX([0, 1])
]
})
Insert cell
Insert cell
function new_l(QQ,name) {
var n1 ={"City": 0,"N": 0}
var l = [];
l[0] = {"City": name,"N": null}
for (var i = 1; i < QQ.length+1; i++) {
n1 ={"City": QQ[i-1]["Страна"]+"//"+QQ[i-1]["Город"],"N": QQ[i-1]["Численность население"]}
l[i]= n1;
}
return l;
}
Insert cell
viewof select_date1 = Inputs.select(new Set(data_faram_new1.map(d => d["Страна"])), {label: "Страна"})
Insert cell
new_data_faram = new_l(data_faram_new1.filter(y=> y.Страна==select_date1).slice(0,20),select_date1)
Insert cell
Sunburst(new_data_faram, {
path: (d) => d.City.replaceAll("//", "\/"),
label: (d) => d?.City.split("//").pop()+(d?.N!=null?"("+String(d.N)+")":""),
value: (d) => d?.N,
title: (d, n) => [n.id, n.value.toLocaleString()].join("\n"),
width,
height: 800
})
Insert cell
import {Sunburst} from "@d3/sunburst"
Insert cell
Pack(new_data_faram, {
path: (d) => d.City.replaceAll("//", "\/"),
label: (d) => d.City.split("//").pop()+(d.N!=null?"\n("+String(d.N)+")":"..."),
value: (d) => d?.N,
//title: (d, n) => [n.id, n.value.toLocaleString()].join("\n"),
width,
height: 700
})
Insert cell
import {Pack} from "@d3/pack"
Insert cell
League of Legends 2021 World Championship Play-In Groups Statistics - Raw Data@1.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

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