mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-05 10:41:34 +00:00
Widgets update
This commit is contained in:
parent
ed64370093
commit
1c76667b21
7 changed files with 244 additions and 42 deletions
|
|
@ -206,39 +206,11 @@ function widgets_utils.generate_response(widget, params)
|
|||
-- Remove trailer .lua from the origin
|
||||
local origin = ds.origin:gsub("%.lua", "")
|
||||
|
||||
-- io.write("Executing "..origin.."\n")
|
||||
|
||||
-- Call the origin to return
|
||||
local response = require(origin)
|
||||
|
||||
if (widget.type == "doughnut") then
|
||||
response = {
|
||||
data = {
|
||||
labels = {'Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'},
|
||||
datasets = {{
|
||||
label = '# of Votes',
|
||||
data = {12, 19, 3, 5, 2, 3},
|
||||
backgroundColor = {
|
||||
'rgba(255, 99, 132, 1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
},
|
||||
borderColor = {
|
||||
'rgba(255, 99, 132, 1)',
|
||||
'rgba(54, 162, 235, 1)',
|
||||
'rgba(255, 206, 86, 1)',
|
||||
'rgba(75, 192, 192, 1)',
|
||||
'rgba(153, 102, 255, 1)',
|
||||
'rgba(255, 159, 64, 1)'
|
||||
},
|
||||
borderWidth = 1
|
||||
}}
|
||||
}
|
||||
}
|
||||
else
|
||||
response = response:getData(widget.type)
|
||||
end
|
||||
response = response:getData(widget.type)
|
||||
|
||||
return json.encode({
|
||||
widgetName = widget.name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue