Skip to content

Commit ad24987

Browse files
committed
when exiting with maxdepth try to use parent if that is visible on the graph
1 parent 65f0213 commit ad24987

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/traces/treemap/plot.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ function plotOne(gd, cd, element, transitionOpts) {
108108
if(Object.keys(ref).length === 0 && // case of an empty object - happens when maxdepth is set
109109
!helpers.isHierarchyRoot(pt)
110110
) {
111-
x0 = x1 = (pt.x0 + pt.x1) / 2;
112-
y0 = y1 = (pt.y0 + pt.y1) / 2;
111+
var q = pt.parent || pt;
112+
x0 = x1 = (q.x0 + q.x1) / 2;
113+
y0 = y1 = (q.y0 + q.y1) / 2;
113114
} else {
114115
var e = trace.tiling.pad;
115116
var isLeftOfRect = function(x) { return x - e <= ref.x0; };

0 commit comments

Comments
 (0)