Published unlisted
Edited
Dec 31, 2020
Insert cell
Insert cell
Removed in fork
viewof selectedTeam = new View(null)
Insert cell
Changed in fork
-
toggle = viewof selectedTeam.bind(radio({
+
viewof selectedTeam = radio({
title: "Team", options: [ {label: 'T.B', value: 'T.B'}, {label: 'DAL', value: 'DAL'}], description: "Select the team", value: 'T.B',
-
}))
+
})
Insert cell
Player = {
let t = table(aqdatafiltered, {
columns: {
Player: {
formatter(value, i, row) {
let elem = html`<a style='cursor:pointer'>${value}</a>`;
elem.addEventListener('click', () => {
t.value = row;
t.dispatchEvent(new CustomEvent('input'));
});
return elem;
}
},
'xGF%': {
title: 'xGF%',
type: 'string',
formatter(val, i) {
return html`<div style='display:flex;align-items:center;height:1.5em;'>
<div style='width:${val}%;height:1em;background:#5f27cd;margin-right:0.5em;'></div>${i == 0 ? d3.format('.0%')(val / 100) : val}
</div>`;
}
},
'CF%': {
title: 'CF%',
type: 'string',
formatter(val, i) {
return html`<div style='display:flex;align-items:center;height:1.5em;'>
<div style='width:${val}%;height:1em;background:#5f27cd;margin-right:0.5em;'></div>${i == 0 ? d3.format('.0%')(val / 100) : val}
</div>`;
}
},
TOI: {
formatter(val, i) {
let color = d3.scaleLinear()
.domain([0, 15, 30])
.range(["#f4c8cf", "#f8f8f8", "#c8f4cb"]);
return html`<td style='background:${color(val)};text-align:right;padding:2px 5px;'>${val}</td>`;
}
}
}
});
return t;
}
Insert cell
aqData = aq
.fromCSV(await FileAttachment('EH_TB_at_DAL_2020_09_28_skater_stats_all_on_ice.csv').text())
.select('Player', 'Team','TOI', 'xGF%', 'CF%')
.objects()
Insert cell
import { aq, op } from '@uwdata/arquero'
Insert cell
d3 = require("d3@6")
Insert cell
import {table} from "@tmcw/tables@513"
Insert cell
import {radio} from "@jashkenas/inputs"
Insert cell
aqdatafiltered = aq
.fromCSV(await FileAttachment('EH_TB_at_DAL_2020_09_28_skater_stats_all_on_ice.csv').text())
.params({ selectedTeam })
.filter((d, $) => d.Team === $.selectedTeam)
.select('Player', 'Team','TOI', 'xGF%', 'CF%')
.objects()
Insert cell
Removed in fork
import { View } from '@mbostock/synchronized-views'
Insert cell