mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
show dom elements in value explorer
This commit is contained in:
16
docs/examples/plot/index.js
Normal file
16
docs/examples/plot/index.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import _ from 'https://unpkg.com/lodash-es'
|
||||
|
||||
const url = 'https://api.github.com/search/repositories?q=stars:%3E1&sort=stars'
|
||||
const resp = await fetch(url)
|
||||
const repos = await resp.json()
|
||||
const langs = _(repos.items)
|
||||
.map(r => r.language)
|
||||
.filter(l => l != null)
|
||||
.countBy()
|
||||
.toPairs()
|
||||
.map(([language, count]) => ({language, count}))
|
||||
|
||||
import {barY} from "https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6/+esm";
|
||||
|
||||
barY(langs, {x: "language", y: "count", sort: {x: "y", reverse: true}, fill: 'purple'})
|
||||
.plot()
|
||||
Reference in New Issue
Block a user