Skip to content

@graphty/graphty-element / schema / LabelStyle

Interface: LabelStyle ​

Defined in: graphty-element/src/catalog/label-style.ts:66

How a label is drawn.

Properties ​

animation? ​

optional animation?: LabelAnimation

Defined in: graphty-element/src/catalog/label-style.ts:154

How the label moves.


animationSpeed? ​

optional animationSpeed?: number

Defined in: graphty-element/src/catalog/label-style.ts:156

How fast it moves, as a multiple of the animation's own speed.


attachOffset? ​

optional attachOffset?: number

Defined in: graphty-element/src/catalog/label-style.ts:115

How far from the node or edge it sits, in world units.


background? ​

optional background?: string

Defined in: graphty-element/src/catalog/label-style.ts:94

The colour of the panel behind the words.


badge? ​

optional badge?: LabelBadge

Defined in: graphty-element/src/catalog/label-style.ts:166

A badge drawn in place of, or beside, the words.


borderColor? ​

optional borderColor?: string

Defined in: graphty-element/src/catalog/label-style.ts:102

The colour of that border.


borderWidth? ​

optional borderWidth?: number

Defined in: graphty-element/src/catalog/label-style.ts:100

How thick a border is drawn around the panel; zero draws none.


color? ​

optional color?: string

Defined in: graphty-element/src/catalog/label-style.ts:87

The colour of the letters.


cornerRadius? ​

optional cornerRadius?: number

Defined in: graphty-element/src/catalog/label-style.ts:98

How far the panel's corners are rounded.


depthFade? ​

optional depthFade?: boolean

Defined in: graphty-element/src/catalog/label-style.ts:159

Whether the label fades out as the camera moves away from it.


depthFadeFar? ​

optional depthFadeFar?: number

Defined in: graphty-element/src/catalog/label-style.ts:163

How far away the camera has to be for the label to have faded out entirely.


depthFadeNear? ​

optional depthFadeNear?: number

Defined in: graphty-element/src/catalog/label-style.ts:161

How close the camera has to be for the label to be drawn at full strength.


enabled? ​

optional enabled?: boolean

Defined in: graphty-element/src/catalog/label-style.ts:78

Whether the label is drawn at all.

Writing the words through node.label or edge.label switches a label on. Written false, this switches one back OFF while leaving its text resolved -- which is how a layer hides labels on part of a graph without taking the words away from the layers under it.

Written true on node.labelStyle with no node.label anywhere in the stack, it switches node labels on with the element's own words, which are each node's id. A layer that only wants labels on never has to name an attribute to draw.


font? ​

optional font?: string

Defined in: graphty-element/src/catalog/label-style.ts:81

The typeface, as a CSS font family.


gradient? ​

optional gradient?: boolean

Defined in: graphty-element/src/catalog/label-style.ts:104

Whether the panel is filled with a gradient rather than a single colour.


gradientColors? ​

optional gradientColors?: readonly string[]

Defined in: graphty-element/src/catalog/label-style.ts:108

The colours the gradient runs through, in order.


gradientDirection? ​

optional gradientDirection?: LabelGradientDirection

Defined in: graphty-element/src/catalog/label-style.ts:110

Which way a linear gradient runs.


gradientType? ​

optional gradientType?: LabelGradientType

Defined in: graphty-element/src/catalog/label-style.ts:106

Whether that gradient runs in a line or out from the centre.


icon? ​

optional icon?: string

Defined in: graphty-element/src/catalog/label-style.ts:168

The glyph a badge draws when it is an icon badge.


iconPosition? ​

optional iconPosition?: LabelIconPosition

Defined in: graphty-element/src/catalog/label-style.ts:170

Which side of the words that icon sits on.


lineHeight? ​

optional lineHeight?: number

Defined in: graphty-element/src/catalog/label-style.ts:89

The gap between one line of text and the next, as a multiple of the font size.


location? ​

optional location?: LabelLocation

Defined in: graphty-element/src/catalog/label-style.ts:113

Where the label sits relative to its node or edge.


marginBottom? ​

optional marginBottom?: number

