You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spot.apache.org by ev...@apache.org on 2017/05/05 22:34:46 UTC

[7/7] incubator-spot git commit: Now we validate if is necessary making a reduce of y or not, in case of empty nodes array

Now we validate if is necessary making a reduce of y or not, in case of empty nodes array


Project: http://git-wip-us.apache.org/repos/asf/incubator-spot/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-spot/commit/d6b0f286
Tree: http://git-wip-us.apache.org/repos/asf/incubator-spot/tree/d6b0f286
Diff: http://git-wip-us.apache.org/repos/asf/incubator-spot/diff/d6b0f286

Branch: refs/heads/master
Commit: d6b0f286db8906dc69e14fb7bb1d423c6a0363a9
Parents: e9c837c
Author: bryanmontesv <br...@gmail.com>
Authored: Thu Mar 16 09:59:40 2017 -0700
Committer: Everardo Lopez Sandoval (Intel) <el...@elopezsa-mac02.zpn.intel.com>
Committed: Fri May 5 17:34:27 2017 -0500

----------------------------------------------------------------------
 .../ui/js/components/DendrogramMixin.react.js   | 28 +++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-spot/blob/d6b0f286/spot-oa/ui/js/components/DendrogramMixin.react.js
----------------------------------------------------------------------
diff --git a/spot-oa/ui/js/components/DendrogramMixin.react.js b/spot-oa/ui/js/components/DendrogramMixin.react.js
index 702d2ed..8c20e89 100755
--- a/spot-oa/ui/js/components/DendrogramMixin.react.js
+++ b/spot-oa/ui/js/components/DendrogramMixin.react.js
@@ -64,19 +64,21 @@ var DendrogramMixin = {
                                         .style('fill', null);
                         });
 
-      const y1 = nodes.find(n => n.depth === 1).y;
-      const y2 = nodes.find(n => n.depth === 2).y;
-      const foreignObject_width = (y2 - y1) - 16; // 16 is the 1em given on the "x" (see below) but we need to take it from the last part of the line
-
-      // foreignObject is not supported by IE
-      nodeEl.append('foreignObject')
-                        .attr('x', n => n.depth === 0 ? '-8em' : '1em') //<--- this is the 1em
-                        .attr('y', -6)
-                        .append('xhtml:div')
-                          .html(n => n.name)
-                          .filter(n => n.depth === 1)
-                            .style('width','auto')
-                            .attr({'class': 'spot-text-wrapper', 'data-toggle': 'tooltip'});
+      if(Object.keys(nodes[0]).indexOf("children") > 0) { //lets check if is necessary making a reduce or not, in case of empty nodes array
+        const y1 = nodes.find(n => n.depth === 1).y;
+        const y2 = nodes.find(n => n.depth === 2).y;
+        const foreignObject_width = (y2 - y1) - 16; // 16 is the 1em given on the "x" (see below) but we need to take it from the last part of the line
+
+        // foreignObject is not supported by IE
+        nodeEl.append('foreignObject')
+                          .attr('x', n => n.depth === 0 ? '-8em' : '1em') //<--- this is the 1em
+                          .attr('y', -6)
+                          .append('xhtml:div')
+                            .html(n => n.name)
+                            .filter(n => n.depth === 1)
+                              .style('width','auto')
+                              .attr({'class': 'spot-text-wrapper', 'data-toggle': 'tooltip'});
+      }
 
       nodeSel.update.selectAll('foreignObject')
                         .style('width', n => n.depth === 1 ? foreignObject_width : 'auto');