# HG changeset patch # User Atul Varma # Date 1260708218 28800 # Node ID 279bee72681749fb0528b5f742380c5d71774165 # Parent dc89fb1726b442d2e3a0755a1d35365ecf9b37bd dir sizes are now shown relative to the # of changesets that involve them, rather than their size in bytes. diff -r dc89fb1726b4 -r 279bee726817 moztree.js --- a/moztree.js Sun Dec 13 00:42:21 2009 -0800 +++ b/moztree.js Sun Dec 13 04:43:38 2009 -0800 @@ -27,10 +27,27 @@ if (depth == 0 || !dir.subdirs) return; + dir.subdirs.sort( + function(a, b) { + return b[options.key] - a[options.key]; + }); + + var total = 0; + dir.subdirs.forEach( + function(subdir) { + total += subdir[options.key]; + }); + + if (total < dir[options.key]) + total = dir[options.key]; + + if (total == 0) + return; + var currY = options.y + options.height; dir.subdirs.forEach( function(subdir) { - var heightScale = subdir.size / dir.size; + var heightScale = subdir[options.key] / total; var height = options.height * heightScale; var y = currY - height; @@ -56,6 +73,7 @@ drawDir(svg, subdir, depth - 1, {x: options.x + options.width, y: y, + key: options.key, width: options.width, height: height, minHeight: options.minHeight, @@ -85,6 +103,7 @@ drawDir(group, tree, options.dirDepth, {x: 0, y: 0, + key: options.key, width: options.dirWidth, height: options.height, textPadding: options.textPadding, @@ -121,6 +140,7 @@ var svg = makeTree(dir, {height: 2800, + key: 'changes', dirWidth: 120, dirDepth: 6, landscape: false,