Any side effect which will add any new element to the chart like drawing a rectangular box or any annotation over
the chart needs to inherit this class. This class has methods which returns the container where the dom elements
needs to be created.
To use this,
```
const SpawnableSideEffect = muze.SideEffects.standards.SpawnableSideEffect;
class SelectionBox extends SpawnableSideEffect {
static formalName () {
return 'selectionBox';
}
// Implement the logic of applying the style here.
apply () {
}
}
```
Methods
createElement(container, elemType, data, className) → {Selection}
Creates a html or svg element in the container.
Parameters:
Name | Type | Description |
---|---|---|
container |
SVGElement | HTMLElement | Container where the dom element will be rendered. |
elemType |
string | Type of dom element. |
data |
Array | Array of objects with which the dom elements will be binded. |
className |
string | class name of the element. |
Returns:
D3 Selection of the element.
- Type
- Selection
drawingContext() → {Object}
Returns the drawing information for side effect like svg container, dimensions of the visual unit.
Returns:
Drawing information for side effect.
```
sideEffectGroup: // svg container where the side effect needs to be appended.
svgContainer: // svg container of the VisualUnit.
htmlContainer: // html div container of the VisualUnit.
width: // Width of the VisualUnit
height: // Height of the VisualUnit
```
- Type
- Object