implemented the text label correctly in the center of the bar.