fix some chord graph issues
authorScott Baker <smbaker@gmail.com>
Wed, 28 May 2014 03:30:37 +0000 (20:30 -0700)
committerScott Baker <smbaker@gmail.com>
Wed, 28 May 2014 03:30:37 +0000 (20:30 -0700)
planetstack/templates/admin/dashboard/slice_interactions.html

index 6fafc5c..3ddaa1f 100644 (file)
@@ -305,6 +305,16 @@ function updateChords( users, matrix, objectName ) {
         //.transition().duration(100).attr("opacity", 1) //reset opacity
     ;
 
+    // XXX SMBAKER: The way the text was added with newGroups, it's only
+    //   computed when a node is created. This is a problem if we redraw the
+    //   graph with a different set of nodes, because the old labels will
+    //   stick. So, I added this, which *seems* to cause the labels to be
+    //   recomputed.
+    groupG.selectAll("text")
+        .text(function (d) {
+            return users[d.index].name;
+        });
+
     //add the mouseover/fade out behaviour to the groups
     //this is reset on every update, so it will use the latest
     //chordPaths selection
@@ -326,6 +336,12 @@ function updateChords( users, matrix, objectName ) {
     });
     */
 
+    // XXX smbaker: there's a bug where if you hilight a slice of the chord
+    //   graph, and then update the data, the freshly drawn graph is missing
+    //   some of the chords. Flipping the fade bit seems to fix that.
+    chordPaths.classed("fade", true);
+    chordPaths.classed("fade", false);
+
     last_layout = layout; //save for next update
     
 //  }); //end of d3.json