addFontAwesome | R Documentation |
graph
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
addFontAwesome(graph, name = "font-awesome", version = c("4.7.0", "5.13.0"))
graph |
: a visNetwork object |
name |
: name of dependency |
version |
: fontawesome version. "4.7.0" (default) or "5.13.0" |
graph
htmlwidget with Font-Awesome dependencies attached.
# use fontAwesome icons using groups or nodes options # font-awesome is not part of dependencies. use addFontAwesome() if needed. # Versions in package (and compatible with vis.js) : 4.7.0 & 5.13.0 # https://fontawesome.com/v4.7.0/ # https://fontawesome.com/ # cheatsheet available in package: # system.file("fontAwesome/Font_Awesome_Cheatsheet_4_7_0.pdf", package = "visNetwork") # 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(version = "4.7.0") # use 5.13.0 # set face = "'Font Awesome 5 Free'" # weight is automatically set to "bold" 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(face = "'Font Awesome 5 Free'", code = "f0c0", size = 75)) %>% visGroups(groupname = "B", shape = "icon", icon = list(face = "'Font Awesome 5 Free'", code = "f007", color = "red")) %>% addFontAwesome(version = "5.13.0") # 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() # using shinydashboard : change name if needed visNetwork(nodes, edges) %>% addFontAwesome(name = "font-awesome-visNetwork")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.