Skip to content

Commit 40d0172

Browse files
authored
document density (#1392)
* document density * lines
1 parent 3b5889f commit 40d0172

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

src/marks/area.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export interface AreaOptions extends MarkOptions, StackOptions, CurveOptions {
3737
y2?: ChannelValueSpec;
3838

3939
/**
40-
* The optional ordinal **z** channel, for grouping data into (possibly
41-
* stacked) series to be drawn as separate areas; defaults to **fill** if a
42-
* channel, or **stroke** if a channel.
40+
* An optional ordinal channel for grouping data into (possibly stacked)
41+
* series to be drawn as separate areas; defaults to **fill** if a channel, or
42+
* **stroke** if a channel.
4343
*/
4444
z?: ChannelValue;
4545
}

src/marks/delaunay.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import type {MarkerOptions} from "../marker.js";
55

66
/** Options for the Delaunay marks. */
77
export interface DelaunayOptions extends MarkOptions, MarkerOptions, CurveOptions {
8-
/** A channel for the horizontal position, typically bound to the *x* scale. */
8+
/** The horizontal position channel, typically bound to the *x* scale. */
99
x?: ChannelValueSpec;
10-
/** A channel for the vertical position, typically bound to the *y* scale. */
10+
/** The vertical position channel, typically bound to the *y* scale. */
1111
y?: ChannelValueSpec;
1212
/** An optional ordinal channel for grouping to produce multiple (possibly overlapping) triangulations. */
1313
z?: ChannelValue;

src/marks/density.d.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,54 @@
11
import type {ChannelValue, ChannelValueSpec} from "../channel.js";
22
import type {Data, MarkOptions, RenderableMark} from "../mark.js";
33

4+
/** Options for the density mark. */
45
export interface DensityOptions extends MarkOptions {
6+
/** The horizontal position channel, typically bound to the *x* scale. */
57
x?: ChannelValueSpec;
8+
/** The vertical position channel, typically bound to the *y* scale. */
69
y?: ChannelValueSpec;
10+
11+
/**
12+
* An optional ordinal channel for grouping, producing independent contours
13+
* for each group. If not specified, it defaults to **fill** if a channel, or
14+
* **stroke** if a channel.
15+
*/
716
z?: ChannelValue;
17+
18+
/**
19+
* An optional weight channel specifying the relative contribution of each
20+
* point. If not specified, all points have a constant weight of 1.
21+
* Non-positive weights are allowed, making associated points repulsive.
22+
*/
823
weight?: ChannelValue;
24+
25+
/**
26+
* The bandwidth, a number in pixels which defaults to 20, specifies the
27+
* standard deviation of the Gaussian kernel used for density estimation. A
28+
* larger value will produce smoother contours.
29+
*/
930
bandwidth?: number;
31+
32+
/**
33+
* How many contours to produce, and at what density; either a number, by
34+
* default 20, specifying one more than the number of contours that will be
35+
* computed at uniformly-spaced intervals between 0 (exclusive) and the
36+
* maximum density (exclusive); or, an iterable of explicit density values.
37+
*/
1038
thresholds?: number | Iterable<number>;
1139
}
1240

41+
/**
42+
* Returns a mark that draws contours representing the estimated density of the
43+
* two-dimensional points given by **x** and **y**, and possibly weighted by
44+
* **weight**. If either **x** or **y** is not specified, it defaults to the
45+
* respective middle of the plot’s frame.
46+
*
47+
* If the **stroke** or **fill** is specified as *density*, a color channel is
48+
* constructed with values representing the density threshold value of each
49+
* contour.
50+
*/
1351
export function density(data?: Data, options?: DensityOptions): Density;
1452

53+
/** The density mark. */
1554
export class Density extends RenderableMark {}

src/marks/line.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export interface LineOptions extends MarkOptions, MarkerOptions, CurveAutoOption
1717
y?: ChannelValueSpec;
1818

1919
/**
20-
* The optional ordinal **z** channel, for grouping data into (possibly
21-
* stacked) series to be drawn as separate lines. If not specified, it
22-
* defaults to **fill** if a channel, or **stroke** if a channel.
20+
* An optional ordinal channel for grouping data into (possibly stacked)
21+
* series to be drawn as separate lines. If not specified, it defaults to
22+
* **fill** if a channel, or **stroke** if a channel.
2323
*/
2424
z?: ChannelValue;
2525
}

0 commit comments

Comments
 (0)