Arc

extends Path

The Arc class represents a sector mark that is used in a Doughnut Chart and a Sunburst Chart. This class is also used to represent a pie mark that is used in a pie chart. A pie is a special arc where the inner radius is 0. To create an Arc object, use the mark method in the Scene class, for example:

    let arc = scene.mark("arc", {x: 100, y: 100, innerRadius: 20, outerRadius: 40, startAngle: 0, endAngle: 90});

You can also use the divide operation to transform a Ring to a collection of Arc objects, or transform a Circle to a collection of pie marks. Here is an explanation of the divide operation.

Properties

propertyexplanationtypedefault value
angle the angle between the start angle and the end angle in degreesNumber90
direction the direction in which the arc is drawnString“anti-clockwise”
endAngle the end angle of the arc in degreesNumber90
innerRadius the inner radius of the arcNumber100
outerRadius the outer radius of the arcNumber200
startAngle the start angle of the arc in degreesNumber0
thickness the difference between the outer radius and inner radiusNumber100
x the x coordinate of the center of the arcNumber100
y the y coordinate of the center of the arcNumber100

Angles in Mascot are specified using the polar coordinate system, where 0 is at the positive x axis, and the angle increases in the counterclockwise direction. The figure below illustrates various values of startAngle and endAngle.

start angle and end angle for an arc

The same applies to a pie mark as well:

start angle and end angle for a pie

Properties inherited from Path

propertyexplanationtypedefault value
anyVertex returns any vertex of the pathVertex
firstSegment returns the first segment of the pathSegment
firstVertex returns the first vertex of the pathVertex
segments the segments on the pathArray of Segment
vertices the vertices along the pathArray of Vertex
vxFillColorthe fill color of the vertices on this pathColor“#555555”
vxHeightthe height of the vertices on this pathNumber0
vxOpacitythe opacity of the vertices on this pathNumber1
vxRadiusthe radius of the vertices on this path if the shape is “circle”Number0
vxShapethe shape of the vertices on this path
possible values: “rect”, “circle”
Stringundefined
vxStrokeColorthe stroke color of the vertices on this pathColor“#aaaaaa”
vxStrokeWidththe stroke width of the vertices on this path in pixelsNumber0
vxWidththe width of the vertices on this pathNumber0

Properties inherited from Mark

propertyexplanationtypedefault value
bounds the bounding rectangle of the markRectangle
dataScopethe data scope of the markDataScopeundefined
fillColorthe fill color of the markColor“none”
id the unique id of the markString
opacitythe opacity value of the mark (between 0 and 1)Number1
strokeColorthe stroke color of the markColor“#ccc”
strokeDashthe dashes and gaps for the mark strokeString“none”
strokeWidththe stroke width of the mark in pixelsNumber1
type the type of the mark (“arc” or “pie” when innerRadius is 0)String“arc”
visibilitywhether the mark is visible (“visible” or “hidden”)String“visible”

Methods

methodexplanationreturn type
getSVGPathData()returns a string to be used as the d parameter in an SVG path elementString
setAngles(startAngle, endAngle)set the start angle and the end angle
startAngle (Number): start angle in degrees
endAngle (Number): end angle in degrees
void