Skip to content

@graphty/graphty-element / session / ColumnEncodingSpec

Interface: ColumnEncodingSpec ​

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:146

What encode() is asked for when it colors or sizes by a plain data column: an EncodingSpec with a column in place of the run.

Whatever is left off -- the scale, the palette, the range, the overflow -- is chosen from what the column measures when the layer is created, and written into it. A saved layer therefore always draws what it says, whatever the data or a later declaration does.

Extends ​

Properties ​

channel ​

readonly channel: Channel

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

The channel to paint.

Inherited from ​

EncodingSpec.channel


clamp? ​

readonly optional clamp?: [number, number]

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:116

Percentiles to cut the extent at, so a few outliers do not flatten everything else.

Inherited from ​

EncodingSpec.clamp


column ​

readonly column: ColumnRef

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:148

The column; an AttributeDescriptor from session.data.attributes() can be passed as is.


domain? ​

readonly optional domain?: "auto" | [number, number]

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:114

The extent to read values against. Defaults to the extent the run measured.

Inherited from ​

EncodingSpec.domain


missing? ​

readonly optional missing?: { value: string | number; } | "skip"

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:125

What an element with no value is painted. Defaults to "skip", which is to leave it alone.

Inherited from ​

EncodingSpec.missing


name? ​

readonly optional name?: string

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:129

What to call the layer. Defaults to the run's label and the channel's plain name.

Inherited from ​

EncodingSpec.name


overflow? ​

readonly optional overflow?: BindingOverflow

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:112

What a categorical colour encoding does when the run found more groups than the palette has colours (8 for the default palette). Ignored for a measurement, which has no groups.

  • "other" -- THE DEFAULT. The 8 largest groups keep the palette's colours in palette order, largest first, and every remaining group is painted one grey (#686868), which the legend lists as its last row, marked role: "other".
  • "shape" -- node encodings only. Colours cycle through the palette and each full cycle moves to the next node shape: group i is colour i mod 8 and shape floor(i / 8) from icosphere (the default shape), box, octahedron, cylinder, cone, torus. Groups past 48 fold into the grey. The shape is written by the same layer, so it is added and removed with the colour. Refused with E_BAD_COMMAND on an edge channel, since an edge has no shape.
  • "extend" -- every group gets a colour of its own: a larger categorical palette when one fits, and past that the sequential default sampled once per group. Colours past the palette's capacity are NOT guaranteed to be told apart.

With a palette named, N is that palette's capacity. A named palette with NO overflow keeps the strict rule: too many groups is refused with E_CAP_EXCEEDED, because the caller asked for exactly those colours. Naming an overflow applies it instead.

Inherited from ​

EncodingSpec.overflow


palette? ​

readonly optional palette?: PaletteId

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:91

The palette.

Left off, the element picks one when the layer is painted, from the groups the run actually produced: a ramp for a measurement, and for groups the smallest palette in the catalogue that can name them all. Named, it is honoured as named -- and refused if the run has more groups than it has colours, because a categorical palette never wraps.

Inherited from ​

EncodingSpec.palette


range? ​

readonly optional range?: [number, number]

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:123

The numbers a numeric channel answers in, such as [1, 5] for a node size. On node.size and edge.width with no scale named, an amount defaults to [1, 3] -- the default size to three times it, the same range a column of amounts gets -- and that range is written into the layer. Anywhere else it defaults to the unit interval.

Inherited from ​

EncodingSpec.range


reverse? ​

readonly optional reverse?: boolean

Defined in: graphty-element/src/session/styles/EncodingSpec.ts:127

Send the smallest value to the far end of the range instead of the near end.

Inherited from ​

EncodingSpec.reverse


scale? ​

readonly optional scale?: "linear" | string & object | "ordinal" | "log" | "neglog10" | "sqrt" | "pow" | "bins" | "quantile" | "passthrough"

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

The scale to read the values through. Defaults to one that suits the field.

Inherited from ​

EncodingSpec.scale