Skip to contents

Draws an arrow, or another kind of line, from one card to another: who handed what to whom.

Usage

add_links(map, links, ..., kinds = NULL)

Arguments

map

A stage_map() widget.

A data frame with one row per link. See "Columns". NULL, or a data frame with no rows (such as data.frame()), adds no links.

...

Must stay empty. It makes every argument after it a named argument.

kinds

A data frame with one row per kind of link, named in the legend, or NULL: every link is then a plain arrow. Added only with links: when links adds none, so do the kinds.

Value

The widget, with the links added. A widget that has links already is an error of class stagemap_error_layer. A from or to that is not the id of a card, a kind that is not in kinds (or a kind with no kinds given), a variants id that add_variants() has not given, a step that add_steps() has not given, and an id given twice in kinds, are errors of class stagemap_error_data that name the ids. A step or variants id is checked when the table it names arrives, in either order.

Columns

Required columns are marked with an asterisk.

  • links: from*, to* (card ids), kind (a kinds id), label, step (the id of the step the link plays at, see add_steps()), variants (variant ids separated by commas, see add_variants()).

  • kinds: id*, label*, line ("solid", "dashed", "dotted" or "dashdot"), end ("arrow", "ring" or "none"), tone, quiet (TRUE draws the links of that kind faint until the reader hovers over, focuses or picks them, or a step plays them; in print and in forced colours they are full strength; left out, it is FALSE). Use it for a kind that would otherwise crowd the picture.

A column the engine has no field for stays in the data the widget keeps in R and is not sent to the engine.

Examples

map <- stage_map(
  cards = data.frame(
    id = c("a", "b"),
    label = c("Draft", "Review"),
    stage = c("w", "c"),
    lane = "docs"
  ),
  stages = data.frame(id = c("w", "c"), label = c("Write", "Check")),
  lanes = data.frame(id = "docs", label = "Docs")
) |>
  add_links(
    data.frame(from = "a", to = "b", kind = "hand"),
    kinds = data.frame(id = "hand", label = "Handed over", line = "dashed")
  )
class(map)
#> [1] "stage_map"       "stagemap_widget" "htmlwidget"     
if (FALSE) { # interactive()
map
}