File: layout_partition_fill.html

package info (click to toggle)
ruby-rubyvis 0.6.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,808 kB
  • ctags: 679
  • sloc: ruby: 11,114; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 868 bytes parent folder | download | duplicates (3)
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>