changeset 6:d8b262428a1c

Added display of # of files changed in past year to svg visualization.
author Atul Varma <varmaa@toolness.com>
date Sat, 12 Dec 2009 23:20:52 -0800
parents 60db727ab65d
children 4c4fbd8e4da2
files moztree.css moztree.js
diffstat 2 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/moztree.css	Sat Dec 12 22:46:38 2009 -0800
+++ b/moztree.css	Sat Dec 12 23:20:52 2009 -0800
@@ -12,6 +12,11 @@
     fill: black;
 }
 
+tspan.changes {
+    text-anchor: end;
+    fill: gray;
+}
+
 rect {
     stroke: gray;
     stroke-width: 1;
--- a/moztree.js	Sat Dec 12 22:46:38 2009 -0800
+++ b/moztree.js	Sat Dec 12 23:20:52 2009 -0800
@@ -17,6 +17,8 @@
   if (options) {
     if (options.content)
       element.textContent = options.content;
+    if (options.className)
+      element.setAttribute("class", options.className);
   }
   return element;
 }
@@ -39,10 +41,19 @@
                                           y: y,
                                           width: options.width,
                                           height: height}));
-      svg.appendChild(SVGElement("text",
-                                 {x: options.x + options.textPadding,
-                                  y: y + height - options.textPadding},
-                                 {content: subdir.name}));
+
+      var text = SVGElement("text",
+                            {x: options.x + options.textPadding,
+                             y: y + height - options.textPadding});
+      text.appendChild(SVGElement("tspan", {},
+                                  {content: subdir.name}));
+      text.appendChild(SVGElement("tspan",
+                                  {x: (options.x + options.width -
+                                       options.textPadding)},
+                                  {content: subdir.changes,
+                                   className: "changes"}));
+      svg.appendChild(text);
+
       drawDir(svg, subdir, depth - 1, {x: options.x + options.width,
                                        y: y,
                                        width: options.width,
@@ -86,7 +97,7 @@
     getJSON('moztree.json',
             function(tree) {
               var svg = makeTree(tree, {height: 2800,
-                                        dirWidth: 100,
+                                        dirWidth: 120,
                                         dirDepth: 6,
                                         landscape: false,
                                         textPadding: 4,