Skip to content

Instantly share code, notes, and snippets.

@domoritz
Last active August 14, 2023 18:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domoritz/81008b55ae2e2649eb42f600440f87d2 to your computer and use it in GitHub Desktop.
Save domoritz/81008b55ae2e2649eb42f600440f87d2 to your computer and use it in GitHub Desktop.
Vega-Lite NPM Downloads
license: bsd-3-clause
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/vega@3"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@2"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@3"></script>
<style>
body {
font-family: sans-serif;
}
.vega-actions a {
padding: 0.2em;
}
</style>
</head>
<body>
<div id="vis"></div>
<script>
const spec = "vl.vl.json";
vegaEmbed('#vis', spec).catch(console.warn);
</script>
</body>
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {
"url": "https://npm-stat.com/downloads/range/2016-01-01:9999-01-01/vega-lite",
"format": {
"property": "downloads"
}
},
"title": "NPM Downloads for Vega-Lite per Month",
"width": 600,
"height": 260,
"mark": "bar",
"encoding": {
"x": {
"timeUnit": "utcyearmonth",
"field": "day",
"type": "ordinal",
"axis": {
"title": null,
"labelFlush": false
}
},
"y": {
"field": "downloads",
"type": "quantitative",
"axis": {
"title": "Monthly Downloads"
},
"aggregate": "sum"
},
"opacity": {
"condition": {
"test": "year(datum.utcyearmonth_day) == year(now()) && month(datum.utcyearmonth_day) == month(now())",
"value": 0.5
},
"value": 1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment