Arc class Arcs
The arc generator produces a circular or annular sector, as in a pie or donut chart.
Arcs are centered at the origin; use a transform to move the arc to a different position.
svg.append("path")
.attr("transform", "translate(100,100)")
.attr("d", Arc.withDefaults()([{
"innerRadius": 100,
"outerRadius": 200,
"startAngle": -pi / 2,
"endAngle": pi / 2
}]));
If the absolute difference between the startAngle and the endAngle (the angular span) is greater than 2π, the arc generator will produce a complete circle or annulus. If it is less than 2π, the arc’s angular length will be equal to the absolute difference between the two angles (going clockwise if the signed difference is positive and anticlockwise if it is negative). If the absolute difference is less than 2π, the arc may have rounded corners (see cornerRadius) and angular padding (see padAngle).
See also the Pie generator, which computes the necessary angles to represent an array of data as a pie or donut chart; these angles can then be passed to an arc generator.
Constructors
-
Arc({required num innerRadius(Arc, [List<
Object?> ?]), required num outerRadius(Arc, [List<Object?> ?]), num cornerRadius(Arc, [List<Object?> ?])?, required num startAngle(Arc, [List<Object?> ?]), required num endAngle(Arc, [List<Object?> ?]), required num padAngle(Arc, [List<Object?> ?]), num padRadius(Arc, [List<Object?> ?])?}) -
Constructs a new arc generator with the given
innerRadius
,outerRadius
,cornerRadius
,startAngle
,endAngle
,padAngle
, and, optionally,padRadius
accessors. - Arc.withConstants({required num innerRadius, required num outerRadius, num? cornerRadius, required num startAngle, required num endAngle, required num padAngle, num? padRadius})
-
Constructs a new arc generator with the given
innerRadius
,outerRadius
,cornerRadius
,startAngle
,endAngle
,padAngle
, and, optionally,padRadius
numbers.
Properties
- context ↔ Path?
-
Optional context for rendering the generated link (see Arc.call) as a
sequence of
path method calls.
getter/setter pair
-
cornerRadius
↔ num Function(Arc, [List<
Object?> ?]) -
The corner radius accessor.
getter/setter pair
- digits ↔ num?
-
The maximum number of digits after the decimal separator.
getter/setter pairinherited-setter
-
endAngle
↔ num Function(Arc, [List<
Object?> ?]) -
The end angle accessor.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
innerRadius
↔ num Function(Arc, [List<
Object?> ?]) -
The inner radius accessor.
getter/setter pair
-
outerRadius
↔ num Function(Arc, [List<
Object?> ?]) -
The outer radius accessor.
getter/setter pair
-
padAngle
↔ num Function(Arc, [List<
Object?> ?]) -
The pad angle accessor.
getter/setter pair
-
padRadius
↔ num Function(Arc, [List<
Object?> ?])? -
The pad radius accessor.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
startAngle
↔ num Function(Arc, [List<
Object?> ?]) -
The start angle accessor.
getter/setter pair
Methods
-
call(
[List< Object?> ? args]) → String? -
Generates an arc for the given
args
. -
centroid(
[List< Object?> ? args]) → List<num> - Computes the midpoint [x, y] of the center line of the arc that would be generated (see Arc.call) by the given arguments.
-
constCornerRadius(
num cornerRadius) → void - Defines the Arc.cornerRadius-accessor as a constant function that always returns the specified value.
-
constEndAngle(
num endAngle) → void - Defines the Arc.endAngle-accessor as a constant function that always returns the specified value.
-
constInnerRadius(
num innerRadius) → void - Defines the Arc.innerRadius-accessor as a constant function that always returns the specified value.
-
constOuterRadius(
num outerRadius) → void - Defines the Arc.outerRadius-accessor as a constant function that always returns the specified value.
-
constPadAngle(
num padAngle) → void - Defines the Arc.padAngle-accessor as a constant function that always returns the specified value.
-
constPadRadius(
num padRadius) → void - Defines the Arc.padRadius-accessor as a constant function that always returns the specified value.
-
constStartAngle(
num startAngle) → void - Defines the Arc.startAngle-accessor as a constant function that always returns the specified value.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
withDefaults(
{num innerRadius(Arc, [List< Object?> ?]) = arcInnerRadius, num outerRadius(Arc, [List<Object?> ?]) = arcOuterRadius, num cornerRadius(Arc, [List<Object?> ?])?, num startAngle(Arc, [List<Object?> ?]) = arcStartAngle, num endAngle(Arc, [List<Object?> ?]) = arcEndAngle, num padAngle(Arc, [List<Object?> ?]) = arcPadAngle, num padRadius(Arc, [List<Object?> ?])?}) → Arc - Constructs a new arc generator with the default settings.