Skip to content

Commit 8197431

Browse files
fix(maxdepth): icicles fill up their domain if using maxdepth
1 parent 8065e46 commit 8197431

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/traces/icicle/draw_descendants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ module.exports = function drawDescendants(gd, cd, entry, slices, opts) {
4545
orientation: trace.tiling.orientation,
4646
pad: {
4747
inner: trace.tiling.pad
48-
}
48+
},
49+
maxDepth: trace._maxDepth
4950
});
5051

5152
var sliceData = allData.descendants();

src/traces/icicle/partition.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ module.exports = function partition(entry, size, opts) {
66
var flipX = opts.flipX;
77
var flipY = opts.flipY;
88
var swapXY = opts.orientation === 'h';
9+
var maxDepth = opts.maxDepth;
10+
11+
// calculate partion size
12+
var newWidth = (entry.height + 1) * size[0] / Math.min(entry.height, maxDepth);
913

1014
var result = d3Hierarchy
1115
.partition()
1216
.padding(opts.pad.inner)
1317
.size(
14-
swapXY ? [size[1], size[0]] : size
18+
swapXY ? [size[1], newWidth] : size
1519
)(entry);
1620

1721
if(swapXY || flipX || flipY) {

0 commit comments

Comments
 (0)