Scene
extends Group
The Scene class represents the top-level container in a visualization. This is where graphical objects (i.e., mark or group) are created, transformed and joined with data. To create a scene object, use the scene function:
let scene = msc.scene();
Properties
| property | explanation | type | default value |
|---|---|---|---|
| fillColor | the background color of the scene | Color | “white” |
Properties inherited from Group
| property | explanation | type | default value |
|---|---|---|---|
bounds ![]() | the bounding rectangle of the group | Rectangle | |
children ![]() | the graphical objects in the group | Array | [] |
firstChild ![]() | the first child in the group | Mark or Group | |
id ![]() | the unique id of the group | String | |
type ![]() | the type of the group | String | “scene” |
Methods: Create Mark or Glyph
| method | explanation | return type |
|---|---|---|
| glyph(…marks) | create a new glpyh with the specified marks as children marks (Marks): primitive marks as part of the glyph | Glyph |
| mark(type, props) | create a new mark with the specified type and properties type (String): mark type props (Object): property names and values | Mark |
Methods: Create Guides
| method | explanation | return type |
|---|---|---|
| axis(channel, attribute, params) | create an axis channel (String): the visual channel attribute (String): the data attribute params (Object, optional): contains one or more of the axis properties | Axis |
| gridlines(channel, attribute, params) | create a set of gridlines channel (String): the visual channel attribute (String): the data attribute params (Object, optional): contains one or more of the gridline properties | Gridlines |
| legend(channel, attribute, params) | create a legend channel (String): the visual channel attribute (String): the data attribute params (Object, optional): contains one or more of the legend properties | Legend |
Methods: Manage and Manipulate Items
| method | explanation | return type |
|---|---|---|
| setProperties(item, params) | set the properties for all the peers of the specified item, return an object indicating setting each property is successful. item (Mark or Group or Layout): example item params (Object): property names as object keys and property values as object values | {property: Boolean} |
| sortChildren(item, property, descending, orderedVals) | sort the children in a Group or the vertices in a Path by the specified property item (Group or Path): object to sort property (String): property to sort by descending (Boolean, optional): setting to true will sort in descending order orderedVals (Array, optional): an array of values in ascending order | void |
| translate(item, dx, dy) | move the item by the given distance, returns an object indicating if translating along x or y is successful. item (Mark or Group): item to move dx (Number): number of pixels to move in the x direction dy (Number): number of pixels to move in the y direction | {x: Boolean, y: Boolean} |
Methods: Specify Constraints
These constraint operations are now documented as standalone functions on the Specify Constraints and Connections page.
Methods inherited from Group
| method | explanation | return type |
|---|---|---|
| addChild(c) | adds an object to the group | void |
| addChildAt(c, i) | adds an object to the group at the specified index | void |
| removeAll() | removes all the children from the group | void |
| removeChild(c) | removes the specified object from the group | void |
