|
1 | 1 | import type {ChannelValue, ChannelValueSpec} from "../channel.js";
|
2 | 2 | import type {Data, MarkOptions, RenderableMark} from "../mark.js";
|
3 | 3 |
|
| 4 | +/** Options for the density mark. */ |
4 | 5 | export interface DensityOptions extends MarkOptions {
|
| 6 | + /** The horizontal position channel, typically bound to the *x* scale. */ |
5 | 7 | x?: ChannelValueSpec;
|
| 8 | + /** The vertical position channel, typically bound to the *y* scale. */ |
6 | 9 | 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 | + */ |
7 | 16 | 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 | + */ |
8 | 23 | 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 | + */ |
9 | 30 | 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 | + */ |
10 | 38 | thresholds?: number | Iterable<number>;
|
11 | 39 | }
|
12 | 40 |
|
| 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 | + */ |
13 | 51 | export function density(data?: Data, options?: DensityOptions): Density;
|
14 | 52 |
|
| 53 | +/** The density mark. */ |
15 | 54 | export class Density extends RenderableMark {}
|
0 commit comments