Learn R Programming

sigmajs (version 0.1.5)

force: Add forceAtlas2

Description

Implementation of forceAtlas2.

Usage

sg_force(sg, ...)

sg_force_start(sg, ...)

sg_force_stop(sg, delay = 5000)

sg_force_restart_p(proxy, ..., refresh = TRUE)

sg_force_restart(sg, data, delay, cumsum = TRUE)

sg_force_start_p(proxy, ..., refresh = TRUE)

sg_force_stop_p(proxy)

sg_force_kill_p(proxy)

sg_force_config_p(proxy, ...)

Arguments

sg

An object of class sigmajsas intatiated by sigmajs.

...

Any parameter, see official documentation.

delay

Milliseconds after which the layout algorithm should stop running.

proxy

An object of class sigmajsProxy as returned by sigmajsProxy.

refresh

Whether to refresh the graph after node is dropped, required to take effect.

data

data.frame holding delay column.

cumsum

Whether to compute the cumulative sum of the delay.

Value

Their first arguments, either sg or proxy.

Functions

  • sg_force, sg_force_start starts the forceAtlas2 layout

  • sg_force_stop stops the forceAtlas2 layout after a delay milliseconds

  • sg_force_restart_p proxy to re-starts (kill then start) the forceAtlas2 layout, the options you pass to this function are applied on restart. If forceAtlas2 has not started yet it is launched.

  • sg_force_start_p proxy to start forceAtlas2.

  • sg_force_stop_p proxy to stop forceAtlas2.

  • sg_force_kill_p proxy to ompletely stops the layout and terminates the assiociated worker. You can still restart it later, but a new worker will have to initialize.

  • sg_force_config_p proxy to set configurations of forceAtlas2.

  • sg_force_restart Restarts (kills then starts) forceAtlas2 at given delay.

Details

The delay helps for build dynamic visualisations where nodes and edges do not appear all at the same time. How the delay works depends on the cumsum parameter. if TRUE the function computes the cumulative sum of the delay to effectively add each row one after the other: delay is thus applied at each row (number of seconds to wait before the row is added *since the previous row*). If FALSE this is the number of milliseconds to wait before the node or edge is added to the visualisation; delay is used as passed to the function.

See Also

official documentation

Examples

Run this code
# NOT RUN {
nodes <- sg_make_nodes(50)
edges <- sg_make_edges(nodes, 100)

sigmajs() %>%
  sg_nodes(nodes, id, label, size) %>%
  sg_edges(edges, id, source, target) %>% 
  sg_force() %>% 
  sg_force_stop() # stop force after 5 seconds

# }

Run the code above in your browser using DataLab