Class: Treemap21

Inherits:
Object
  • Object
show all
Defined in:
lib/treemap21.rb

Instance Method Summary collapse

Constructor Details

#initialize(a, orientation: :landscape, debug: false) ⇒ Treemap21

Returns a new instance of Treemap21.



11
12
13
14
15
# File 'lib/treemap21.rb', line 11

def initialize(a, orientation: :landscape, debug: false)

  @a, @orientation, @debug = a, orientation, debug

end

Instance Method Details

#to_htmlObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/treemap21.rb', line 17

def to_html()

  doc3 = Rexle.new("<div class='cbox'/>")
  doc = mapper(doc3, @a, orientation: @orientation)
  boxes = doc.root.xml pretty: true

<<EOF
<html>
<head>
<style>

  .cbox, .long, .cbox1, .cbox1 a {
      width: 100%;
      height: 100%;
  }
  .cbox1 ~.long, .cbox1 {
      float: left;
  }
  .cbox1, .cbox1 a {
      display: flex;
      justify-content: center;
      align-items: center;
  }

  .cbox1 a { text-decoration: none; color: #010; font-family: helvetica, arial}
  .cbox1 a:hover { background-color: rgba(255,255,255,0.2); color: #902}

  .cbox1 span {  background-color: transparent;  }

  .c10 {font-size: 8em}
  .c9 {font-size: 7.5em}
  .c8 {font-size: 6em}
  .c7 {font-size: 5.0em}
  .c6 {font-size: 4.9em}
  .c5 {font-size: 4.5em}
  .c4 {font-size: 3.6em}
  .c3 {font-size: 2.6em}
  .c2 {font-size: 2.4em}
  .c1 {font-size: 1.6em}
  .c0 {font-size: 1.1em}

</style>
</head>
<body>


#{boxes}

</body>
</html>
EOF
end