@@ -3,15 +3,57 @@ import type {CurveAutoOptions} from "../curve.js";
3
3
import type { Data , MarkOptions , RenderableMark } from "../mark.js" ;
4
4
import type { MarkerOptions } from "../marker.js" ;
5
5
6
+ /** Options for the link mark. */
6
7
export interface LinkOptions extends MarkOptions , MarkerOptions , CurveAutoOptions {
8
+ /** The horizontal position, for vertical links; bound to the *x* scale. */
7
9
x ?: ChannelValueSpec ;
10
+ /** The vertical position, for horizontal links; bound to the *x* scale. */
8
11
y ?: ChannelValueSpec ;
12
+ /** The starting horizontal position; bound to the *x* scale. */
9
13
x1 ?: ChannelValueSpec ;
14
+ /** The ending vertical position; bound to the *y* scale. */
10
15
y1 ?: ChannelValueSpec ;
16
+ /** The starting horizontal position; bound to the *x* scale. */
11
17
x2 ?: ChannelValueSpec ;
18
+ /** The ending vertical position; bound to the *y* scale. */
12
19
y2 ?: ChannelValueSpec ;
20
+ /**
21
+ * The **curve** option controls interpolation between points. Since a link
22
+ * always has two points by definition, only the following curves (or a custom
23
+ * curve) are recommended: *linear*, *step*, *step-after*, *step-before*,
24
+ * *bump-x*, or *bump-y*. Note that the *linear* curve is incapable of showing
25
+ * a fill since a straight line has zero area. For a curved link, you can use
26
+ * a bent [arrow](#arrow) (with no arrowhead, if desired).
27
+ */
28
+ curve ?: CurveAutoOptions [ "curve" ] ;
13
29
}
14
30
31
+ /**
32
+ * The link mark draws line segments (or curves) connecting pairs of points. For
33
+ * example, to draw a link connecting the situation in 1980 with the situation
34
+ * in 2015 on a scatterplot representing the population and inequality of
35
+ * revenues in U.S. cities:
36
+ *
37
+ * ```js
38
+ * Plot.link(inequality, {x1: "POP_1980", y1: "R90_10_1980", x2: "POP_2015", y2: "R90_10_2015"})
39
+ * ```
40
+ *
41
+ * The following channels are required:
42
+ *
43
+ * - **x1** - the starting horizontal position; bound to the *x* scale
44
+ * - **y1** - the starting vertical position; bound to the *y* scale
45
+ * - **x2** - the ending horizontal position; bound to the *x* scale
46
+ * - **y2** - the ending vertical position; bound to the *y* scale
47
+ *
48
+ * For vertical or horizontal links, the **x** option can be specified as
49
+ * shorthand for **x1** and **x2**, and the **y** option can be specified as
50
+ * shorthand for **y1** and **y2**, respectively.
51
+ *
52
+ * The link mark supports **curve** options to control interpolation between
53
+ * points, and **marker** options to add a marker (such as a dot or an
54
+ * arrowhead) on each of the control points.
55
+ */
15
56
export function link ( data ?: Data , options ?: LinkOptions ) : Link ;
16
57
58
+ /** The link mark. */
17
59
export class Link extends RenderableMark { }
0 commit comments