Skip to content

Shorthand singleton marks #689

@mbostock

Description

@mbostock

For single-instance marks, it’d be neat if you could just pass options without data. For example:

Plot.text({
  text: "Hello, world!"
  x: new Date("2016-05-01"),
  y: 100,
  dx: -10,
  dy: 40,
  frameAnchor: "top-left"
})

Could be equivalent to:

Plot.text({length: 1}, {
  text: ["Hello, world!"],
  x: [new Date("2016-05-01")],
  y: [100],
  dx: -10,
  dy: 40,
  frameAnchor: "top-left"
})

It feels like the helper would need to know which options possibly represent channels, though. And there would potentially be ambiguity with alternative representations of data (such as Arquero objects #449); though that could be addressed by checking the number of arguments and whether the first is a plain object (Object.getPrototypeOf === Object.prototype).

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