Skip to content
pyautark (soon)

@urban-toolkit/autk-plot


@urban-toolkit/autk-plot / PlotBaseInteractive

Abstract Class: PlotBaseInteractive

Defined in: plot-base-interactive.ts:29

Interactive plot base class.

Extends PlotBaseData with selection state, click/brush wiring, and mark highlighting behavior shared by interactive plots.

Extends

Constructors

Constructor

new PlotBaseInteractive(config): PlotBaseInteractive

Defined in: plot-base-interactive.ts:66

Initializes interactive plot state on top of the shared data lifecycle.

Parameters

config

PlotConfig

Plot configuration including optional interaction events.

Returns

PlotBaseInteractive

Throws

If configured bindings are missing or invalid (delegated to PlotBaseData).

Overrides

PlotBaseData.constructor

Properties

_axisLabels

protected _axisLabels: string[]

Defined in: plot-base-data.ts:61

User-facing axis labels.

Inherited from

PlotBaseData._axisLabels


_categoricalColorMapInterpolator

protected _categoricalColorMapInterpolator: ColorMapInterpolator = ColorMapInterpolator.CAT_OBSERVABLE10

Defined in: plot-base-data.ts:91

Color interpolator used when the color attribute contains categorical (string) values.

Inherited from

PlotBaseData._categoricalColorMapInterpolator


_colorMapInterpolator

protected _colorMapInterpolator: ColorMapInterpolator = ColorMapInterpolator.SEQ_REDS

Defined in: plot-base-data.ts:89

Color interpolator used for continuous (numeric) color encoding.

Inherited from

PlotBaseData._colorMapInterpolator


_colorProperty

protected _colorProperty: "fill" | "stroke" = 'fill'

Defined in: plot-base-interactive.ts:33

CSS property used when applying colors to marks.


_data

protected _data: object & object[]

Defined in: plot-base-data.ts:54

Normalized render rows bound to marks.

Inherited from

PlotBaseData._data


_div

protected _div: HTMLElement

Defined in: plot-base-data.ts:49

Host element where the plot is rendered.

Inherited from

PlotBaseData._div


_domainSpec

protected _domainSpec: ColorMapDomainSpec | undefined = undefined

Defined in: plot-base-data.ts:87

Domain specification for color encoding (from config).

Inherited from

PlotBaseData._domainSpec


_enabledEvents

protected _enabledEvents: PlotEvent[] = []

Defined in: plot-base-interactive.ts:31

Interaction events explicitly enabled for the plot instance.


_height

protected _height: number = 500

Defined in: plot-base-data.ts:76

Outer plot height in pixels.

Inherited from

PlotBaseData._height


_margins

protected _margins: PlotMargins

Defined in: plot-base-data.ts:78

Plot margins in pixels.

Inherited from

PlotBaseData._margins


_MODE

protected _MODE: "and" | "or" = 'and'

Defined in: plot-base-interactive.ts:58

Brush combine mode for multi-brush interactions.

and requires all active brushes to contain a mark; or allows any brush to include it.


_resolvedDomain

protected _resolvedDomain: ResolvedDomain | undefined = undefined

Defined in: plot-base-data.ts:81

Resolved color domain, computed from data after each transform.

Inherited from

PlotBaseData._resolvedDomain


_sourceFeatures

protected _sourceFeatures: Feature<Geometry, GeoJsonProperties>[]

Defined in: plot-base-data.ts:52

Original source features from the input collection, indexed by source feature id.

Inherited from

PlotBaseData._sourceFeatures


_tickFormats

protected _tickFormats: string[]

Defined in: plot-base-data.ts:71

D3 tick-format specifiers used by axis renderers.

Inherited from

PlotBaseData._tickFormats


_title

protected _title: string

Defined in: plot-base-data.ts:69

Plot title text.

Inherited from

PlotBaseData._title


_transformAttributes

protected _transformAttributes: string[] | undefined = undefined

Defined in: plot-base-data.ts:59

Dot-path attributes used to read values from transformed rows, when applicable.

Inherited from

PlotBaseData._transformAttributes


_transformColorAttribute

protected _transformColorAttribute: string | null | undefined = undefined

Defined in: plot-base-data.ts:66

Dot-path attribute used for color encoding on transformed rows, when applicable.

Inherited from

PlotBaseData._transformColorAttribute


_transformConfig?

protected optional _transformConfig?: PlotTransformConfig

Defined in: plot-base-data.ts:84

Optional transform config shared by plot implementations that support transformed views.

Inherited from

PlotBaseData._transformConfig


_width

protected _width: number = 800

Defined in: plot-base-data.ts:74

Outer plot width in pixels.

Inherited from

PlotBaseData._width

Accessors

events

Get Signature

get events(): EventEmitter<PlotEventRecord>

Defined in: plot-base-interactive.ts:83

Returns the typed event emitter used by this plot instance.

Returns

EventEmitter<PlotEventRecord>


renderAxisAttributes

Get Signature

get protected renderAxisAttributes(): string[]

Defined in: plot-base-data.ts:293

Returns the active axis bindings for rendered rows.

Returns

string[]

Inherited from

PlotBaseData.renderAxisAttributes


renderColorAttribute

Get Signature

get protected renderColorAttribute(): string | undefined

Defined in: plot-base-data.ts:300

Returns the active color binding for rendered rows.

Returns

string | undefined

Inherited from

PlotBaseData.renderColorAttribute


selection

Get Signature

get selection(): number[]

Defined in: plot-base-interactive.ts:76

Returns the active selection as source feature ids.

Returns

number[]

Methods

afterDataRefresh()

protected afterDataRefresh(): void

