Skip to content

@graphty/graphty-element / session / LegendSwatch

Interface: LegendSwatch ​

Defined in: graphty-element/src/session/styles/legend.ts:59

One row of a legend: a value, and what the picture paints for it.

value is the DATA value -- the category, or a number on the domain -- and color, size and paints are what the encoding turns it into. label is that same value in the words a reader sees, worked out once here so that two consumers do not format the same number two ways.

Properties ​

color? ​

readonly optional color?: string

Defined in: graphty-element/src/session/styles/legend.ts:82

The colour the encoding paints it, as #rrggbb or #rrggbbaa.


count? ​

readonly optional count?: number

Defined in: graphty-element/src/session/styles/legend.ts:86

How many elements carry it, when whoever supplied the encoding can say. Always set on the "other" row.


hidden? ​

readonly optional hidden?: true

Defined in: graphty-element/src/session/styles/legend.ts:80

The binding does not paint this value (its hidden list names it): elements carrying it are drawn as the layers beneath paint them. color, size and paints still say what the value is painted when it is shown again. Absent on a row that is painted.


label ​

readonly label: string

Defined in: graphty-element/src/session/styles/legend.ts:61

The value in the words a reader sees.


paints? ​

readonly optional paints?: unknown

Defined in: graphty-element/src/session/styles/legend.ts:95

What the encoding paints it when that is neither a colour nor a size -- a node shape, a line pattern, an arrow.

Those channels carry one of a fixed list, and a list of names has no chip a color or a size could stand in for. Without this a legend for "shape by community" could name the communities and not the shapes, which is half a legend.


rank? ​

readonly optional rank?: number

Defined in: graphty-element/src/session/styles/legend.ts:74

The group's place by size, from 1 for the largest, on a block that colours a run's groups (results.<run>.group): the same rank the run summary's group carries, so a list of groups, a table column and the legend can name one group the same way. Absent on any other row.


role? ​

readonly optional role?: string & object | "other"

Defined in: graphty-element/src/session/styles/legend.ts:103

What the row stands for. "other" marks the one bucket the paint folded the smaller groups into: its value lists the values it holds and its count how many elements carry them, and it is always the last row, kept even when the rows above it are capped.

OPEN UNION: roles may be added in a minor release. Absent on an ordinary row.


size? ​

readonly optional size?: number

Defined in: graphty-element/src/session/styles/legend.ts:84

The size or width the encoding paints it.


value ​

readonly value: unknown

Defined in: graphty-element/src/session/styles/legend.ts:67

The value itself, for a consumer that wants to filter or select by it -- spelled as the data spells it, so a run's group 0 is the number 0 here as it is in the run's summary, its sizes table and its per-node values, never the string "0".