| 12345678910111213141516171819202122232425262728293031323334353637 |
- <html>
- <head>
- <title>Donut</title>
- <script type="text/javascript" src="../protovis-d3.1.js"></script>
- </head>
- <body>
- <script type="text/javascript+protovis">
- var data = pv.range(10).map(Math.random).sort(pv.reverseOrder),
- w = 400,
- h = 400,
- r = w / 2,
- t = 30,
- a = pv.Scale.linear(0, pv.sum(data)).range(0, 2 * Math.PI);
- var vis = new pv.Panel()
- .width(w)
- .height(h);
- vis.add(pv.Wedge)
- .data(data)
- .bottom(w / 2)
- .left(w / 2)
- .innerRadius(r - t)
- .outerRadius(r)
- .angle(a)
- .title(function(d) d)
- .anchor("outer").add(pv.Label)
- .visible(function(d) d > .05)
- .textMargin(t + 5)
- .text(function(d) d.toFixed(2));
- vis.render();
- </script>
- </body>
- </html>
|