Skip to content

Commit 322b364

Browse files
Filmbostock
andauthored
document frame (#1375)
* document frame * update decorations paragraph * Update README.md * Update src/marks/frame.d.ts * edits --------- Co-authored-by: Mike Bostock <[email protected]>
1 parent b47f59e commit 322b364

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,7 @@ Equivalent to [Plot.vector](#plotvectordata-options) except that the **shape** d
19761976
19771977
## Decorations
19781978
1979-
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.
1979+
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.
19801980
19811981
### Frame
19821982

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 {}

0 commit comments

Comments
 (0)