pivotick / GraphUI / LegendEntry
Interface: LegendEntry
Defined in: interfaces/GraphUI.ts:542
One row in the legend: a swatch, a label, and how to tell which elements it stands for — nodes, or edges in an edge-scoped section.
Example
{ id: 'hub', label: 'Hub', color: '#7EA2FB',
predicate: (node) => node.getData()?.type === 'hub' }Properties
badge?
optionalbadge:NodeBadge
Defined in: interfaces/GraphUI.ts:567
Draw this badge as the swatch instead of a dot, for elements told apart by a NodeStyle.badges mark rather than by their fill. It is drawn the way the canvas draws it, so the legend shows the same mark. A badge naming no color takes the entry's. Ignored in an edge-scoped section, whose swatch is a line.
Example
{ id: 'enriched', label: 'From enrichment', color: '#8b5cf6',
badge: { svgIcon: sparkle }, predicate: (node) => node.getData().enriched }color
color:
string
Defined in: interfaces/GraphUI.ts:554
The swatch colour — any CSS colour. Sampled from the renderer in derived mode: the node's fill, or an edge's stroke in an edge-scoped section.
id
id:
string
Defined in: interfaces/GraphUI.ts:544
Stable identity: the toggle key, and the value written to the filter.
label?
optionallabel:string
Defined in: interfaces/GraphUI.ts:549
Human label, used verbatim (so it can be translated).
Default
a prettified id
order?
optionalorder:number
Defined in: interfaces/GraphUI.ts:576
Display order, ascending.
Default
declaration (or first-seen) orderpredicate?
optionalpredicate: (node) =>boolean| (edge) =>boolean
Defined in: interfaces/GraphUI.ts:574
Which elements this entry stands for. Defaults to matching id against LegendOptions.key on the element's data, when a key is declared.
Receives a Node, or an Edge when the section declares scope: 'edge'.