optimized d3 bars text positioning function