Dynamically calculate the width of the progress bar