I am using the Zoomable Icicle layout example to view a folder hierarchy.
I currently use the filter function as follows:
var data = partition.nodes(root).filter(
function (d) {
return d.parent == null ? d.children && d.dateAccessed > formattedD : d.children && d.dateAccessed > formattedD && d.parent.dateAccessed > formattedD;
});
This filters out whether a folder (with all its sub-folders) needs to be shown / not shown depending on whether the folder's dateAccessed is after a certain date.
I then use the example code using this data variable to draw the partitions.
rect = rect
.data(data)
.enter().append("rect")
.attr("x", function (d) { console.log(!d.children); return x(d.x); })
.attr("y", function (d) { return y(d.y); })
.attr("width", function (d) { return x(d.dx); })
.attr("height", function (d) { return y(d.dy); })
.attr("fill", function (d) {
return (type == "Documents") ? '#9370DB' : (type == "Pictures") ? '#87CEFA' : (type == "Music") ? '#6B8E23' : (type == "Videos") ? '#F0E68C' : "#000000";
})
.on("click", clicked);
I need the layout to recalculate where the folders are placed, as currently it keeps the space for a filtered out folder (see the attached image). (Please excuse the dis-organisation of the folders in the image, that's how it was when it was read in.)
Many thanks.