This demo uses an adapter do dynamically apply positioning and style of the Force-directed tree labels based on whether they fit into parent node or not.
See the Pen
Force-Directed Tree with adaptively positioned labels by amCharts team (@amcharts)
on CodePen.0