I need to rotate this Icicle to a vertical(up-down) way: https://observablehq.com/@d3/zoomable-icicle. The first screen option works but when I clicked the item, it fails. The following changes worked:
.attr("transform", d => "translate(" + d.x0 + "," + d.y0 + ")");
.attr("width", d => d.x1 - d.x0 - 1)
.attr("height", d => rectHeight(d))
function rectHeight(d) {
return d.y1 - d.y0 - Math.min(1, (d.y1 - d.y0) / 2);
}
I'm having trouble for rotating the zoom or clicked function:
function clicked(p) { focus = focus === p ? p = p.parent : p;
root.each(d => d.target = {
x0: (d.x0 - p.x0) / (p.x1 - p.x0) * height,
x1: (d.x1 - p.x0) / (p.x1 - p.x0) * height,
y0: d.y0 - p.y0,
y1: d.y1 - p.y0
});
const t = cell.transition().duration(750)
.attr("transform", d => "translate(" + d.target.x0 + "," + d.target.y0 + ")");
rect.transition(t).attr("height", d => rectHeight(d.target));
text.transition(t).attr("fill-opacity", d => +labelVisible(d.target));
tspan.transition(t).attr("fill-opacity", d => labelVisible(d.target) * 0.7);
}
I have tried inverting x and y. I changed the function to:
function clicked(p) { focus = focus === p ? p = p.parent : p;
root.each(d => d.target = {
y1: (d.y0 - p.y0) / (p.y1 - p.y0) * width,
y0: (d.y1 - p.y0) / (p.y1 - p.y0) * width,
x1: d.x0 - p.x0,
x0: d.x1 - p.x0
});
const t = cell.transition().duration(750)
.attr("transform", d => "translate(" + d.target.x0 + "," + d.target.y0 + ")");
rect.transition(t).attr("height", d => rectHeight(d.target));
text.transition(t).attr("fill-opacity", d => +labelVisible(d.target));
tspan.transition(t).attr("fill-opacity", d => labelVisible(d.target) * 0.7);
}
It stills not working, I don't know what else to do.
Here's a fork of that Observable notebook that shows how to do this.