Skip to main content

GraphGroup

Lays out multiple graphs in a grid inside a single container, so dashboards can be built without hand-positioning cells. Cells reflow automatically as graphs are added or removed, and each cell's graph redraws itself on resize like any standalone graph.

Create one with Plottr.newGroup.

Types​

GroupConfig​

interface GroupConfig {
columns: number?--

Grid columns (default 2)

spacing: number?--

Pixel gap between cells (default 12)

}

Grid layout options for GraphGroup.new.

Functions​

new​

GraphGroup.new(
container: GuiObject,
config: GroupConfig?
) → GraphGroup

Creates an empty graph grid filling the given container.

addGraph​

GraphGroup:addGraph(
name: string,--

Unique cell name

config: PartialConfig?--

Passed through to Graph.new

) → Graph

Adds a named graph cell to the grid and returns its Graph.

Errors

TypeDescription
duplicate nameThrown when a graph with the name already exists

getGraph​

GraphGroup:getGraph(name: string) → Graph?

Returns the graph with the given name, if any.

getGraphNames​

GraphGroup:getGraphNames() → {string}

Returns every graph name, in the order the cells are laid out.

removeGraph​

GraphGroup:removeGraph(name: string) → boolean--

Whether a graph with that name existed

Destroys the named graph and reflows the remaining cells.

destroy​

GraphGroup:destroy() → ()

Destroys every graph and everything the group created. Safe to call twice.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Creates an empty graph grid filling the given container.",
            "params": [
                {
                    "name": "container",
                    "desc": "",
                    "lua_type": "GuiObject"
                },
                {
                    "name": "config",
                    "desc": "",
                    "lua_type": "GroupConfig?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "GraphGroup"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 61,
                "path": "src/GraphGroup.luau"
            }
        },
        {
            "name": "addGraph",
            "desc": "Adds a named graph cell to the grid and returns its [Graph].",
            "params": [
                {
                    "name": "name",
                    "desc": "Unique cell name",
                    "lua_type": "string"
                },
                {
                    "name": "config",
                    "desc": "Passed through to [Graph.new]",
                    "lua_type": "PartialConfig?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Graph"
                }
            ],
            "function_type": "method",
            "errors": [
                {
                    "lua_type": "duplicate name",
                    "desc": "Thrown when a graph with the name already exists"
                }
            ],
            "source": {
                "line": 112,
                "path": "src/GraphGroup.luau"
            }
        },
        {
            "name": "getGraph",
            "desc": "Returns the graph with the given name, if any.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Graph?"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 139,
                "path": "src/GraphGroup.luau"
            }
        },
        {
            "name": "getGraphNames",
            "desc": "Returns every graph name, in the order the cells are laid out.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ string }"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 151,
                "path": "src/GraphGroup.luau"
            }
        },
        {
            "name": "removeGraph",
            "desc": "Destroys the named graph and reflows the remaining cells.",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Whether a graph with that name existed",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 164,
                "path": "src/GraphGroup.luau"
            }
        },
        {
            "name": "destroy",
            "desc": "Destroys every graph and everything the group created. Safe to call twice.",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 195,
                "path": "src/GraphGroup.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "GroupConfig",
            "desc": "Grid layout options for [GraphGroup.new].",
            "fields": [
                {
                    "name": "columns",
                    "lua_type": "number?",
                    "desc": "Grid columns (default 2)"
                },
                {
                    "name": "spacing",
                    "lua_type": "number?",
                    "desc": "Pixel gap between cells (default 12)"
                }
            ],
            "source": {
                "line": 33,
                "path": "src/GraphGroup.luau"
            }
        }
    ],
    "name": "GraphGroup",
    "desc": "Lays out multiple graphs in a grid inside a single container, so\ndashboards can be built without hand-positioning cells. Cells reflow\nautomatically as graphs are added or removed, and each cell's graph\nredraws itself on resize like any standalone graph.\n\nCreate one with [Plottr.newGroup].",
    "source": {
        "line": 22,
        "path": "src/GraphGroup.luau"
    }
}