展示如何使用GitHub API

Code
viewof repo = Inputs.radio(
  [
    "pandas-dev/pandas",
    "tidyverse/ggplot2",
  ], 
  { label: "仓库:", value: "pandas-dev/pandas"}
)
Code
import { chart } with { commits as data } from "@d3/d3-bubble-chart"
chart

数据

d3 = require('d3')
contributors = await d3.json(
  "https://api.github.com/repos/" + repo + "/stats/contributors"
)
commits = contributors.map(contributor => {
  const author = contributor.author;
  return {
    name: author.login,
    title: author.login,
    group: author.type,
    value: contributor.total
  }
})
Inputs.table(commits, { sort: "value", reverse: true })