Public
Edited
Dec 11, 2023
Fork of 4 lab
Insert cell
Insert cell
competition = FileAttachment("competition.xlsx").xlsx()
Insert cell
comp1 = competition.sheet(0, {headers: true})
Insert cell
viewof table1 = Inputs.table(comp1)
Insert cell
Insert cell
comp = comp1.map(
function (d) {
return {N: Number(d['#']),
pol: d['Пол'],
age: d['Год рождения'],
jump: Number(d['Прыжок в длину с места, см ']),
count: Number(1)}
})
Insert cell
Plot.plot({
color: {legend: true},
grid : true,
y:{ label: 'Количество ↑' },
x:{ label: 'Год рождения' },
marks: [
Plot.barY(comp.filter(x => x.pol == 'ж'), {x: "age", y: "count", fill:"pol"}),
Plot.barY(comp.filter(x => x.pol == 'м'), {x: "age", y: "count", fill:"pol"}),
Plot.ruleY([0]),
]
})
Insert cell
Insert cell
average = comp1.map( (x)=> Number(x['Бег 1000 метров, мин. и сек.'])).reduce((a, b) => (a + b)) / 1000
Insert cell
comp2 = comp1.filter(x => x['Бег 1000 метров, мин. и сек.'] > average).map(
function (d) {
return {N: Number(d['#']),
pol: d['Пол'],
age: d['Год рождения'],
jump: Number(d['Бег 1000 метров, мин. и сек.']),
count: Number(1)}
})
Insert cell
Insert cell
Plot.plot({
width : 900,
height : 300,
grid : true,
color: {legend: true},
margintop: 30,
y:{ label: 'Количество ↑' },
x:{ label: 'Пол' },
facet: {
data: comp2,
x: 'age',
label: 'Год рождения'
},
marks: [
Plot.barY(comp2, Plot.groupX({y: "count"}, {x: "pol", y: "run",fill: "pol" })),
]
})
Insert cell
Insert cell
Plot.plot({
y : {
grid : true,
},
facet: {
data: comp1,
y : "Пол",
},
marks: [
Plot.barY(comp1, Plot.groupX({y : "max"}, {x : "Год рождения", y : "Бег 1000 метров, мин. и сек.", fill : "Пол"})),
Plot.ruleY([0])
]
})
Insert cell
import {Sunburst} from "@d3/sunburst"
Insert cell
import {Pack} from "@d3/pack"
Insert cell
unitiyanddiscordfilesize.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Sunburst(disk, {
path: (d) => d.dir_file.replaceAll("\\", "\/"),
// label: (d, n) => String(n.id).split("\/").pop(),
label: (d) => d?.dir_file.split("\\").pop(),
//value: (d) => d?.size,
title: (d) => (d?.size!=null?"Size: "+String(d.size)+" КБ":""),
width,
height: 720
})
Insert cell
Pack(disk, {
path: (d) => d.dir_file.replaceAll("\\", "\/"),
// label: (d, n) => String(n.id).split("\/").pop(),
label: (d) => d?.dir_file.split("\\").pop(),
//value: (d) => d?.size,
title: (d) => d?.dir_file.split("\\").pop() +"\n"+ (d?.size!=null?"Size: "+String(d.size)+" КБ":""),
width,
height: 720
})
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