vegam.js
Reusable charts with Vega
Install using:
yarn install vegam
# .. OR ..
yarn install --save vegam
Also install vega vega-lite vega-tooltip
And include following libraries in your .html page
<link rel='stylesheet' type='text/css' href='node_modules/vega-tooltip/build/vega-tooltip.min.css'>
<script src='node_modules/vega/build/vega.min.js'></script>
<script src='node_modules/vega-lite/build/vega-lite.min.js'></script>
<script src='node_modules/vega-tooltip/build/vega-tooltip.min.js'></script>
<script src="node_modules/vegam/dist/vegam.min.js"></script>
Usage
Example:
<div class="viz"></div>
<script src='node_modules/vega/build/vega.min.js'></script>
<script src='node_modules/vega-lite/build/vega-lite.min.js'></script>
<script src="node_modules/vegam/dist/vegam.min.js"></script>
<script>
var vgm = vegam.vegam(data).line({x: 'a', y: 'b'})
var vspec = vl.compile(vgm.spec).spec
new vega.View(vega.parse(vspec))
.renderer('svg')
.initialize('.viz')
.hover()
.run()
</script>
Publish
To publish a new version on npm:
# Run tests on dev branch
git checkout dev
npm test
# Update package.json version
# Ensure that there are no build errors on the server
git commit . -m"DOC: Release version x.x.x"
git push
# Merge into dev branch
git checkout master
git merge dev
git tag -a v0.x.x -m"Add a one-line summary"
git push --follow-tags
# Publish to https://www.npmjs.com/package/vegam
# Maintained currently by @pratapvardhan
npm publish
git checkout dev