Last active
October 6, 2015 03:37
-
-
Save amitkaps/3bc8cab8990d983e99bd to your computer and use it in GitHub Desktop.
This file contains hidden or 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> | |
<script src="../lib/d3.min.js"></script> | |
<script src="../lib/vega1.5.js"></script> | |
<script src="../lib/vega-lite.js"></script> | |
<div id="chart"></div> | |
<script type="text/javascript"> | |
function parse(spec) { | |
vg.parse.spec(spec, function(chart) { | |
chart({el:"#chart"}).update(); }); | |
} | |
var vlspec = { | |
"data":{ | |
"values": [ | |
{"areas": "A", "value": 5}, | |
{"areas": "B", "value": 25}, | |
{"areas": "C", "value": 15}, | |
{"areas": "D", "value": 20}, | |
{"areas": "E", "value": 10} | |
] | |
}, | |
"marktype": "bar", | |
"encoding": { | |
"x": {"type": "Q","name": "value"}, | |
"y": {"type": "O","name": "areas"} | |
}, | |
} | |
var vgspec = vl.compile(vlspec); | |
parse(vgspec); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment