Class wibox.widget.graph
A graph widget.
The graph goes from left to right. To change this to right to left, use a wibox.container.mirror widget. This can also be used to have data shown from top to bottom.
To add text on top of the graph, use a wibox.layout.stack and a
wibox.container.align
widgets.
To display the graph vertically, use a wibox.container.rotate widget.
Usage:
wibox.widget { max_value = 29, widget = wibox.widget.graph }
Info:
- Copyright: 2009 Julien Danjou
- Author: Julien Danjou <julien@danjou.info>
Functions
graph:add_value (value, group) | Add a value to the graph |
graph:clear () | Clear the graph. |
graph:set_height (height) | Set the graph height. |
graph:set_width (width) | Set the graph width. |
wibox.widget.graph (args) | Create a graph widget. |
Object properties
wibox.widget.graph.border_color | Set the graph border color. |
wibox.widget.graph.color | Set the graph foreground color. |
wibox.widget.graph.background_color | Set the graph background color. |
wibox.widget.graph.max_value | Set the maximum value the graph should handle. |
wibox.widget.graph.min_value | The minimum value. |
wibox.widget.graph.scale | Set the graph to automatically scale its values. |
wibox.widget.graph.step_width | Set the width or the individual steps. |
wibox.widget.graph.step_spacing | Set the spacing between the steps. |
wibox.widget.graph.step_shape | The step shape. |
wibox.widget.graph.stack | Set the graph to draw stacks. |
wibox.widget.graph.stack_colors | Set the graph stacking colors. |
Theme variables
beautiful.graph_bg | The graph background color. |
beautiful.graph_fg | The graph foreground color. |
beautiful.graph_border_color | The graph border color. |
Functions
- graph:add_value (value, group)
-
Add a value to the graph
- value The value to be added to the graph
- group The stack color group index.
- graph:clear ()
- Clear the graph.
- graph:set_height (height)
-
Set the graph height.
- height The height to set.
- graph:set_width (width)
-
Set the graph width.
- width The width to set.
- wibox.widget.graph (args)
-
Create a graph widget.
- args Standard widget() arguments. You should add width and height key to set graph geometry.
Returns:
-
A new graph widget.
Object properties
- wibox.widget.graph.border_color
-
Set the graph border color.
If the value is nil, no border will be drawn.
Type:
- border_color gears.color The border color to set.
See also:
- wibox.widget.graph.color
-
Set the graph foreground color.
Type:
- color color The graph color.
See also:
- wibox.widget.graph.background_color
-
Set the graph background color.
Type:
- background_color gears.color The graph background color.
See also:
- wibox.widget.graph.max_value
-
Set the maximum value the graph should handle.
If "scale" is also set, the graph never scales up below this value, but it
automatically scales down to make all data fit.
Type:
- number
- wibox.widget.graph.min_value
-
The minimum value.
Note that the min_value is not supported when used along with the stack
property.
Type:
- number
- wibox.widget.graph.scale
-
Set the graph to automatically scale its values. Default is false.
Type:
- boolean
- wibox.widget.graph.step_width
-
Set the width or the individual steps.
Note that it isn't supported when used along with stacked graphs.
Type:
- number (default 1)
Usage:
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 }
- wibox.widget.graph.step_spacing
-
Set the spacing between the steps.
Note that it isn't supported when used along with stacked graphs.
Type:
- number (default 0)
- wibox.widget.graph.step_shape
-
The step shape.
Type:
- shape (default rectangle)
See also:
- wibox.widget.graph.stack
-
Set the graph to draw stacks. Default is false.
Type:
- boolean
- wibox.widget.graph.stack_colors
-
Set the graph stacking colors. Order matters.
Type:
- stack_colors A table with stacking colors.