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

propertyexplanationtypedefault value
fillColorthe background color of the sceneColor“white”

Properties inherited from Group

propertyexplanationtypedefault value
bounds the bounding rectangle of the groupRectangle
children the graphical objects in the groupArray[]
firstChild the first child in the groupMark or Group
id the unique id of the groupString
type the type of the groupString“scene”

Methods: Create Mark or Glyph

methodexplanationreturn 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

methodexplanationreturn 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

methodexplanationreturn 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

methodexplanationreturn type
addChild(c)adds an object to the groupvoid
addChildAt(c, i)adds an object to the group at the specified indexvoid
removeAll()removes all the children from the groupvoid
removeChild(c)removes the specified object from the groupvoid