Class: MosaicVgplotComponentManager
Manages multiple Mosaic vgplot components, providing lifecycle management and coordination between vgplot visualizations and Cosmograph.
Constructors
Constructor
new MosaicVgplotComponentManager(
internalApi):MosaicVgplotComponentManager
Parameters
| Parameter | Type |
|---|---|
internalApi | ICosmographInternalApi |
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
| Parameter | Type | Description |
|---|---|---|
component | HTMLElement | The vgplot component (e.g., from vg.plot(), vg.vconcat(), etc.) |
container | HTMLElement | The 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
| Parameter | Type | Description |
|---|---|---|
id | string | The 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>