Game-Collisions
view release on metacpan or search on metacpan
nytprof/subs-treemap-excl.html view on Meta::CPAN
//the DOM Treemap nodes.
tm_args.onCreateElement = function(content, tree, isLeaf, leaf){
//Add background image for cushion effect
if(isLeaf) {
var style = leaf.style,
width = parseInt(style.width) - 2,
height = parseInt(style.height) - 2;
// don't add gradient if too small to be worth the cost
if (width < 10 || height < 10) { // is narrow
if (width < 50 && height < 50) // is small
return;
}
leaf.innerHTML = tree.name +
"<img src=\"js/jit/gradient-cushion1.png\" " +
" style=\"position:absolute;top:0;left:0;width:" +
width+"px;height:" + height+"px;\" />";
style.width = width + "px";
style.height = height + "px";
}
};
// add content to the tooltip when a node is hovered
// move to separate function later
tm_args.Tips.onShow = function(tip, node, isLeaf, domElement) {
tip.innerHTML = node.data.tip;
};
TM.Squarified.implement({
'onLeftClick': function(elem) { // zoom in one level
//if is leaf
var node = TreeUtil.getSubtree(this.tree, elem.parentNode.id);
if(node.children && node.children.length == 0) {
var oldparent = node, newparent = node;
while(newparent.id != this.shownTree.id) {
oldparent = newparent;
newparent = TreeUtil.getParent(this.tree, newparent.id);
}
this.view(oldparent.id);
} else {
this.enter(elem);
}
}
});
TM.Squarified.implement({
createBox: function(json, coord, html) {
if((coord.width * coord.height > 1) && json.data.$area > 0) {
if(!this.leaf(json))
var box = this.headBox(json, coord) + this.bodyBox(html, coord);
else
var box = this.leafBox(json, coord);
return this.contentBox(json, coord, box);
} else {
return ""; //return empty string
}
}
});
var tm1 = new TM.Squarified(tm_args);
var json = {"id":"n1","data":{"$area":3.0446489},"children":[{"id":"n2","data":{"$area":1.13e-05},"children":[{"id":"3-UNIVERSAL::VERSION","data":{"excl_time":1.13e-05,"incl_time":1.13e-05,"$color":0,"subname":"UNIVERSAL::VERSION","tip":"...
tm1.loadJSON(json);
}
</script>
<div class="vis_header"><br/>Boxes represent time spent in a subroutine. Coloring represents packages. Click to drill-down into package hierarchy, reload page to reset.</div>
<div id="infovis">
<br /><div id="infovis1"></div>
</div>
<script type="text/javascript">
$(document).ready(function() {
init_tm1();
} );
</script>
<div class="footer">Report produced by the
<a href="http://metacpan.org/release/Devel-NYTProf/">NYTProf 6.06</a>
Perl profiler, developed by
<a href="http://www.linkedin.com/in/timbunce">Tim Bunce</a> based on
work by Adam Kaplan and Salvador Fandiño GarcÃa.
</div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</body></html>
( run in 1.227 second using v1.01-cache-2.11-cpan-524268b4103 )