doc: Add examples for the graph.
This commit is contained in:
parent
6ef3a8f059
commit
c48e138b01
|
@ -27,10 +27,21 @@ local beautiful = require("beautiful")
|
|||
|
||||
local graph = { mt = {} }
|
||||
|
||||
--- Set the graph border_width.
|
||||
--
|
||||
--@DOC_wibox_widget_graph_border_width_EXAMPLE@
|
||||
--
|
||||
-- @property border_width
|
||||
-- @tparam number border_width
|
||||
-- @propemits true false
|
||||
-- @see border_color
|
||||
|
||||
--- Set the graph border color.
|
||||
--
|
||||
-- If the value is nil, no border will be drawn.
|
||||
--
|
||||
--@DOC_wibox_widget_graph_border_color_EXAMPLE@
|
||||
--
|
||||
-- @property border_color
|
||||
-- @tparam gears.color border_color The border color to set.
|
||||
-- @propbeautiful
|
||||
|
@ -39,6 +50,8 @@ local graph = { mt = {} }
|
|||
|
||||
--- Set the graph foreground color.
|
||||
--
|
||||
--@DOC_wibox_widget_graph_color_EXAMPLE@
|
||||
--
|
||||
-- @property color
|
||||
-- @tparam color color The graph color.
|
||||
-- @usebeautiful beautiful.graph_fg
|
||||
|
@ -47,6 +60,8 @@ local graph = { mt = {} }
|
|||
|
||||
--- Set the graph background color.
|
||||
--
|
||||
--@DOC_wibox_widget_graph_background_color_EXAMPLE@
|
||||
--
|
||||
-- @property background_color
|
||||
-- @tparam gears.color background_color The graph background color.
|
||||
-- @usebeautiful beautiful.graph_bg
|
||||
|
@ -55,6 +70,8 @@ local graph = { mt = {} }
|
|||
|
||||
--- Set the maximum value the graph should handle.
|
||||
--
|
||||
-- @DOC_wibox_widget_graph_max_value_EXAMPLE@
|
||||
--
|
||||
-- If "scale" is also set, the graph never scales up below this value, but it
|
||||
-- automatically scales down to make all data fit.
|
||||
--
|
||||
|
@ -64,6 +81,8 @@ local graph = { mt = {} }
|
|||
|
||||
--- The minimum value.
|
||||
--
|
||||
-- @DOC_wibox_widget_graph_min_value_EXAMPLE@
|
||||
--
|
||||
-- Note that the min_value is not supported when used along with the stack
|
||||
-- property.
|
||||
-- @property min_value
|
||||
|
@ -72,6 +91,8 @@ local graph = { mt = {} }
|
|||
|
||||
--- Set the graph to automatically scale its values. Default is false.
|
||||
--
|
||||
--@DOC_wibox_widget_graph_scale1_EXAMPLE@
|
||||
--
|
||||
-- @property scale
|
||||
-- @tparam boolean scale
|
||||
-- @propemits true false
|
||||
|
@ -90,12 +111,16 @@ local graph = { mt = {} }
|
|||
--
|
||||
-- Note that it isn't supported when used along with stacked graphs.
|
||||
--
|
||||
--@DOC_wibox_widget_graph_step_spacing_EXAMPLE@
|
||||
--
|
||||
-- @property step_spacing
|
||||
-- @tparam[opt=0] number step_spacing
|
||||
-- @propemits true false
|
||||
|
||||
--- The step shape.
|
||||
--
|
||||
--@DOC_wibox_widget_graph_step_shape_EXAMPLE@
|
||||
--
|
||||
-- @property step_shape
|
||||
-- @tparam[opt=rectangle] gears.shape|function step_shape
|
||||
-- @propemits true false
|
||||
|
@ -103,6 +128,7 @@ local graph = { mt = {} }
|
|||
|
||||
--- Set the graph to draw stacks. Default is false.
|
||||
--
|
||||
--@DOC_wibox_widget_graph_stacked_EXAMPLE@
|
||||
-- @property stack
|
||||
-- @tparam boolean stack
|
||||
-- @propemits true false
|
||||
|
@ -130,7 +156,7 @@ local graph = { mt = {} }
|
|||
local properties = { "width", "height", "border_color", "stack",
|
||||
"stack_colors", "color", "background_color",
|
||||
"max_value", "scale", "min_value", "step_shape",
|
||||
"step_spacing", "step_width" }
|
||||
"step_spacing", "step_width", "border_width" }
|
||||
|
||||
function graph.draw(_graph, _, cr, width, height)
|
||||
local max_value = _graph._private.max_value
|
||||
|
@ -141,8 +167,9 @@ function graph.draw(_graph, _, cr, width, height)
|
|||
local step_shape = _graph._private.step_shape
|
||||
local step_spacing = _graph._private.step_spacing or 0
|
||||
local step_width = _graph._private.step_width or 1
|
||||
local bw = _graph._private.border_width or 1
|
||||
|
||||
cr:set_line_width(1)
|
||||
cr:set_line_width(bw)
|
||||
|
||||
-- Draw the background first
|
||||
cr:set_source(color(_graph._private.background_color or beautiful.graph_bg or "#000000aa"))
|
||||
|
@ -150,9 +177,10 @@ function graph.draw(_graph, _, cr, width, height)
|
|||
|
||||
-- Account for the border width
|
||||
cr:save()
|
||||
|
||||
if _graph._private.border_color then
|
||||
cr:translate(1, 1)
|
||||
width, height = width - 2, height - 2
|
||||
cr:translate(bw, bw)
|
||||
width, height = width - 2*bw, height - 2*bw
|
||||
end
|
||||
|
||||
-- Draw a stacked graph
|
||||
|
@ -239,10 +267,10 @@ function graph.draw(_graph, _, cr, width, height)
|
|||
-- Draw the border last so that it overlaps already drawn values
|
||||
if _graph._private.border_color then
|
||||
-- We decremented these by two above
|
||||
width, height = width + 2, height + 2
|
||||
width, height = width + 2*bw, height + 2*bw
|
||||
|
||||
-- Draw the border
|
||||
cr:rectangle(0.5, 0.5, width - 1, height - 1)
|
||||
cr:rectangle(bw/2, bw/2, width - bw, height - bw)
|
||||
cr:set_source(color(_graph._private.border_color or beautiful.graph_border_color or "#ffffff"))
|
||||
cr:stroke()
|
||||
end
|
||||
|
@ -277,7 +305,7 @@ function graph:add_value(value, group)
|
|||
table.insert(values, value)
|
||||
|
||||
local border_width = 0
|
||||
if self._private.border_color then border_width = 2 end
|
||||
if self._private.border_color then border_width = self._private.border_width*2 end
|
||||
|
||||
-- Ensure we never have more data than we can draw
|
||||
while #values > self._private.width - border_width do
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
local l = wibox.layout { --DOC_HIDE
|
||||
forced_height = 100, --DOC_HIDE
|
||||
forced_width = 100, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.vertical --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
for _, color in ipairs {"#ff0000", "#00ff00", "#0000ff", "#ff00ff" } do
|
||||
local w = --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
border_width = 2, --DOC_HIDE
|
||||
margins = 5, --DOC_HIDE
|
||||
max_value = 29,
|
||||
background_color = color,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
l:add(w) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
end
|
||||
|
||||
parent:add(l) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -0,0 +1,41 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
local l = wibox.layout { --DOC_HIDE
|
||||
forced_height = 100, --DOC_HIDE
|
||||
forced_width = 100, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.vertical --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
for _, color in ipairs {"#ff0000", "#00ff00", "#0000ff", "#ff00ff" } do
|
||||
local w = --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
max_value = 29,
|
||||
border_width = 2, --DOC_HIDE
|
||||
border_color = color,
|
||||
margins = 5, --DOC_HIDE
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
l:add(w) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
end
|
||||
|
||||
parent:add(l) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -0,0 +1,42 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
local beautiful = require("beautiful") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
local l = wibox.layout { --DOC_HIDE
|
||||
forced_height = 100, --DOC_HIDE
|
||||
forced_width = 100, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.vertical --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
for _, width in ipairs { 1, 2, 4, 10 } do
|
||||
local w = --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
max_value = 30,
|
||||
border_width = width, --DOC_HIDE
|
||||
border_color = beautiful.border_color,
|
||||
margins = 5, --DOC_HIDE
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
l:add(w) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
end
|
||||
|
||||
parent:add(l) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -0,0 +1,41 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
local l = wibox.layout { --DOC_HIDE
|
||||
forced_height = 100, --DOC_HIDE
|
||||
forced_width = 100, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.vertical --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
for _, color in ipairs {"#ff0000", "#00ff00", "#0000ff", "#ff00ff" } do
|
||||
local w = --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
max_value = 29,
|
||||
color = color,
|
||||
widget = wibox.widget.graph,
|
||||
border_width = 2, --DOC_HIDE
|
||||
margins = 5, --DOC_HIDE
|
||||
}
|
||||
|
||||
l:add(w) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
end
|
||||
|
||||
parent:add(l) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -0,0 +1,56 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
|
||||
local w1 = --DOC_HIDE
|
||||
wibox.widget {
|
||||
max_value = 30,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
local w2 = --DOC_HIDE
|
||||
wibox.widget {
|
||||
max_value = 10,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w1:add_value(v) --DOC_HIDE
|
||||
w2:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
parent:add(wibox.layout {--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
markup = "<b>With `max_value = 30`</b>",--DOC_HIDE
|
||||
widget = wibox.widget.textbox,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
w1,--DOC_HIDE
|
||||
layout = wibox.layout.fixed.vertical,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
markup = "<b>With `max_value = 10`</b>",--DOC_HIDE
|
||||
widget = wibox.widget.textbox,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
w2,--DOC_HIDE
|
||||
layout = wibox.layout.fixed.vertical,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
|
||||
forced_width = 240, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.horizontal --DOC_HIDE
|
||||
}) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -0,0 +1,57 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
|
||||
local w1 = --DOC_HIDE
|
||||
wibox.widget {
|
||||
max_value = 30,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
local w2 = --DOC_HIDE
|
||||
wibox.widget {
|
||||
min_value = 10,
|
||||
max_value = 30,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w1:add_value(v) --DOC_HIDE
|
||||
w2:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
parent:add(wibox.layout {--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
markup = "<b>Without `min_value`</b>",--DOC_HIDE
|
||||
widget = wibox.widget.textbox,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
w1,--DOC_HIDE
|
||||
layout = wibox.layout.fixed.vertical,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
markup = "<b>With `min_value = 10`</b>",--DOC_HIDE
|
||||
widget = wibox.widget.textbox,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
w2,--DOC_HIDE
|
||||
layout = wibox.layout.fixed.vertical,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
|
||||
forced_width = 240, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.horizontal --DOC_HIDE
|
||||
}) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -0,0 +1,56 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
|
||||
local w1 = --DOC_HIDE
|
||||
wibox.widget {
|
||||
scale = false,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
local w2 = --DOC_HIDE
|
||||
wibox.widget {
|
||||
scale = true,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w1:add_value(v) --DOC_HIDE
|
||||
w2:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
parent:add(wibox.layout {--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
markup = "<b>scale = false</b>",--DOC_HIDE
|
||||
widget = wibox.widget.textbox,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
w1,--DOC_HIDE
|
||||
layout = wibox.layout.fixed.vertical,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
{--DOC_HIDE
|
||||
markup = "<b>scale = true</b>",--DOC_HIDE
|
||||
widget = wibox.widget.textbox,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
w2,--DOC_HIDE
|
||||
layout = wibox.layout.fixed.vertical,--DOC_HIDE
|
||||
},--DOC_HIDE
|
||||
|
||||
forced_width = 210, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.horizontal --DOC_HIDE
|
||||
}) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -0,0 +1,59 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
{3, 5, 6}, {4, 11,15}, {19,29,17},{17,14,0}, {0,3,1}, {0,0,22}, {17,7,1}, {0,0,5}, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
local l = wibox.layout { --DOC_HIDE
|
||||
forced_height = 100, --DOC_HIDE
|
||||
forced_width = 100, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.vertical --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
local colors = {
|
||||
"#ff0000",
|
||||
"#00ff00",
|
||||
"#0000ff"
|
||||
}
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
local w = --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
max_value = 29,
|
||||
stack = true,
|
||||
border_width = 2, --DOC_HIDE
|
||||
stack_colors = colors,
|
||||
margins = 5, --DOC_HIDE
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
l:add(w) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
for group, value in ipairs(v) do --DOC_HIDE
|
||||
w:add_value(value, group) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
parent:add(l) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -11,21 +11,36 @@ local data = { --DOC_HIDE
|
|||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
local w = --DOC_HIDE
|
||||
wibox.widget {
|
||||
max_value = 29,
|
||||
step_width = 3,
|
||||
step_spacing = 1,
|
||||
step_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 2)
|
||||
end,
|
||||
widget = wibox.widget.graph
|
||||
}
|
||||
|
||||
parent:add( w ) --DOC_HIDE
|
||||
local l = wibox.layout { --DOC_HIDE
|
||||
forced_height = 100, --DOC_HIDE
|
||||
forced_width = 100, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.vertical --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
for _, width in ipairs {1, 2, 3, 10} do
|
||||
local w = --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
max_value = 29, --DOC_HIDE
|
||||
step_width = width,
|
||||
step_spacing = 1,
|
||||
step_shape = function(cr, s_width, height)
|
||||
gears.shape.rounded_rect(cr, s_width, height, 2)
|
||||
end,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
l:add(w) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
end
|
||||
|
||||
parent:add(l) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
local gears = {shape = require("gears.shape")} --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
|
||||
local l = wibox.layout { --DOC_HIDE
|
||||
forced_height = 200, --DOC_HIDE
|
||||
forced_width = 200, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.vertical --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
local shapes = {
|
||||
gears.shape.squircle,
|
||||
gears.shape.octogon,
|
||||
gears.shape.rounded_bar,
|
||||
gears.shape.arrow
|
||||
}
|
||||
|
||||
--DOC_NEWLINE
|
||||
|
||||
for _, shape in ipairs(shapes) do
|
||||
local w = --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
max_value = 29, --DOC_HIDE
|
||||
step_width = 5,
|
||||
step_spacing = 1,
|
||||
step_shape = shape,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
l:add(w) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
end
|
||||
|
||||
parent:add(l) --DOC_HIDE
|
||||
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
|
@ -0,0 +1,42 @@
|
|||
--DOC_GEN_IMAGE --DOC_HIDE
|
||||
local parent = ... --DOC_HIDE
|
||||
local wibox = require("wibox") --DOC_HIDE
|
||||
|
||||
local data = { --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
3, 5, 6,4, 11,15,19,29,17,17,14,0,0,3,1,0,0, 22, 17,7, 1,0,0,5, --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
|
||||
local l = wibox.layout { --DOC_HIDE
|
||||
forced_height = 100, --DOC_HIDE
|
||||
forced_width = 100, --DOC_HIDE
|
||||
spacing = 5, --DOC_HIDE
|
||||
layout = wibox.layout.flex.vertical --DOC_HIDE
|
||||
} --DOC_HIDE
|
||||
|
||||
for _, spacing in ipairs {0, 2, 4, 10} do
|
||||
local w = --DOC_HIDE
|
||||
|
||||
wibox.widget {
|
||||
border_width = 2, --DOC_HIDE
|
||||
margins = 5, --DOC_HIDE
|
||||
max_value = 29,
|
||||
step_spacing = spacing,
|
||||
widget = wibox.widget.graph,
|
||||
}
|
||||
|
||||
l:add(w) --DOC_HIDE
|
||||
|
||||
for _, v in ipairs(data) do --DOC_HIDE
|
||||
w:add_value(v) --DOC_HIDE
|
||||
end --DOC_HIDE
|
||||
|
||||
end
|
||||
|
||||
parent:add(l) --DOC_HIDE
|
||||
|
||||
--DOC_HIDE vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
Loading…
Reference in New Issue