formatVolumeChange formats the volume change as a human-readable string
(total1, total2 int)
| 20 | |
| 21 | // formatVolumeChange formats the volume change as a human-readable string |
| 22 | func formatVolumeChange(total1, total2 int) string { |
| 23 | if total1 == 0 { |
| 24 | return "+∞" |
| 25 | } |
| 26 | pctChange := (float64(total2-total1) / float64(total1)) * 100 |
| 27 | if pctChange >= 0 { |
| 28 | return "+" + formatPercent(pctChange) |
| 29 | } |
| 30 | return formatPercent(pctChange) |
| 31 | } |
| 32 | |
| 33 | // formatPercentagePointChange formats the change between two ratio values (0.0-1.0) as a |
| 34 | // percentage-point delta (e.g. "+1.5pp", "-2.3pp") |