Skip to content

Instantly share code, notes, and snippets.

@domoritz
Last active January 8, 2020 16:16
Show Gist options
  • Save domoritz/bef687de0e2dba1f522f674c260ac17f to your computer and use it in GitHub Desktop.
Save domoritz/bef687de0e2dba1f522f674c260ac17f to your computer and use it in GitHub Desktop.
Cumulative Wikipedia Donations
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 = "spec.vl.json";
vegaEmbed('#vis', spec).catch(console.warn);
</script>
</body>
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"data": {"url": "https://frdata.wikimedia.org/donationdata-vs-day.csv"},
"width": 600,
"height": 300,
"mark": "line",
"encoding": {
"x": {
"field": "date",
"type": "temporal",
"timeUnit": "utcmonthdate",
"axis": {"format": "%B", "title": "Month"}
},
"y": {
"field": "ytdsum",
"type": "quantitative",
"aggregate": "max",
"stack": null,
"axis": {"title": "Donations Till the Beginning of the Year"}
},
"color": {
"field": "date",
"type": "ordinal",
"timeUnit": "utcyear",
"legend": {"title": "Year"}
},
"order": {"field": "date", "type": "ordinal", "timeUnit": "year"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment