Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
IndexerHelper
Commits
a12c2ca7
Commit
a12c2ca7
authored
Jun 24, 2020
by
Jürgen Enge
Browse files
result of histogram changed
parent
8a87cb6e
Pipeline
#10531
passed with stages
in 16 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
pkg/histogram/service.go
View file @
a12c2ca7
...
...
@@ -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
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment