Skip to content

Commit af92a07

Browse files
authored
Merge branch 'main' into fil/color-legend-opacity
2 parents 2ba668a + 322b364 commit af92a07

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ Plot automatically generates [axis](#axis) and optionally [grid](#grid) marks fo
296296
* *scale*.**tickPadding** - the separation between the tick and its label (in pixels; default 3)
297297
* *scale*.**tickFormat** - either a function or specifier string to format tick values; see [Formats](#formats)
298298
* *scale*.**tickRotate** - whether to rotate tick labels (an angle in degrees clockwise; default 0)
299-
* *scale*.**grid** - if true, draw grid lines across the plot for each tick
299+
* *scale*.**grid** - whether to draw grid lines across the plot for each tick
300300
* *scale*.**line** - if true, draw the axis line (only for *x* and *y*)
301301
* *scale*.**label** - a string to label the axis
302302
* *scale*.**labelAnchor** - the label anchor: *top*, *right*, *bottom*, *left*, or *center*
@@ -305,7 +305,7 @@ Plot automatically generates [axis](#axis) and optionally [grid](#grid) marks fo
305305
* *scale*.**ariaLabel** - a short label representing the axis in the accessibility tree
306306
* *scale*.**ariaDescription** - a textual description for the axis
307307

308-
Top-level options are also supported as shorthand: **grid** (for *x* and *y* only; see [facet.grid](#facet-options)), **label**, **axis**, **inset**, **round**, **align**, and **padding**.
308+
Top-level options are also supported as shorthand: **grid** (for *x* and *y* only; see [facet.grid](#facet-options)), **label**, **axis**, **inset**, **round**, **align**, and **padding**. If the **grid** option is true, show a grid with the currentColor stroke; if specified as a string, show a grid with the specified stroke color; if an approximate number of ticks, an interval, or an array of tick values, show corresponding grid lines.
309309

310310
### Projection options
311311

@@ -1505,7 +1505,7 @@ Returns a new *fy* grid with the given *options*.
15051505
15061506
### Hexgrid
15071507
1508-
The hexgrid mark can be used to support marks using the [hexbin](#hexbin) layout.
1508+
The hexgrid mark can be used to support marks using the [hexbin](#hexbin) transform.
15091509
15101510
#### Plot.hexgrid(*options*)
15111511
@@ -1978,7 +1978,7 @@ Equivalent to [Plot.vector](#plotvectordata-options) except that the **shape** d
19781978
19791979
## Decorations
19801980
1981-
Decorations are static marks that do not represent data. Currently this includes only [Plot.frame](#frame), although internally Plot’s axes are implemented as decorations and may in the future be exposed here for more flexible configuration.
1981+
Decorations are marks that do not directly represent data. Currently this includes [Plot.frame](#frame), as well as the [axes](#axis) and [grid](#grid) marks described above.
19821982
19831983
### Frame
19841984

src/marks/frame.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,40 @@
11
import type {InsetOptions} from "../inset.js";
22
import type {MarkOptions, RenderableMark} from "../mark.js";
33

4+
/** Options for the frame decoration mark. */
45
export interface FrameOptions extends MarkOptions, InsetOptions {
6+
/**
7+
* If null (default), the rectangular outline of the frame is drawn; otherwise
8+
* the frame is drawn as a line only on the given side, and the **rx**,
9+
* **ry**, **fill**, and **fillOpacity** options are ignored.
10+
*/
511
anchor?: "top" | "right" | "bottom" | "left" | null;
12+
13+
/**
14+
* The rounded corner [*x*-radius][1], either in pixels or as a percentage of
15+
* the frame width. If **rx** is not specified, it defaults to **ry** if
16+
* present, and otherwise draws square corners.
17+
*
18+
* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/rx
19+
*/
620
rx?: number | string;
21+
22+
/**
23+
* The rounded corner [*y*-radius[1], either in pixels or as a percentage of
24+
* the frame height. If **ry** is not specified, it defaults to **rx** if
25+
* present, and otherwise draws square corners.
26+
*
27+
* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/ry
28+
*/
729
ry?: number | string;
830
}
931

32+
/**
33+
* Draws a rectangle around the plot’s frame, or if an **anchor** is given, a
34+
* line on the given side. Useful for visual separation of facets, or in
35+
* conjunction with axes and grids to fill the frame’s background.
36+
*/
1037
export function frame(options?: FrameOptions): Frame;
1138

39+
/** The frame decoration mark. */
1240
export class Frame extends RenderableMark {}

src/marks/hexgrid.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
11
import type {MarkOptions, RenderableMark} from "../mark.js";
22

3+
/** Options for the hexgrid mark. */
34
export interface HexgridOptions extends MarkOptions {
5+
/**
6+
* The distance between centers of neighboring hexagons, in pixels; defaults
7+
* to 20. Should match the **binWidth** of the hexbin transform.
8+
*/
49
binWidth?: number;
510
}
611

12+
/**
13+
* The hexgrid decoration mark complements the hexbin transform, showing the
14+
* outlines of all hexagons spanning the frame with a default **stroke** of
15+
* *currentColor* and a default **strokeOpacity** of 0.1, similar to the the
16+
* default axis grids. For example:
17+
*
18+
* ```js
19+
* Plot.plot({
20+
* marks: [
21+
* Plot.hexagon(Plot.hexbin({fill: "count"}, {binWidth: 12, x: "weight", y: "economy"})),
22+
* Plot.hexgrid({binWidth: 12})
23+
* ]
24+
* })
25+
* ```
26+
*
27+
* Note that the **binWidth** option of the hexgrid mark should match that of
28+
* the hexbin transform. The grid is clipped by the frame. This is a stroke-only
29+
* mark, and **fill** is not supported; to fill the frame, use the frame mark.
30+
*/
731
export function hexgrid(options?: HexgridOptions): Hexgrid;
832

33+
/** The hexgrid mark. */
934
export class Hexgrid extends RenderableMark {}

src/transforms/window.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ export interface WindowOptions {
6565
* - *start* - as the first element in the window
6666
* - *middle* (default) - in the middle of the window, rounding down if **k** is even
6767
* - *end* - as the last element in the window
68+
*
69+
* Note that *start* and *end* are relative to input order, not natural
70+
* ascending order by value. For example, if the data is in reverse
71+
* chronological order, then the meaning of *start* and *end* is effectively
72+
* reversed because the first data point is the most recent.
6873
*/
6974
anchor?: "start" | "middle" | "end";
7075

0 commit comments

Comments
 (0)