Top-level Functions

Top-level functions are defined in the msc namespace.

Create Objects

functionexplanationreturn type
msc.scene(params)create a scene
params (Object, optional): contains the following parameter
  • fillColor: background color of the scene
Scene
async msc.csv(url)import a CSV file as a data table
url (String): path to the file
Promise
async msc.csvFromString(data, name)import CSV data in a string as a data table
data (String): CSV data in a string
name (String): name of the data
Promise
msc.layout(type, params)create a layout
type: layout type
params (Object): contains layout properties
Layout
msc.linearGradient(params)create a linear gradient
params (Object): contains x1, y1, x2 and y2 properties
LinearGradient
msc.renderer(type, domId)create a renderer
type (String): type of renderer,
possible values: “svg”, “webgl”
domId (String): ID of the SVG or Canvas element
Renderer

Helper Functions

functionexplanationreturn type
msc.cartesianToPolar(x, y, cx, cy)converts a point in Cartesian space to polar coordinates
x (Number): x coordinate in Cartesian space
y (Number): y coordinate in Cartesian space
cx (Number): x coordinate of the polar center
cy (Number): y coordinate of the polar center
[angele (in degrees),
distance from center]
msc.polarToCartesian(cx, cy, r, deg)converts a point in polar space to Cartesian coordinates
cx (Number): x coordinate of the polar center
cy (Number): y coordinate of the polar center
r (Number): distance from the polar center
deg (Number): angle in degrees in the polar space
[x, y]