mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Fix alerts dashboard look
This commit is contained in:
parent
547e623273
commit
f2eb15ba76
4 changed files with 53 additions and 4 deletions
|
|
@ -1165,6 +1165,45 @@ function aggregation2String(value)
|
|||
end
|
||||
end
|
||||
|
||||
-- #################################
|
||||
|
||||
-- Aggregates items below some edge
|
||||
-- edge: minimum percentage value to create collision
|
||||
-- min_col: minimum collision groups to aggregate
|
||||
function aggregatePie(values, values_sum, edge, min_col)
|
||||
local edge = edge or 0.05
|
||||
min_col = min_col or 2
|
||||
local aggr = {}
|
||||
local other = i18n("other")
|
||||
local below_edge = {}
|
||||
|
||||
-- Initial lookup
|
||||
for k,v in pairs(values) do
|
||||
if v / values_sum <= edge then
|
||||
-- too small
|
||||
below_edge[#below_edge + 1] = k
|
||||
else
|
||||
aggr[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
-- Decide if to aggregate
|
||||
for _,k in pairs(below_edge) do
|
||||
if #below_edge >= min_col then
|
||||
-- aggregate
|
||||
aggr[other] = aggr[other] or 0
|
||||
aggr[other] = aggr[other] + values[k]
|
||||
else
|
||||
-- do not aggregate
|
||||
aggr[k] = values[k]
|
||||
end
|
||||
end
|
||||
|
||||
return aggr
|
||||
end
|
||||
|
||||
-- #################################
|
||||
|
||||
function getOSIcon(name)
|
||||
icon = ""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue