A stage map shows pieces of work (cards) placed in stages (columns) and lanes (rows), with a status on each card.
stage_map() draws the cards, stages and lanes, with a legend, the details of the card under the pointer, a side
panel for the chosen stage and the notes of the zones. It shows no title unless given one, and no step player unless
it has steps. Add the rest with the pipe: links with add_links(), zones with add_zones(), steps to play through
with add_steps() (which brings the player) and variants with add_variants(). Light chosen cards from the first
draw with stage_map_highlight(); in a Shiny app, stage_map_output() shows the map.
Usage
stage_map(
cards,
stages = NULL,
lanes = NULL,
...,
title = NULL,
layout = "grid",
target = NULL,
variant = NULL,
statuses = NULL,
motion = TRUE,
legend = TRUE,
cell_columns = 1,
bundle_links = FALSE,
dismiss = "no_outside",
player = NULL,
panels = TRUE,
width = NULL,
height = NULL,
element_id = NULL
)Arguments
- cards
A data frame with one row per card. Columns are listed under "Columns". It has no default.
- stages
A data frame with one row per stage (a column of the picture). See "Columns".
NULLtakes the stages from thestagecolumn ofcards: a factor gives all its levels in their order, used or not, and any other column gives its values in order of first appearance; each stage's label is its id. Left out, a mistyped stage incardsis not caught, because it makes a stage of its own. Use a factor for the order; give the table for a label that differs from the id, or to check the spelling.- lanes
A data frame with one row per lane (a row of the picture). See "Columns".
NULLtakes the lanes from thelanecolumn ofcards, in the same way asstages; give the table for another order, for a label that differs from the id, or to check the spelling. Links read best when they run along a lane, so choose lanes that follow the work's flow (a topic, a product, a team that hands work on), not lanes that most links have to cross; show who owns a card with itssubcolumn instead.- ...
Must stay empty. It makes every argument after it a named argument, and a typo in an option's name an error that names it.
- title
The map's title, as one string, drawn above it.
NULLdraws no title; the drawing is then named "Stage map" for screen readers.- layout
One of the layouts the engine lists:
"grid"(the default),"levels"or"dates". The grid puts stages in columns and lanes in rows;"levels"draws each lane as a band flowing intotarget;"dates"draws a table of lanes by stages with one stage per day and no links.The
"levels"and"dates"layouts, andtargetandvariantthat go with them, may change. The list of layouts may grow.- target
The id of the card the levels layout flows into, as text or a whole number. It must be a card of the map.
NULLfor none.- variant
The id of the variant to start on (levels layout), from
add_variants(), as text or a whole number. It must be a variant of the map onceadd_variants()has added them.NULLlets the engine choose.- statuses
Your words and looks for the statuses, in one of two forms (see "Statuses"): a named character vector giving your word for a built-in status, such as
c(done = "Pass"), or a data frame with the columnsid*,label,toneandicon, one row per status. A data frame row with a built-in id restyles that status, and any other id adds a status.NULL, a named character vector of length zero or a data frame with no rows uses the engine's default words; a status you leave out keeps its default. A label that is blank is an error. A missing label (NA, or nolabelcolumn) leaves the built-in word, or shows the id for a status of your own.- motion
FALSEto move between steps without travelling dots and without the card gliding to its new stage, orTRUE(the default) to allow them. The reader's own reduced-motion setting is always respected.- legend
FALSEhides the legend;TRUE, the default, shows it.- cell_columns
How many columns of cards a cell holds when a stage has several cards in one lane: a whole number from 1 to 6, or
"auto"to let the map's width decide (up to 6). The default is1. Six is the most because six cards side by side are wider than a screen and would scroll. It is one number for the whole map, and a stage with several columns is wider than the others. Only the"grid"layout uses it, and a box under 500 pixels wide, which stacks stage by stage, ignores it.- bundle_links
TRUEdraws the forward links of one card as a single trunk that splits next to the cards they reach, when three or more of them have the same kind and no label; other links are drawn as usual.FALSE, the default, draws every link on its own. Only the"grid"layout uses it, and a box under 500 pixels wide ignores it.- dismiss
What a click outside the map does to the reader's pick (a chosen card or stage).
"no_outside"keeps the pick, so a click on a Shiny button, a filter or a tab beside the map leaves it alone and a bookmark button can save it."any"lets go of the pick on any click outside the map, as the engine does when given nothing. With either value the reader still lets go of a pick with Escape, a second click on it, or a click on empty space in the map. One of the values the engine lists.- player
The step player: its buttons, caption and step list.
NULLshows it once the map has steps fromadd_steps()and hides it before.TRUEalways shows it (without steps, the engine plays one step per stage), andFALSEnever does.- panels
TRUE, the default, shows what the map holds below and beside the picture: the details of the card under the pointer or chosen, the side panel of the chosen stage and the notes of the zones.FALSEhides all three, for a page that shows them itself or none at all.- width, height
A CSS size as text (such as
"100%"or"480px"), a number of pixels, orNULL. The default width is"100%", and the default height follows the picture's content.- element_id
A fixed HTML id for the widget, or
NULLto let the widget system choose one. Give one when the map is drawn insideshiny::renderUI(), so its inputs have a known name.
Value
An HTML widget (class stagemap_widget). Print it to view it, use it in R Markdown or Quarto, or pipe it
into an add_*() function. A problem in the data, an id that does not join and an id given twice are errors of
class stagemap_error_data: a problem in the data lists up to ten problems with their paths.
Details
Each list in the picture is one data frame, one row per record, and ids join the lists the way a key joins two data
frames: a card's stage and lane name a stage id and a lane id. R checks each join, and an id given twice in a
table, when both tables are there, in whichever order they come, and stops with an error of class
stagemap_error_data that names the ids. A card's zone or variants, a link's step and a map's variant name
tables that a later call may add: until it does they are not checked in R, and a table that is never added leaves
the engine to show the problem inside the widget.
Column names are the engine's field names. A column the engine has no field for is not sent to it and gives no
warning: it stays in the data the widget keeps in R, so a table that carries more columns than the map needs can be
passed as it is. A name with no field inside an option, such as an entry of statuses that is not a built-in status,
is dropped with a warning that names it. An NA in an optional column counts as left out. Ids are written as text,
so 7 and "7" are the same id; an id is text that is not blank, or a whole number of any size, and an empty or
blank id is an error of class stagemap_error_data that names it.
Columns
Required columns are marked with an asterisk.
cards:id*,label*,stage*,lane*,sub(a second line, such as a person),status(the id of a status: one of the five built-in ones,"done","running","waiting","failed"and"skipped", or an id you add withstatuses),tone,text(shown in the card's details),zone(a zone id, seeadd_zones()),milestone(TRUEto draw the card as a milestone; left out, it isFALSE),variants(variant ids separated by commas, such as"full, docs"; left out, the card is in every variant; seeadd_variants()).stages:id*,label*,kicker,text,date(aDate, or text like"2026-03-02"),flag(a word shown on the stage's head, such as"Stuck"),tone(the flag's colour),file,code(a file's text, shown in the side panel underfile),code_lines(the lines ofcodeto mark, such as"3, 5-7").lanes:id*,label*,tone,text.
A cards row can also have hidden (TRUE leaves the card out of the picture), disabled (TRUE dims it and
stops it being chosen) and reason (why the card is in its state; the map shows it on a disabled card); left out,
hidden and disabled are FALSE and FALSE.
The text columns of cards, stages, lanes, steps and zones, and the note of a zone, are read as
Markdown, so *word*, backticks and [words](https://example.org) draw as formatting. A zone's text and note
are one line.
The names parent (on stages and lanes) and gate (on stages) are set aside for columns a later version may
add: leave them out of your own columns in those tables.
A tone is one of "teal", "good", "warn", "bad", "muted", "orange", "blue", "violet", "pink",
"gold" or "grey".
Statuses
A card's status is the id of a status. Five are built in: "done", "running", "waiting", "failed" and
"skipped". The statuses argument takes two forms:
A named character vector, such as
c(done = "Pass", failed = "Not passed"), gives your word for a built-in status (the short form). The names are built-in ids; any other name is dropped with a warning.A data frame has one row per status, with the columns
id*,label,toneandicon(the name of one of the engine's icons). A row whoseidis a built-in id restyles that status (its label, colour and icon), and does not add a sixth. A row with any other id adds a status of your own, such as"blocked".
cards$status (and the status of add_steps()'s changes) may then use any id from statuses; any other id is
an error of class stagemap_error_data that names it, lists the ids allowed and says to add it to statuses. An id
given twice in a statuses data frame is an error too. A tone is checked against the tones listed under
"Columns", and the error names the value and lists the ones allowed. Give statuses in one form per call.
Scrolling and moving
Stage headings and lane names stay in view while the reader scrolls the map, but only when the map sits in a box that scrolls itself; a page that scrolls as a whole does not keep them in view. In the layout that stacks stage by stage (a box under 500 pixels wide), only the stage headings stay in view.
When a step of add_steps() moves a card to another stage, the card glides there, and a card that appears fades
in. The glide follows the reader's reduced-motion setting. motion = FALSE turns it off.
See also
Other stage map:
add_links(),
add_steps(),
add_variants(),
add_zones(),
stage_map_code(),
stage_map_tables()
Examples
map <- stage_map(
cards = data.frame(
id = c("draft", "review"),
label = c("Draft", "Review"),
stage = c("write", "check"),
lane = c("docs", "docs"),
status = c("done", "running")
),
stages = data.frame(id = c("write", "check"), label = c("Write", "Check")),
lanes = data.frame(id = "docs", label = "Docs"),
title = "A small piece of work"
) |>
add_links(data.frame(from = "draft", to = "review"))
class(map)
#> [1] "stage_map" "stagemap_widget" "htmlwidget"
if (FALSE) { # interactive()
map
}