in walkthroughs/howto-ecs-basics/src/feapp/main.go [92:110]
func getRatios() map[string]float64 {
counts := make(map[string]int)
var total = 0
for _, c := range colors {
if c != "" {
counts[c]++
total++
}
}
ratios := make(map[string]float64)
for k, v := range counts {
ratio := float64(v) / float64(total)
ratios[k] = math.Round(ratio*100) / 100
}
return ratios
}