Method: Spoom::Coverage::D3::CircleMap.header_script

Defined in:
lib/spoom/coverage/d3/circle_map.rb

.header_scriptObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/spoom/coverage/d3/circle_map.rb', line 40

def header_script
  "    function treeHeight(root, height = 0) {\n      height += 1;\n      if (root.children && root.children.length > 0)\n        return Math.max(...root.children.map(child => treeHeight(child, height)));\n      else\n        return height;\n    }\n\n    function tooltipMap(d) {\n      moveTooltip(d)\n        .html(\"<b>\" + d.data.name + \"</b>\")\n    }\n  JS\nend\n"