public class Chord extends PathDataGenerator
While the default accessors assume that the chord dimensions are all specified dynamically, it is very common to set one or more of the dimensions as a constant, such as the radius. The returned function generates path data for a closed shape connecting two arcs with quadratic Bézier curves, as in a chord diagram:
A chord generator is often used in conjunction with an Arc
generator,
so as to draw annular segments at the start and end of the chords. In
addition, the Chord
layout is useful for
generating objects that describe a set of grouped chords from a matrix,
compatible with the default accessors.
Modifier | Constructor and Description |
---|---|
protected |
Chord() |
Modifier and Type | Method and Description |
---|---|
Chord |
endAngle(DatumFunction<Double> accessor)
Set the end angle accessor.
|
Chord |
endAngle(double endAngle)
Set the end angle as a constant in radians.
|
Chord |
radius(DatumFunction<Double> accessor)
Set the radius accessor.
|
Chord |
radius(double radius)
Set the radius as a constant.
|
Chord |
source(DatumFunction<?> accessor)
Set the source accessor.
|
Chord |
startAngle(DatumFunction<Double> accessor)
Set the start angle accessor.
|
Chord |
startAngle(double startAngle)
Set the start angle as a constant in radians.
|
Chord |
target(DatumFunction<?> accessor)
Set the target accessor.
|
generate, generate, generate, generate
public final Chord source(DatumFunction<?> accessor)
The purpose of the source accessor is to return an object that describes
the starting arc of the chord. The returned object is subsequently passed
to the radius(DatumFunction)
, startAngle(DatumFunction)
and endAngle(DatumFunction)
accessors.
This allows these other accessors to be reused for both the source and target arc descriptions.
The default accessor assumes that the input data is a JavaScriptObject with suitably-named attributes.
The source-accessor is invoked in the same manner as other value functions in D3.
accessor
- the function returning the source arc objectpublic final Chord target(DatumFunction<?> accessor)
The purpose of the target accessor is to return an object that describes
the ending arc of the chord. The returned object is subsequently passed
to the radius(DatumFunction)
, startAngle(DatumFunction)
and endAngle(DatumFunction)
accessors.
This allows these other accessors to be reused for both the source and target arc descriptions.
The default accessor assumes that the input data is a JavaScriptObject with suitably-named attributes.
The target-accessor is invoked in the same manner as other value functions in D3.
accessor
- the function returning the target arc objectpublic final Chord radius(DatumFunction<Double> accessor)
The default accessor assumes that the input source or target description is a JavaScriptObject with suitably-named attributes.
accessor
- the function returning the radiuspublic final Chord radius(double radius)
radius
- the radiuspublic final Chord startAngle(DatumFunction<Double> accessor)
Angles are specified in radians, even though SVG typically uses degrees.
The default accessor assumes that the input source or target description is a JavaScriptObject with suitably-named attributes.
accessor
- the function returning the start anglepublic final Chord startAngle(double startAngle)
Angles are specified in radians, even though SVG typically uses degrees.
startAngle
- the angle in radianspublic final Chord endAngle(DatumFunction<Double> accessor)
Angles are specified in radians, even though SVG typically uses degrees.
The default accessor assumes that the input source or target description is a JavaScriptObject with suitably-named attributes.
accessor
- the function returning the end anglepublic final Chord endAngle(double endAngle)
Angles are specified in radians, even though SVG typically uses degrees.
endAngle
- the angle in radiansCopyright © 2017 gwt-d3. All rights reserved.