Skip to content

A frameAnchor option for positioning otherwise position-less marks relative to the frame #683

@mbostock

Description

@mbostock

When marks don’t have a position, we currently default them to the center of the frame. For example:

plot/src/marks/dot.js

Lines 57 to 58 in 136fc2f

const cx = (marginLeft + width - marginRight) / 2;
const cy = (marginTop + height - marginBottom) / 2;

plot/src/marks/text.js

Lines 56 to 57 in 136fc2f

const cx = (marginLeft + width - marginRight) / 2;
const cy = (marginTop + height - marginBottom) / 2;

The frameAnchor option would allow more control over this behavior, for example when labeling facet frames. It would support nine possible values:

  • top-left
  • top
  • top-right
  • right
  • bottom-right
  • bottom
  • bottom-left
  • left
  • middle (default)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions