Last active
December 15, 2016 20:22
-
-
Save NPashaP/b44f6a3d4ce21e1d424009b1ace6edcc to your computer and use it in GitHub Desktop.
bar - width, height
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: gpl-3.0 |
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> | |
<meta charset="utf-8"> | |
<style> | |
rect{ | |
fill:#42A5F5; | |
} | |
</style> | |
<body> | |
<svg width="960" height="500"> | |
<g id="default" transform="translate(40, 50)"></g> | |
<g id="custom" transform="translate(570, 100)"></g> | |
</svg> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script src="http://vizjs.org/viz.v1.1.7.min.js"></script> | |
<script> | |
var data=[['A', 1],['A', 3],['B', 3],['C', 5],['D', 8]]; | |
//default | |
d3.select("#default").call(viz.bar().data(data)); | |
//custom | |
d3.select("#custom").call(viz.bar().data(data).width(300).height(300)); | |
// adjust the bl.ocks frame dimension. | |
d3.select(self.frameElement).style("height", "500px").style("width", "960px"); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment