mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
Improve stackedProgressBars
This commit is contained in:
parent
a202639c24
commit
96ce6c0cf5
7 changed files with 26 additions and 9 deletions
|
|
@ -152,15 +152,16 @@ end
|
|||
--! - class: the bootstrap color class, usually: "default", "info", "danger", "warning", "success"
|
||||
--! @param other_label optional name for the "other" part of the bar. If nil, it will not be shown.
|
||||
--! @param formatter an optional item value formatter
|
||||
--! @param css_class an optional css class to apply to the progress div
|
||||
--! @return html for the bar
|
||||
function stackedProgressBars(total, bars, other_label, formatter)
|
||||
function stackedProgressBars(total, bars, other_label, formatter, css_class)
|
||||
local res = {}
|
||||
local cumulative = 0
|
||||
local cumulative_perc = 0
|
||||
formatter = formatter or (function(x) return x end)
|
||||
|
||||
-- The bars
|
||||
res[#res + 1] = [[<div class="progress">]]
|
||||
res[#res + 1] = [[<div class=' ]] .. (css_class or "ntop-progress-stacked") .. [['><div class="progress">]]
|
||||
|
||||
for _, bar in ipairs(bars) do cumulative = cumulative + bar.value end
|
||||
if cumulative > total then total = cumulative end
|
||||
|
|
@ -178,7 +179,7 @@ function stackedProgressBars(total, bars, other_label, formatter)
|
|||
end
|
||||
|
||||
res[#res + 1] = [[
|
||||
</div>]]
|
||||
</div></div>]]
|
||||
|
||||
-- The legend
|
||||
res[#res + 1] = [[<div class="stacked-progress-legend">]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue