Commit a12c2ca7 authored by Jürgen Enge's avatar Jürgen Enge
Browse files

result of histogram changed

parent 8a87cb6e
Pipeline #10531 passed with stages
in 16 minutes and 17 seconds
......@@ -112,16 +112,41 @@ func (h *Histogram) Exec(file string, args ...interface{}) (interface{}, error)
if err != nil {
return colors, emperror.Wrapf(err, "cannot parse number %s in line %s", countstr, line)
}
colors[col] += float64(count)/float64(10000)
colors[col] += float64(count) / float64(10000)
}
result := make(map[string]float64)
/*
result := make(map[string]float64)
for col, weight := range colors {
ok := false
for name, hex := range h.colormap {
if col == hex {
ok = true
result[name] = weight
}
}
if !ok {
return nil, fmt.Errorf("color %s not in colormap", col)
}
}
*/
type rf struct {
Name string `json:"name"`
Code string `json:"code"`
Weight float64 `json:"weight"`
}
var result []rf
for col, weight := range colors {
ok := false
for name, hex := range h.colormap {
if col == hex {
ok = true
result[name] = weight
result = append(result, rf{
Name: name,
Code: hex,
Weight: weight,
})
}
}
if !ok {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment