addFontAwesome: Use fontAwesome icons in visNetwork 'graph'

Description Usage Arguments Value Examples

View source: R/dependencies.R

Description

Add Font-Awesome for styling our graph with beautiful, professional icons. Please note that you'll already have these icons if using Shiny. Can also use addIonicons

Usage

1

Arguments

graph

: a visNetwork object

Value

graph htmlwidget with Font-Awesome dependencies attached.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# use fontAwesome icons using groups or nodes options 
# font-awesome is not part of dependencies. use addFontAwesome() if needed.
# http://fortawesome.github.io/Font-Awesome/

# definition in groups
nodes <- data.frame(id = 1:3, group = c("B", "A", "B"))
edges <- data.frame(from = c(1,2), to = c(2,3))

visNetwork(nodes, edges) %>%
  visGroups(groupname = "A", shape = "icon", icon = list(code = "f0c0", size = 75)) %>%
  visGroups(groupname = "B", shape = "icon", icon = list(code = "f007", color = "red")) %>%
  addFontAwesome()

# definition in nodes
nodes <- data.frame(id = 1:3, shape = "icon", icon.face = 'FontAwesome', 
   icon.code = "f0c0")
edges <- data.frame(from = c(1,2), to = c(1,3))

visNetwork(nodes, edges) %>%
  addFontAwesome()

visNetwork documentation built on July 30, 2017, 5:01 p.m.