Skip to content

@graphty/graph-io / styles / Mapping

Type Alias: Mapping ​

Mapping = { by: ColumnRef; kind: "passthrough"; } | { by: ColumnRef; kind: "discrete"; table: readonly readonly [Scalar, StyleValue][]; } | { by: ColumnRef; kind: "continuous"; points: readonly ContinuousPoint[]; step?: number; }

Defined in: styles/types.ts:1032

How a rule turns an element's value into a style value. A discrete table's absent key, a passthrough's null and a continuous mapping over a missing or non-numeric value give no result, and the rules beneath decide. Open union.

Union Members ​

Type Literal ​

{ by: ColumnRef; kind: "passthrough"; }

by ​

readonly by: ColumnRef

The column read.

kind ​

readonly kind: "passthrough"

The column's value is the style value.


Type Literal ​

{ by: ColumnRef; kind: "discrete"; table: readonly readonly [Scalar, StyleValue][]; }

by ​

readonly by: ColumnRef

The column read.

kind ​

readonly kind: "discrete"

A table from the column's value to the style value.

table ​

readonly table: readonly readonly [Scalar, StyleValue][]

[key, style value] pairs; a list value matches by its first item that has an entry.


Type Literal ​

{ by: ColumnRef; kind: "continuous"; points: readonly ContinuousPoint[]; step?: number; }

by ​

readonly by: ColumnRef

The column read; it must hold numbers.

kind ​

readonly kind: "continuous"

Points between which numbers and colors are interpolated.

points ​

readonly points: readonly ContinuousPoint[]

The points, in increasing at.

step? ​

readonly optional step?: number

When set, a number the mapping gives is rounded to the nearest multiple of step, as the writing tool draws a property that holds whole numbers (Cytoscape's font size: 1; its 0..255 transparency: 1/255).