JavaScript & React libraryAPI

Class: MosaicVgplotComponentManager

Manages multiple Mosaic vgplot components, providing lifecycle management and coordination between vgplot visualizations and Cosmograph.

Constructors

Constructor

new MosaicVgplotComponentManager(internalApi): MosaicVgplotComponentManager

Parameters

ParameterType
internalApiICosmographInternalApi

Returns

MosaicVgplotComponentManager

Accessors

components

Get Signature

get components(): ReadonlyMap<string, MosaicVgplotComponent>

Gets all registered vgplot components.

Returns

ReadonlyMap<string, MosaicVgplotComponent>

Methods

addComponent()

addComponent(component, container, config?): Promise<MosaicVgplotComponent>

Adds a custom vgplot component and mounts it to a container. If the component fails to mount (e.g., missing column), it will show an error in the container but won’t throw, allowing other components to continue.

Parameters

ParameterTypeDescription
componentHTMLElementThe vgplot component (e.g., from vg.plot(), vg.vconcat(), etc.)
containerHTMLElementThe DOM element to mount the component into
config?Partial<MosaicVgplotComponentConfig>Optional configuration for the component

Returns

Promise<MosaicVgplotComponent>

The created vgplot component (check component.errorMessage to see if it failed)


removeComponent()

removeComponent(id): Promise<boolean>

Removes and destroys a component by its ID.

Parameters

ParameterTypeDescription
idstringThe ID of the component to remove

Returns

Promise<boolean>

True if the component was found and removed, false otherwise


destroyAll()

destroyAll(): Promise<void>

Destroys all registered components.

Returns

Promise<void>