diff --git a/docs/src/examples/components/Image/college-football-upsets.svelte b/docs/src/examples/components/Image/college-football-upsets.svelte new file mode 100644 index 000000000..5fc6ae6c5 --- /dev/null +++ b/docs/src/examples/components/Image/college-football-upsets.svelte @@ -0,0 +1,242 @@ + + + + + { + if (e.key === 'Shift') hideTooltip = true; + }} + onkeyup={(e) => { + if (e.key === 'Shift') hideTooltip = false; + }} + onblur={() => (hideTooltip = false)} +/> + + + data.season, + (v) => { + if (v !== data.season) season = v; + } + } + clearable={false} + toggleIcon={null} + stepper + /> + + {#each Object.values(styles) as style (style.label)} + + + {style.label} + + {/each} + {upsetCount} upsets + + + + + {#snippet children({ context })} + {@const highlightId = context.tooltip.data?.game.id} + + + + `#${d}`} /> + + {#each cells as cell (cell.game.id + cell.team.id)} + {@const x = context.xScale(cell.week) ?? 0} + {@const y = context.yScale(cell.rank)} + {@const style = cellStyle(cell)} + + + + + + {/each} + + + {#if !hideTooltip} + + {#snippet children({ data: cell })} + {@const result = cell.team.result} + + + + {cell.team.name} (#{cell.rank}) + + + + + {#if result} + + {result} + + {cell.team.score}-{cell.opponent.score} + {:else} + {cell.game.status} + {/if} + vs + + {cell.opponent.abbreviation} + {cell.opponent.rank ? `(#${cell.opponent.rank})` : ''} + + {#if cell.upset} + + Upset + + {/if} + + + Hold Shift to hide tooltip + + {/snippet} + + {/if} + {/snippet} + diff --git a/docs/src/examples/components/LineChart/bump-sports-rankings.svelte b/docs/src/examples/components/LineChart/bump-sports-rankings.svelte new file mode 100644 index 000000000..0ff034dd4 --- /dev/null +++ b/docs/src/examples/components/LineChart/bump-sports-rankings.svelte @@ -0,0 +1,308 @@ + + + + + { + if (e.key === 'Shift') hideTooltip = true; + }} + onkeyup={(e) => { + if (e.key === 'Shift') hideTooltip = false; + }} + onblur={() => (hideTooltip = false)} +/> + + + sport, + (v) => { + sport = v; + season = undefined; + } + } + clearable={false} + toggleIcon={null} + stepper + /> + data.season, + (v) => { + if (v !== data.season) season = v; + } + } + clearable={false} + toggleIcon={null} + stepper + /> + + +AP Top 25 + + + {#snippet children({ context })} + {@const highlightId = context.tooltip.data?.teamId} + + + + + + + `#${d}`} /> + finalAbbreviations.get(d) ?? ''} + /> + + {#each teamsInDrawOrder(highlightId) as team (team.id)} + {@const segments = teamSegments(team.id)} + {@const ranks = segments.flat()} + + {#each segments as segment, i (i)} + + {/each} + + + + {/each} + + + {#if !hideTooltip} + + {#snippet children({ data: d })} + {@const team = teamsById.get(d.teamId)} + {@const gameWindow = pollWindow(d.week)} + {@const games = gameWindow + ? getTeamGames({ sport, season: data.season, teamId: d.teamId }) + : undefined} + + + + {team?.name} + + + + + + {#if d.record} + + {/if} + + {#if gameWindow && games && !games.error} + + {#if games.current == null} + + {:else} + {#each gamesInWindow(games.current, gameWindow) as game (game.id)} + + {#if game.result} + + {game.result} + + {game.score}-{game.opponentScore} + {:else} + {game.status} + {/if} + {game.home || game.neutralSite ? 'vs' : '@'} + + {opponentLabel(game)} + + {:else} + + {/each} + {/if} + {/if} + + + Hold Shift to hide tooltip + + {/snippet} + + {/if} + {/snippet} + diff --git a/docs/src/examples/components/LineChart/bump-state-population-ranks.svelte b/docs/src/examples/components/LineChart/bump-state-population-ranks.svelte index 1b939639d..2ce292136 100644 --- a/docs/src/examples/components/LineChart/bump-state-population-ranks.svelte +++ b/docs/src/examples/components/LineChart/bump-state-population-ranks.svelte @@ -1,3 +1,7 @@ + +