Arc

An Arc shape that extends the Shape class.

An Arc is a portion of a circle defined by its center coordinates, width (horizontal diameter), height (vertical diameter), starting angle, and extent (the angular span of the arc) in degrees.

Constructor

new Arc(strokeopt, backgroundopt, opacityopt, xopt, yopt, widthopt, heightopt, startAngleopt, extentopt)

Creates an instance of Arc shape.

Parameters:
NameTypeAttributesDefaultDescription
strokeStroke<optional>

A border of the shape.

backgroundstring<optional>

Color, gradient, or image background, similar to CSS. Use an empty string to remove the background.

opacitynumber<optional>
1

Opacity of the shape (0 to 1).

xnumber<optional>
0

Horizontal position from the left edge.

ynumber<optional>
0

Vertical position from the top edge.

widthnumber<optional>
100

Width of the arc (horizontal diameter).

heightnumber<optional>

Height of the arc (vertical diameter). If omitted, height will be same as width.

startAnglenumber<optional>
0

Starting angle of the arc (0 to 360 degrees).

extentnumber<optional>
360

How much of the arc to remove (0 to 360 degrees).

Classes

Arc

Members

(readonly) Type :number

Enum for arc drawing types: Pie and Chord.

Type:
  • number
Properties
NameTypeDescription
Chordnumber

Draws the arc as a straight chord between the start and end points.

Pienumber

Draws the arc as a pie shape (arc connected to the center).

Example
Arc.Type.Pie

Methods

extent(extentopt) → {number|Arc}

Sets or gets an extent value of the Arc. Extent defines how much of the arc is removed by setting an angle between 0 and 360.

Parameters:
NameTypeAttributesDescription
extentnumber<optional>

Extent value between 0 and 360.

Returns:

If called without parameters, current value is returned; otherwise this Arc object is returned.

Type: 
number | Arc

holeSize(width, heightopt) → {Object|Arc}

Sets or gets the size of the hollow space inside the arc. The hole make it look more like a donut.

Parameters:
NameTypeAttributesDescription
widthnumber | Object

Width of the hole (horizontal diameter), or a size object (e.g., {width:50,height:50}).

heightnumber<optional>

Height of the hole (vertical diameter).

Returns:

If called without parameters, current hole size is returned; otherwise this Arc object is returned.

Type: 
Object | Arc

size(width, heightopt) → {Object|Arc}

Sets or gets the size of the arc (horizontal and vertical diameter).

Parameters:
NameTypeAttributesDescription
widthnumber | Object

Width of the arc (horizontal diameter), or a size object (e.g., {width:300,height:300}).

heightnumber<optional>

Height of the arc (vertical diameter).

Returns:

If called without parameters, current size is returned; otherwise this Arc object is returned.

Type: 
Object | Arc

startAngle(angleopt) → {number|Arc}

Gets or sets the starting angle of the arc.

The starting angle defines where the arc begins, measured in degrees from the positive x-axis in a clockwise direction.

Parameters:
NameTypeAttributesDescription
anglenumber<optional>

Sets the start angle (0 to 360 degrees).

Returns:

Returns the current start angle if no parameter is given, otherwise returns the Arc instance for chaining.

Type: 
number | Arc

toObject(includeopt) → {object}

Returns a JSON object that contains this shape properties. It may be converted back to this shape.

Parameters:
NameTypeAttributesDefaultDescription
includestring<optional>
"all"

Specified what to include. "all" is default. Valid values are: "all", "stroke", "background", "points", "basic".

Returns:

Returns an object containing this shape's properties.

Type: 
object

type(typeopt) → {Arc.Type|Arc}

Sets or gets the type of the arc to Arc.Type.Chord or Arc.Type.Pie

Parameters:
NameTypeAttributesDescription
typeArc.Type<optional>

One of the type values: Arc.Type.Pie, Arc.Type.Chord

Returns:

If called without parameters, current type is returned; otherwise this Arc object is returned.

Type: 
Arc.Type | Arc