Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
37 lines (29 sloc) 781 Bytes
<html>
<head>
<title>Diamond Tree</title>
<script type="text/javascript" src="../../protovis.js"></script>
<script type="text/javascript" src="../diamond.js"></script>
</head>
<body>
<script type="text/javascript+protovis">
var root = pv.dom(diamond(3, 4, 5)).root();
var vis = new pv.Panel()
.width(400)
.height(400)
.top(20);
var layout = vis.add(pv.Layout.Tree)
.nodes(function() root.nodes())
.depth(30)
.breadth(25)
.orient("top");
layout.link.add(pv.Line)
.strokeStyle("#aaa");
layout.node.add(pv.Dot)
.size(100)
.strokeStyle("#aaa")
.fillStyle(function(d) d.toggled ? "#aaa" : "#ddd")
.event("click", function(d) (d.toggle(), layout.reset().parent));
vis.render();
</script>
</body>
</html>