Skip to content

Instantly share code, notes, and snippets.

@NPashaP
Last active December 15, 2016 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NPashaP/8369d57de7d3e9cb527ccae4b920d53b to your computer and use it in GitHub Desktop.
Save NPashaP/8369d57de7d3e9cb527ccae4b920d53b to your computer and use it in GitHub Desktop.
bar - dock
license: gpl-3.0
<!DOCTYPE html>
<meta charset="utf-8">
<style>
rect{
fill:#42A5F5;
}
</style>
<body>
<svg width="960" height="600">
<g id="left" transform="translate(115, 25)"></g>
<g id="right" transform="translate(595, 25)"></g>
<g id="top" transform="translate(115, 325)"></g>
<g id="bottom" transform="translate(595, 325)"></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]];
var bar = viz.bar().data(data).width(250).height(250);
//dock left
d3.select("#left").call(bar.dock('l'));
//dock right
d3.select("#right").call(bar.dock('r'));
//dock top
d3.select("#top").call(bar.dock('t'));
//dock bottom
d3.select("#bottom").call(bar.dock('b'));
// adjust the bl.ocks frame dimension.
d3.select(self.frameElement).style("height","600px").style("width","960px");
</script>
@Skysthelimit47
Copy link

Ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment