Objects
live example
Explore the API in the live example.
api reference
Objects()
Component implementing the objects feature. This feature allows for inserting various SVG elements to the background of a chart. When this component is available for a widget, its API is exposed via the
.objects
namespace.Objects.add(id, obj, pos, options[, duration])
Adds an SVG element to the widget using internal (data level) or widget coordinates.
Parameters
Name | Type | Description |
---|---|---|
id | string | Unique identifier of the object to add. If an object with the ID already exists, it is updated with the new parameters. |
obj | Element | The SVG HTML element to insert to the widget. |
pos | Object | Object representing the x and y coordinates of the point to add the object at. The coordinates are used as the widget's internal (data) coordinates. |
options | Object | Options of inserting the object. Supported values:
|
duration | number | optionalDuration of the insert animation. Default value is 0 . |
Returns
Widget
Reference to the Widget's API.
Objects.remove(id[, duration])
Removes one or all objects from the widget.
Parameters
Name | Type | Description |
---|---|---|
id | Identifier of the object to remove. If not specified or null, all objects are removed. | |
duration | number | optionalDuration of the removal animation. Default value is 0 . |
Returns
Widget
Reference to the Widget's API.
Objects.svg()
Returns a D3 selection to an invisible SVG that can be used to draw an object to add. Useful if you want to use D3's simple chainable API to create objects to add.
Returns
Selection
D3 selection to the Objects API SVG.