Skip to content

Commit dd57a32

Browse files
committed
document link
1 parent 4e81cd5 commit dd57a32

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/marks/link.d.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,57 @@ import type {CurveAutoOptions} from "../curve.js";
33
import type {Data, MarkOptions, RenderableMark} from "../mark.js";
44
import type {MarkerOptions} from "../marker.js";
55

6+
/** Options for the link mark. */
67
export interface LinkOptions extends MarkOptions, MarkerOptions, CurveAutoOptions {
8+
/** The horizontal position, for vertical links; bound to the *x* scale. */
79
x?: ChannelValueSpec;
10+
/** The vertical position, for horizontal links; bound to the *x* scale. */
811
y?: ChannelValueSpec;
12+
/** The starting horizontal position; bound to the *x* scale. */
913
x1?: ChannelValueSpec;
14+
/** The ending vertical position; bound to the *y* scale. */
1015
y1?: ChannelValueSpec;
16+
/** The starting horizontal position; bound to the *x* scale. */
1117
x2?: ChannelValueSpec;
18+
/** The ending vertical position; bound to the *y* scale. */
1219
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"];
1329
}
1430

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+
*/
1556
export function link(data?: Data, options?: LinkOptions): Link;
1657

58+
/** The link mark. */
1759
export class Link extends RenderableMark {}

0 commit comments

Comments
 (0)