Skip to contents

A serializable description of a Mermaid diagram rendered with Pele. Build one with setup_MermaidConfig() rather than calling this constructor directly.

Usage

MermaidConfig(
  dat_path = NULL,
  title = NULL,
  origin = NULL,
  writer = NULL,
  palette = NULL,
  node_color = NULL,
  fill_alpha = 0.1,
  font_size = 14,
  padding = NULL,
  auto_direction = FALSE,
  fit = FALSE
)

Arguments

dat_path

Optional Character: Path to the data, read at draw time. The serializable alternative to passing data to draw().

title

Optional Character: Chart title. Declared here because it is the one property every chart type has; palette is not (four take a colormap instead), and axis labels and margins are cartesian-only.

origin

Optional Named character {"user", "default", "derived"}: Where each value came from, one entry per settable property. Absent on an authored config; written by the interface that resolved it.

writer

Optional Named character: Which interface wrote the config, as name and version. Absent on an authored config.

palette

Optional Character: Colors for categorical entities, overriding the theme palette. NULL uses the theme's.

node_color

Optional Named character: Colors for selected nodes, named by node id. Each named node gets a border in its color and a fill of the same color at fill_alpha opacity.

fill_alpha

Numeric [0, 1]: Fill opacity of the nodes in node_color.

font_size

Numeric (0, Inf): Label font size in pixels.

padding

Optional Numeric [0, Inf): Space around the diagram in pixels. NULL uses Pele's default.

auto_direction

Logical: Allow left-to-right flowcharts to be drawn top-to-bottom in widgets narrower than 640 pixels.

fit

Logical: Shrink the diagram to the widget width instead of drawing it at its natural size.

Value

MermaidConfig object.

Details

The bound data is the Mermaid source: draw(config, data = source), where source is a character vector, or a .mmd or .mermaid file named by dat_path. See draw_mermaid() for the supported Mermaid syntax.

Author

EDG

Examples

setup_MermaidConfig(font_size = 16)@type
#> [1] "mermaid"