Improve number formatting and label tick algorithm