Additional question to the answer found here: Truncate text in d3
.text(function (d) {
if(d.name.length > 5)
return d.name.substring(0,5)+'...';
else
return d.name;
});
I'd like to add a condition where if the text is a label in the outermost ring of a bilevel partition chart, the text is no longer truncated.
Possible solution would be to add something like: if outermost ring is clicked, redraw the text.
Edit: Sorry I forgot to mention that this condition should only happen if the outermost ring is clicked. So initially the text is truncated, and when the outermost ring is zoomed in, the truncation is removed.
inside function click(d):
if d.depth >= 3 {
modify firstLine, remove code that shortens the text
}
else if other d.depth is clicked {
keep/revert back to the same code
}