1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
<html>
<head>
<title>Test: Layout Partition</title>
<script type="text/javascript" src="protovis-r3.3.js"></script>
</head>
<body>
<h1>Test: Layout Partition</h1>
<script type="text/javascript">
color=pv.Colors.category19()
w=400
h=400
subtree={a:1,b:2,c:3,d:4}
hier_nodes=pv.dom({a:subtree,b:subtree, c:subtree, d:subtree,e:subtree,f:subtree}).root("test").nodes()
vis = new pv.Panel()
.width(w)
.height(h)
.top(20)
.bottom(10)
.left(10)
partition= vis.add(pv.Layout.Partition.Fill).
nodes(hier_nodes).orient("left").
size(function(d) {return d.nodeValue})
partition.node.add(pv.Bar).
fillStyle(function(d) {return color(d.nodeValue);}).
strokeStyle("black").
lineWidth(1).
antialias(false)
partition.label.add(pv.Label).
text(function(d) {return d.nodeName})
vis.render()
</script>
</body>
</html>
|