Skip to content

Commit 350ac3b

Browse files
Filmbostock
andauthored
document tickX/tickY (#1378)
* document tickX/tickY * fixes * typically bound to the scale * edits --------- Co-authored-by: Mike Bostock <[email protected]>
1 parent 322b364 commit 350ac3b

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

src/marks/tick.d.ts

+59
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,79 @@ import type {ChannelValueSpec} from "../channel.js";
22
import type {InsetOptions} from "../inset.js";
33
import type {Data, MarkOptions, RenderableMark} from "../mark.js";
44

5+
/** Options for the tickX mark. */
56
export interface TickXOptions extends MarkOptions, Omit<InsetOptions, "insetLeft" | "insetRight"> {
7+
/**
8+
* The required horizontal position of the tick; a channel typically bound to
9+
* the *x* scale.
10+
*/
611
x?: ChannelValueSpec;
12+
13+
/**
14+
* The optional vertical position of the tick; a categorical channel typically
15+
* bound to the *y* scale. If not specified, the tick spans the vertical
16+
* extent of the frame; otherwise the *y* scale must be a *band* scale.
17+
*
18+
* If **y** represents quantitative or temporal values, use a ruleX mark
19+
* instead.
20+
*/
721
y?: ChannelValueSpec;
822
}
923

24+
/** Options for the tickY mark. */
1025
export interface TickYOptions extends MarkOptions, Omit<InsetOptions, "insetTop" | "insetBottom"> {
26+
/**
27+
* The required vertical position of the tick; a channel typically bound to
28+
* the *y* scale.
29+
*/
1130
y?: ChannelValueSpec;
31+
32+
/**
33+
* The optional horizontal position of the tick; a categorical channel
34+
* typically bound to the *x* scale. If not specified, the tick spans the
35+
* horizontal extent of the frame; otherwise the *x* scale must be a *band*
36+
* scale.
37+
*
38+
* If **x** represents quantitative or temporal values, use a ruleY mark
39+
* instead.
40+
*/
1241
x?: ChannelValueSpec;
1342
}
1443

44+
/**
45+
* Returns a new horizontally-positioned tickX mark (a vertical line, |) for the
46+
* given *data* and *options*. The **x** channel specifies the tick’s horizontal
47+
* position and defaults to identity, assuming that *data* = [*x₀*, *x₁*, *x₂*,
48+
* …]; the optional **y** categorical channel specifies its vertical position.
49+
* For example, for a horizontal barcode plot of penguins’ weights:
50+
*
51+
* ```js
52+
* Plot.tickX(penguins, {x: "body_mass_g", y: "sex", stroke: "species"})
53+
* ```
54+
*
55+
* If **y** represents quantitative or temporal values, use a ruleX mark
56+
* instead.
57+
*/
1558
export function tickX(data?: Data, options?: TickXOptions): TickX;
1659

60+
/**
61+
* Returns a new vertically-positioned tickY mark (a horizontal line, —) for the
62+
* given *data* and *options*. The **y** channel specifies the vertical position
63+
* of the tick and defaults to identity, assuming that *data* = [*y₀*, *y₁*,
64+
* *y₂*, …]; the optional **x** categorical channel specifies its horizontal
65+
* position. For example, fpr a vertical barcode plot of penguins’ weights:
66+
*
67+
* ```js
68+
* Plot.tickY(penguins, {y: "body_mass_g", x: "sex", stroke: "species"})
69+
* ```
70+
*
71+
* If **x** represents quantitative or temporal values, use a ruleY mark
72+
* instead.
73+
*/
1774
export function tickY(data?: Data, options?: TickYOptions): TickY;
1875

76+
/** The tickX mark. */
1977
export class TickX extends RenderableMark {}
2078

79+
/** The tickY mark. */
2180
export class TickY extends RenderableMark {}

0 commit comments

Comments
 (0)