@@ -3,15 +3,75 @@ 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
+ /**
9
+ * The horizontal position, for vertical links; typically bound to the *x*
10
+ * scale; shorthand for setting defaults for both **x1** and **x2**.
11
+ */
7
12
x ?: ChannelValueSpec ;
13
+
14
+ /**
15
+ * The vertical position, for horizontal links; typically bound to the *y*
16
+ * scale; shorthand for setting defaults for both **y1** and **y2**.
17
+ */
8
18
y ?: ChannelValueSpec ;
19
+
20
+ /**
21
+ * The starting horizontal position; typically bound to the *x* scale; also
22
+ * sets a default for **x2**.
23
+ */
9
24
x1 ?: ChannelValueSpec ;
25
+
26
+ /**
27
+ * The starting vertical position; typically bound to the *y* scale; also sets
28
+ * a default for **y2**.
29
+ */
10
30
y1 ?: ChannelValueSpec ;
31
+
32
+ /**
33
+ * The ending horizontal position; typically bound to the *x* scale; also sets
34
+ * a default for **x1**.
35
+ */
11
36
x2 ?: ChannelValueSpec ;
37
+
38
+ /**
39
+ * The ending vertical position; typically bound to the *y* scale; also sets a
40
+ * default for **y1**.
41
+ */
12
42
y2 ?: ChannelValueSpec ;
43
+
44
+ /**
45
+ * The curve (interpolation) method for connecting adjacent points.
46
+ *
47
+ * Since a link has exactly two points, only the following curves (or a custom
48
+ * curve) are recommended: *linear*, *step*, *step-after*, *step-before*,
49
+ * *bump-x*, or *bump-y*. Note that the *linear* curve is incapable of showing
50
+ * a fill since a straight line has zero area. For a curved link, use an arrow
51
+ * mark with the **bend** option.
52
+ *
53
+ * If the plot uses a spherical **projection**, the default *auto* **curve**
54
+ * will render links as geodesics; to draw a straight line instead, use the
55
+ * *linear* **curve** instead.
56
+ */
57
+ curve ?: CurveAutoOptions [ "curve" ] ;
13
58
}
14
59
60
+ /**
61
+ * Returns a new link mark for the given *data* and *options*, drawing line
62
+ * segments (curves) to connect pairs of points. For example, to draw a link
63
+ * connecting an observation from 1980 with an observation from 2015 in a
64
+ * scatterplot of population and revenue inequality of U.S. cities:
65
+ *
66
+ * ```js
67
+ * Plot.link(inequality, {x1: "POP_1980", y1: "R90_10_1980", x2: "POP_2015", y2: "R90_10_2015"})
68
+ * ```
69
+ *
70
+ * If the plot uses a spherical **projection**, the default *auto* **curve**
71
+ * will render links as geodesics; to draw a straight line instead, use the
72
+ * *linear* **curve** instead.
73
+ */
15
74
export function link ( data ?: Data , options ?: LinkOptions ) : Link ;
16
75
76
+ /** The link mark. */
17
77
export class Link extends RenderableMark { }
0 commit comments