mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-03 01:10:10 +00:00
Fixes too many charts (#7610)
This commit is contained in:
parent
7efe9fb4dd
commit
badd631ef7
1 changed files with 14 additions and 3 deletions
|
|
@ -17,6 +17,8 @@ local ifid = _GET["ifid"] or interface.getId()
|
|||
interface.select(tostring(ifid))
|
||||
|
||||
local inactive_hosts_manufacturer = inactive_hosts_utils.getManufacturerFilters(ifid)--, inactive_hosts_utils.getFilters())
|
||||
local max = 10
|
||||
local other_num = 0
|
||||
local series = {}
|
||||
local labels = {}
|
||||
local colors = {}
|
||||
|
|
@ -32,14 +34,23 @@ local rsp = {
|
|||
}
|
||||
}
|
||||
|
||||
for _, info in pairs(inactive_hosts_manufacturer) do
|
||||
if info.count then
|
||||
for _, info in pairsByField(inactive_hosts_manufacturer, "count", rev) do
|
||||
if info.count and max > 0 then
|
||||
series[#series + 1] = info.count
|
||||
labels[#labels + 1] = info.label
|
||||
colors[#colors + 1] = graph_utils.get_html_color(#colors + 1)
|
||||
colors[#colors + 1] = graph_utils.get_html_color(#colors + 1)
|
||||
max = max - 1
|
||||
elseif info.count then
|
||||
other_num = other_num + info.count
|
||||
end
|
||||
end
|
||||
|
||||
if other_num > 0 then
|
||||
series[#series + 1] = other_num
|
||||
labels[#labels + 1] = i18n('others')
|
||||
colors[#colors + 1] = graph_utils.get_html_color(#colors + 1)
|
||||
end
|
||||
|
||||
rsp.series = series
|
||||
rsp.labels = labels
|
||||
rsp.colors = colors
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue