You can go to the blockbuilder and to fork this block and create your own visualizations. Check out the Vega-Lite website for more information, tutorials, and documentation. Happy hacking!
-
-
Save kanitw/a5d94c58af359c73068aa94f9220b668 to your computer and use it in GitHub Desktop.
Vega-Lite Bl.ocks example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: bsd-3-clause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$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": "Vega-Lite's NPM Downloads per Month", | |
"width": 280, | |
"height": 200, | |
"layer": [{ | |
"mark": { | |
"type": "line", | |
"interpolate": "monotone" | |
}, | |
"encoding": { | |
"x": { | |
"timeUnit": "utcyearmonth", | |
"field": "day", | |
"type": "temporal", | |
"axis": { | |
"title": null, | |
"labelFlush": false | |
} | |
}, | |
"y": { | |
"field": "downloads", | |
"type": "quantitative", | |
"axis": { | |
"title": null | |
}, | |
"aggregate": "sum" | |
} | |
} | |
}, { | |
"mark": "circle", | |
"encoding": { | |
"x": { | |
"timeUnit": "utcyearmonth", | |
"field": "day", | |
"type": "temporal" | |
}, | |
"y": { | |
"field": "downloads", | |
"type": "quantitative", | |
"aggregate": "sum" | |
} | |
} | |
}, { | |
"transform": [ | |
{ | |
"timeUnit": "utcyearmonth", | |
"field": "day", | |
"as": "yearmonth" | |
},{ | |
"aggregate": [{ | |
"op": "sum", | |
"field": "downloads", | |
"as": "downloads" | |
}], | |
"groupby": ["yearmonth"] | |
},{ | |
"aggregate": [{ | |
"op": "max", | |
"field": "yearmonth", | |
"as": "last_day" | |
}, { | |
"op": "max", | |
"field": "downloads", | |
"as": "downloads" | |
}], | |
"groupby": [] | |
} | |
], | |
"mark": { | |
"type":"text", | |
"dx": 10, | |
"align": "left", | |
"baseline": "left" | |
}, | |
"encoding": { | |
"x": {"field": "last_day", "type": "temporal"}, | |
"y": {"field": "downloads", "type": "quantitative"}, | |
"text": {"field": "downloads", "type": "quantitative"} | |
} | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment