Scale integer counts on the panel like every other figure
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -105,6 +106,16 @@ func scaleSI(v float64) string {
|
||||
return fmt.Sprintf("%.2f P", v)
|
||||
}
|
||||
|
||||
// The integer counterpart, for whole things counted rather than a rate
|
||||
// measured. Below a thousand the figure is the count itself, since two decimals
|
||||
// on a quantity that cannot have them read as precision that is not there.
|
||||
func scaleCount(v uint64) string {
|
||||
if v < 1000 {
|
||||
return strconv.FormatUint(v, 10)
|
||||
}
|
||||
return scaleSI(float64(v))
|
||||
}
|
||||
|
||||
// The same shape for time, whose magnitudes are sixties and twenty-fours.
|
||||
func scaleTime(d time.Duration) string {
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user