This doesn't considers the size of the node's label. Ideally, we would calculate the size of the text (with node's label + its values), and check if it fits inside the rectangle. This makes it much more complicated, as we'll have to consider the text size in the font its being show into, which might be impossible as it's overridable using CSS.
The problem is that the logic for showing/hiding labels is pretty simple: if the node has more than 3% of the total, show the label.
This doesn't considers the size of the node's label. Ideally, we would calculate the size of the text (with node's label + its values), and check if it fits inside the rectangle. This makes it much more complicated, as we'll have to consider the text size in the font its being show into, which might be impossible as it's overridable using CSS.