2025-03-18 22:58:13 +02:00

3.9 KiB

druid.widget.mini_graph API

at /druid/widget/mini_graph/mini_graph.lua

Widget to display a several lines with different height in a row Init, set amount of samples and max value of value means that the line will be at max height Use push_line_value to add a new value to the line Or set_line_value to set a value to the line by index Setup colors inside template file (at minimum and maximum)

Functions

Fields

init


mini_graph:init()

on_remove


mini_graph:on_remove()

clear


mini_graph:clear()

set_samples


mini_graph:set_samples([samples])
  • Parameters:
    • [samples] (any):

get_samples


mini_graph:get_samples()
  • Returns:
    • `` (unknown):

set_line_value


mini_graph:set_line_value(index, value)

Set normalized to control the color of the line

  • Parameters:

    • index (number):
    • value (number): The normalized value from 0 to 1
  • Example Usage:

for index = 1, mini_graph:get_samples() do
	mini_graph:set_line_value(index, math.random())
end

get_line_value


mini_graph:get_line_value([index])
  • Parameters:

    • [index] (any):
  • Returns:

    • `` (number):

push_line_value


mini_graph:push_line_value([value])
  • Parameters:
    • [value] (any):

set_max_value


mini_graph:set_max_value([max_value])
  • Parameters:
    • [max_value] (any):

set_line_height


mini_graph:set_line_height([index])
  • Parameters:
    • [index] (any):

get_lowest_value


mini_graph:get_lowest_value()

get_highest_value


mini_graph:get_highest_value()

on_drag_widget


mini_graph:on_drag_widget([dx], [dy])
  • Parameters:
    • [dx] (any):
    • [dy] (any):

toggle_hide


mini_graph:toggle_hide()
  • Returns:
    • `` (druid.widget.mini_graph):

Fields

  • root (node)

  • text_header (druid.text): The component to handle text behaviour over a GUI Text node, mainly used to automatically adjust text size to fit the text area

  • icon_drag (node)

  • content (node)

  • layout (druid.layout): The component used for managing the layout of nodes, placing them inside the node size with respect to the size and pivot of each node

  • prefab_line (node)

  • color_zero (unknown)

  • color_one (unknown)

  • is_hidden (boolean)

  • max_value (integer): in this value line will be at max height

  • lines (table)

  • values (table)

  • container (druid.container): The component used for managing the size and positions with other containers relations to create a adaptable layouts

  • default_size (vector3)

  • samples (any)