Skip to content

Commit 7d67c7a

Browse files
committed
try to make parent getter more consistent by using pt.data.data.pid instead of pt.data.parent
1 parent c918da9 commit 7d67c7a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/traces/sunburst/helpers.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ exports.getVal = function(d) {
6060
};
6161

6262
exports.isHierarchyRoot = function(pt) {
63-
return pt.data.data.pid === '';
63+
return getParentId(pt) === '';
6464
};
6565

6666
exports.setSliceCursor = function(sliceTop, gd, opts) {
@@ -148,13 +148,12 @@ exports.isHeader = function(pt, trace) { // it is only used in treemap.
148148
};
149149

150150
function getParentId(pt) {
151-
var parent = pt.data.parent;
152-
return parent ? parent.data.id : undefined;
151+
return pt.data.data.pid;
153152
}
154153

155154
exports.getParent = function(hierarchy, pt) {
156155
var parentId = getParentId(pt);
157-
return parentId === undefined ?
156+
return parentId === '' ?
158157
undefined :
159158
exports.findEntryWithLevel(hierarchy, parentId);
160159
};

0 commit comments

Comments
 (0)