Defined in: plot-base-interactive.ts:124

Rehydrates local aggregated mark selection after _data is rebuilt.

Returns

void

Overrides

PlotBaseData.afterDataRefresh


applyMarkStyles()

protected applyMarkStyles(svgs): void

Defined in: plot-base-interactive.ts:406

Applies interaction-aware styling to rendered marks.

Parameters

svgs

Selection<BaseType, unknown, HTMLElement, unknown>

Selection containing rendered mark nodes.

Returns

void


brushEvent()

protected brushEvent(): void

Defined in: plot-base-interactive.ts:263

Enables 2D rectangular brushing interactions.

Returns

void


brushXEvent()

protected brushXEvent(): void

Defined in: plot-base-interactive.ts:297

Enables horizontal brushing interactions.

Returns

void


brushYEvent()

protected brushYEvent(): void

Defined in: plot-base-interactive.ts:339

Enables vertical brushing interactions.

Returns

void


clickEvent()

protected clickEvent(): void

Defined in: plot-base-interactive.ts:231

Enables click-based selection for .autkMark nodes and clear overlays.

Returns

void


computeColorDomain()

protected computeColorDomain(): void

Defined in: plot-base-data.ts:324

Computes and caches the active color domain from rendered rows.

Returns

void

Inherited from

PlotBaseData.computeColorDomain


configureSignalListeners()

configureSignalListeners(): void

Defined in: plot-base-interactive.ts:133

Attaches interaction handlers requested by the plot configuration.

Returns

void

Throws

Never throws.


draw()

draw(): void

Defined in: plot-base-data.ts:152

Rebuilds source rows, applies transforms, validates bindings, and delegates rendering.

Returns

void

Throws

If active render bindings do not resolve on the rendered data.

Inherited from

PlotBaseData.draw


getMarkColor()

protected getMarkColor(d): string

Defined in: plot-base-interactive.ts:155

Resolves the color for a rendered mark datum.

Selection highlight takes precedence over data-driven color encoding.

Parameters

d

unknown

Bound datum for the mark.

Returns

string

CSS color string for the mark.


isMarkHighlighted()

protected isMarkHighlighted(d): boolean

Defined in: plot-base-interactive.ts:204

Returns whether a rendered mark should be highlighted.

Parameters

d

unknown

Bound datum for the mark.

Returns

boolean

true when the mark belongs to the active selection.


markIntersectsRect()

protected markIntersectsRect(node, x0, y0, x1, y1): boolean

Defined in: plot-base-interactive.ts:456

Tests whether a rendered mark intersects the supplied brush rectangle.

Parameters

node

SVGGeometryElement

SVG geometry node representing the mark.

x0

number

First rectangle x coordinate.

y0

number

First rectangle y coordinate.

x1

number

Second rectangle x coordinate.

y1

number

Second rectangle y coordinate.

Returns

boolean

true when the mark intersects the rectangle.


nodeIntersectsRect()

protected nodeIntersectsRect(node, x0, y0, x1, y1): boolean

Defined in: plot-base-interactive.ts:474

Tests a generic SVG geometry node against a brush rectangle.

Parameters

node

SVGGeometryElement

SVG geometry node representing the mark.

x0

number

First rectangle x coordinate.

y0

number

First rectangle y coordinate.

x1

number

Second rectangle x coordinate.

y1

number

Second rectangle y coordinate.

Returns

boolean

true when the node intersects the rectangle.


onSelectionUpdated()

protected onSelectionUpdated(): void

Defined in: plot-base-interactive.ts:413

Hook invoked after mark selection styles have been refreshed.

Returns

void


render()

abstract render(): void

Defined in: plot-base-data.ts:267

Renders plot DOM, SVG, or HTML nodes for the current internal state.

Returns

void

Inherited from

PlotBaseData.render


renderSelection()

protected renderSelection(): void

Defined in: plot-base-interactive.ts:395

Refreshes rendered marks to reflect the current selection state.

Returns

void


resolveSelectionFromRects()

protected resolveSelectionFromRects(activeBrushes): number[]

Defined in: plot-base-interactive.ts:421

Resolves selected source ids by testing rendered marks against brush rectangles.

Parameters

activeBrushes

Map<string, [number, number, number, number]>

Active brush rectangles keyed by brush host id.

Returns

number[]

Selected source feature ids.


resolveTransformResult()

protected resolveTransformResult(result): ResolvedPlotTransform

Defined in: plot-base-data.ts:276

Maps a preset-specific executed transform into the rendered row schema expected by plot implementations.

Parameters

result

ExecutedPlotTransform

Executed transform payload returned by the shared dispatcher.

Returns

ResolvedPlotTransform

Normalized rendered rows plus any transformed binding metadata.

Inherited from

PlotBaseData.resolveTransformResult


setRenderColorAttribute()

protected setRenderColorAttribute(attribute): void

Defined in: plot-base-data.ts:312

Updates the active render-time color binding.

Parameters

attribute

string | undefined

Dot-path attribute to use for color, or undefined to clear it.

Returns

void

Inherited from

PlotBaseData.setRenderColorAttribute


setSelection()

setSelection(selection): void

Defined in: plot-base-interactive.ts:110

Applies an externally authored selection to the plot.

Parameters

selection

number[]

Source feature ids to highlight.

Returns

void

Throws

Never throws.


updateCollection()

updateCollection(collection): void

Defined in: plot-base-interactive.ts:93

Replaces the source collection, clears interaction state, and redraws.

Parameters

collection

FeatureCollection<Geometry, GeoJsonProperties>

New GeoJSON collection to render.

Returns

void

Throws

Never throws.

Released under the MIT License.