Skip to content

Commit 0542835

Browse files
Filmbostock
andauthored
document link (#1388)
* document link * Update src/marks/link.d.ts Co-authored-by: Mike Bostock <[email protected]> * document link maybeSameValue --------- Co-authored-by: Mike Bostock <[email protected]>
1 parent 42c1a4e commit 0542835

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

src/marks/link.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,75 @@ 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+
/**
9+
* The horizontal position, for vertical links; typically bound to the *x*
10+
* scale; shorthand for setting defaults for both **x1** and **x2**.
11+
*/
712
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+
*/
818
y?: ChannelValueSpec;
19+
20+
/**
21+
* The starting horizontal position; typically bound to the *x* scale; also
22+
* sets a default for **x2**.
23+
*/
924
x1?: ChannelValueSpec;
25+
26+
/**
27+
* The starting vertical position; typically bound to the *y* scale; also sets
28+
* a default for **y2**.
29+
*/
1030
y1?: ChannelValueSpec;
31+
32+
/**
33+
* The ending horizontal position; typically bound to the *x* scale; also sets
34+
* a default for **x1**.
35+
*/
1136
x2?: ChannelValueSpec;
37+
38+
/**
39+
* The ending vertical position; typically bound to the *y* scale; also sets a
40+
* default for **y1**.
41+
*/
1242
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"];
1358
}
1459

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

76+
/** The link mark. */
1777
export class Link extends RenderableMark {}

0 commit comments

Comments
 (0)