Skip to content

@graphty/graphty-element / session / LegendBlock

Interface: LegendBlock ​

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

Everything a reader is told about one channel of one layer.

field, scale, domain and palette are each absent when there is nothing true to put in them: a layer that writes a fixed colour reads no field, passes through no scale and has no domain, and the prepared binding says so by carrying a null path and a null scale. Filling them with a placeholder would put a field name in a legend that names no field.

Properties ​

channel ​

readonly channel: Channel

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

The channel the block describes.


departures ​

readonly departures: readonly string[]

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

What this encoding does that the picture alone does not admit to.

Finished sentences, printed unedited. Empty when the encoding has nothing to confess.


domain? ​

readonly optional domain?: object

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

The extent values were read against, and how it was narrowed.

clamped? ​

readonly optional clamped?: object

The percentiles the extent was cut at, when the binding asked for a clamp.

clamped.from ​

readonly from: string

The low percentile, such as "p2".

clamped.to ​

readonly to: string

The high percentile, such as "p98".

max ​

readonly max: number

The high end.

midpoint? ​

readonly optional midpoint?: number

The value a diverging palette centres on, when the binding named one.

min ​

readonly min: number

The low end.


field? ​

readonly optional field?: object

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

The field the encoding reads, in both plain and technical words.

path ​

readonly path: string

The column path itself.

plainName ​

readonly plainName: string

The name a reader sees.

technicalName ​

readonly technicalName: string

The name the literature and the data use.


kind ​

readonly kind: "literal" | "categorical" | "highlight" | "sequential" | "diverging"

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

What shape of legend a consumer draws: a ramp, a list of colours, a single chip.


layerId ​

readonly layerId: string

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

The layer that paints it.


overflow? ​

readonly optional overflow?: object

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

How many rows did not fit, when some did not. The "other" row is never counted here.

hidden ​

readonly hidden: number

How many rows were left out.


palette? ​

readonly optional palette?: object

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

The palette, when the channel carries a colour.

name ​

readonly name: PaletteId

The palette's id.

reversed ​

readonly reversed: boolean

Whether the smallest value lands at the far end of it.


range? ​

readonly optional range?: object

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

The range the binding maps values onto, in the channel's own units ("1 to 3" for a node size; node size is unitless, never pixels). Present only for a channel that carries a number, such as node.size or edge.width, and absent when the binding's map or other paints values of its own, which the range does not bound. It is the binding's range, not the smallest and largest swatch: a reversed binding still reads low to high here, and the swatches are only samples of it.

max ​

readonly max: number

The high end.

min ​

readonly min: number

The low end.

Since ​

3.10.0


reading? ​

readonly optional reading?: LegendReading

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

What a higher value means on the drawing. Present only for an encoding that reads a numeric domain and paints its two ends differently in one direction: absent for categories, for a diverging palette (both ends are strong), for a fixed value and for a domain of one value.

Since ​

3.10.0


runId? ​

readonly optional runId?: string

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

The run behind the layer, when a run put it there.


scale? ​

readonly optional scale?: object

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

The scale, by name and in words.

kind ​

readonly kind: string

The scale's name, which is what a binding spells.

label ​

readonly label: string

The same scale in words, from the scale catalogue.


swatches ​

readonly swatches: readonly LegendSwatch[]

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

Up to twelve rows, plus the "other" row when the paint folded some groups.