Public
Edited
Dec 14, 2023
7 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof selectedPositions = Inputs.checkbox(positions, {label: "Position", value: positions})
Insert cell
Insert cell
function playerImage(name) {
var data = nba_stats.filter(d => d.name === name);
var player_image = data[0].player_image
var pos = data[0].pos
var team_abbr = data[0].team_abbr
var team_logo = data[0].team_logo
return htl.html`<div class="player">
<div class="player-img-container">
<img src=${player_image} class="player-image" />
</div>
<div class="player-main">
<div class="player-main-name">${name}</div>
<div class="player-main-details">${pos} • ${team_abbr} </div>
</div>
<div class="player-team">
<img src=${team_logo} class="team-img" />
</div>
</div>`
}
Insert cell
nbaTable = () => { return Inputs.table(searchData, { height:470,
columns: ["name", "team_abbr","pos","g","fg","fga","fg_percent","pts"],
header: {
name: "PLAYER",
team_abbr: "TEAM",
pos: "POS",
g: "GP",
fg: "FGM",
fga: "FGA",
fg_percent: "FG %",
pts: "PTS"
},
align: {
pos:"center",
team_abbr: "center"
},
width: {
name: 230
},
format: {
name: x => playerImage(x)
}
})}
Insert cell
Insert cell
base_url = "https://a.espncdn.com/combiner/i?img=/i/teamlogos/nba/500/"
Insert cell
positions = [...new Set(nba_stats.map(d => d.pos))].sort()
Insert cell
teams = [{value: 'ATL', label:'Atlanta Hawks'},
{value: 'DEN', label:'Denver Nuggets'},
{value: 'BOS', label: 'Boston Celtics'},
{value: 'LAC', label: 'LA Clippers'},
{value: 'GSW', label: 'GS Warriors'},
{value: 'LAL', label: 'LA Lakers'},
{value: 'PHO', label: 'Phoenix Suns'},
{value: 'OKC', label: 'OKC Thunder'},
{value:'DAL', label: 'Dallas Mavericks'}]
Insert cell
Insert cell
teamFormat = teams.map(d => ({ value: d.value, label: "<img style='height:30px;padding-right:5px;vertical-align:middle;'src="+base_url+d.value+".png><span style='vertical-align:middle;'>"+d.label+"</span>"}))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {input} from "@jashkenas/inputs"
Insert cell
Insert cell
nba_full_stats.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

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