Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sg_progress

Text


Description

Add text to your graph.

Usage

sg_progress(
  sg,
  data,
  delay,
  text,
  ...,
  position = "top",
  id = NULL,
  tag = htmltools::span,
  cumsum = TRUE
)

Arguments

sg

An object of class sigmajsas intatiated by sigmajs.

data

Data.frame holding delay and text.

delay

Delay, in milliseconds at which text should appear.

text

Text to appear on graph.

...

Content of the button, complient with htmltools.

position

Position of button, top or bottom.

id

A valid CSS id.

tag

A Valid htmltools tags function.

cumsum

Whether to compute the cumulative sum on the delay.

Details

The element is passed to Document.createElement() and therefore takes any valid tagName, including, but not limited to; p, h1, div.

Value

A modified version of the sg object.

Examples

# initial nodes
nodes <- sg_make_nodes()

# additional nodes
nodes2 <- sg_make_nodes()
nodes2$id <- as.character(seq(11, 20))

# add delay
nodes2$delay <- runif(nrow(nodes2), 500, 1000)
nodes2$text <- seq.Date(Sys.Date(), Sys.Date() + 9, "days")

sigmajs() %>%
  sg_nodes(nodes, id, label, size, color) %>%
  sg_add_nodes(nodes2, delay, id, label, size, color) %>% 
  sg_progress(nodes2, delay, text, element = "h3") %>%
  sg_button(c("add_nodes", "progress"), "add")

sigmajs

Interface to 'Sigma.js' Graph Visualization Library

v0.1.5
MIT + file LICENSE
Authors
John Coene [aut, cre, cph] (<https://orcid.org/0000-0002-6637-4107>)
Initial release
2020-06-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.