Skip to content

document frame #1375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,7 @@ Equivalent to [Plot.vector](#plotvectordata-options) except that the **shape** d

## Decorations

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.
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.

### Frame

Expand Down
28 changes: 28 additions & 0 deletions src/marks/frame.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
import type {InsetOptions} from "../inset.js";
import type {MarkOptions, RenderableMark} from "../mark.js";

/** Options for the frame decoration mark. */
export interface FrameOptions extends MarkOptions, InsetOptions {
/**
* If null (default), the rectangular outline of the frame is drawn; otherwise
* the frame is drawn as a line only on the given side, and the **rx**,
* **ry**, **fill**, and **fillOpacity** options are ignored.
*/
anchor?: "top" | "right" | "bottom" | "left" | null;

/**
* The rounded corner [*x*-radius][1], either in pixels or as a percentage of
* the frame width. If **rx** is not specified, it defaults to **ry** if
* present, and otherwise draws square corners.
*
* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/rx
*/
rx?: number | string;

/**
* The rounded corner [*y*-radius[1], either in pixels or as a percentage of
* the frame height. If **ry** is not specified, it defaults to **rx** if
* present, and otherwise draws square corners.
*
* [1]: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/ry
*/
ry?: number | string;
}

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

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