in pkg/heatmap/heatmap.go [96:125]
func (hp *HeatMap) SetColumns(values map[string][]int64) {
hp.mu.Lock()
defer hp.mu.Unlock()
var minMaxValues []int64
// The iteration order of map is uncertain, so the keys must be sorted explicitly.
var names []string
for name := range values {
names = append(names, name)
}
sort.Strings(names)
// Clear XLabels and columns.
if len(hp.XLabels) > 0 {
hp.XLabels = hp.XLabels[:0]
}
hp.columns = make(map[string]*columnValues)
for _, name := range names {
cv := newColumnValues(values[name])
hp.columns[name] = cv
hp.XLabels = append(hp.XLabels, name)
minMaxValues = append(minMaxValues, cv.Min)
minMaxValues = append(minMaxValues, cv.Max)
}
hp.MinValue, hp.MaxValue = minMax(minMaxValues)
}