Format legend value to billion, million or thousand