Defined in: graphty-element/src/catalog/label-style.ts:119

Empty space below the panel.


marginLeft? ​

optional marginLeft?: number

Defined in: graphty-element/src/catalog/label-style.ts:121

Empty space to the left of the panel.


marginRight? ​

optional marginRight?: number

Defined in: graphty-element/src/catalog/label-style.ts:123

Empty space to the right of the panel.


marginTop? ​

optional marginTop?: number

Defined in: graphty-element/src/catalog/label-style.ts:117

Empty space above the panel.


maxNumber? ​

optional maxNumber?: number

Defined in: graphty-element/src/catalog/label-style.ts:182

The largest number drawn in full before the suffix takes over.


outline? ​

optional outline?: string

Defined in: graphty-element/src/catalog/label-style.ts:139

The colour of an outline around each letter; writing one is what switches the outline on.


outlineWidth? ​

optional outlineWidth?: number

Defined in: graphty-element/src/catalog/label-style.ts:141

How thick that outline is drawn.


overflowSuffix? ​

optional overflowSuffix?: string

Defined in: graphty-element/src/catalog/label-style.ts:184

What is drawn after a shortened number.


padding? ​

optional padding?: number

Defined in: graphty-element/src/catalog/label-style.ts:96

How much room there is between the words and the edge of that panel.


pointer? ​

optional pointer?: boolean

Defined in: graphty-element/src/catalog/label-style.ts:126

Whether a speech-bubble pointer comes out of the panel.


pointerCurve? ​

optional pointerCurve?: boolean

Defined in: graphty-element/src/catalog/label-style.ts:136

Whether the pointer's sides are drawn as curves rather than straight lines.


pointerDirection? ​

optional pointerDirection?: LabelPointerDirection

Defined in: graphty-element/src/catalog/label-style.ts:128

Which side it comes out of.


pointerHeight? ​

optional pointerHeight?: number

Defined in: graphty-element/src/catalog/label-style.ts:132

How far the pointer reaches away from the panel.


pointerOffset? ​

optional pointerOffset?: number

Defined in: graphty-element/src/catalog/label-style.ts:134

How far along that side the pointer sits, from the middle.


pointerWidth? ​

optional pointerWidth?: number

Defined in: graphty-element/src/catalog/label-style.ts:130

How wide the pointer is where it meets the panel.


progress? ​

optional progress?: number

Defined in: graphty-element/src/catalog/label-style.ts:172

How full a progress badge is drawn, from 0 to 1.


shadow? ​

optional shadow?: boolean

Defined in: graphty-element/src/catalog/label-style.ts:143

Whether the letters cast a shadow.


shadowBlur? ​

optional shadowBlur?: number

Defined in: graphty-element/src/catalog/label-style.ts:147

How far the shadow is blurred.


shadowColor? ​

optional shadowColor?: string

Defined in: graphty-element/src/catalog/label-style.ts:145

The colour of that shadow.


shadowOffsetX? ​

optional shadowOffsetX?: number

Defined in: graphty-element/src/catalog/label-style.ts:149

How far the shadow is thrown to the right.


shadowOffsetY? ​

optional shadowOffsetY?: number

Defined in: graphty-element/src/catalog/label-style.ts:151

How far the shadow is thrown downwards.


sizePx? ​

optional sizePx?: number

Defined in: graphty-element/src/catalog/label-style.ts:83

How tall the letters are drawn on the label's own canvas.


smartOverflow? ​

optional smartOverflow?: boolean

Defined in: graphty-element/src/catalog/label-style.ts:180

Whether a number too large to show is shortened rather than drawn in full.

With this on, a label reading a count above LabelStyle.maxNumber is drawn as that maximum followed by LabelStyle.overflowSuffix -- 99+ rather than 1500.


textAlign? ​

optional textAlign?: LabelTextAlign

Defined in: graphty-element/src/catalog/label-style.ts:91

How the lines are lined up against each other.


weight? ​

optional weight?: number | "normal" | "bold"

Defined in: graphty-element/src/catalog/label-style.ts:85

How heavy the letters are.