Waffle Visualization
n_waffle( data, id = NULL, value = NULL, label = NULL, total, rows, columns, render = c("svg", "html", "canvas"), ..., width = NULL, height = NULL, elementId = NULL )
data | a data.frame contains value for create the waffle |
---|---|
id | the name of the column used to represent the group. |
value | column names for value. |
label | column names for label. If not provided, id is used as the label by default. |
total | max value. |
rows | number of rows. |
columns | number of columns. |
render | "svg" (responsive) "html", or "canvas". "canvas" is well suited for large data sets as it does not impact DOM tree depth, however you'll lose the isomorphic rendering ability. |
... | additional arguments. |
width, height | Must be a valid CSS unit (like |
elementId | element id of widgets |
a waffle calendar component
library(nivor) # generate data data <- data.frame( id = c("men", "women", "children"), label = c("Men", "Women", "Children"), value = c(9, 13, 20), color = c("#468df3", "#ba72ff", "#a1cfff") ) # the simplest use n_waffle( data = data, total = 100, rows = 18, columns = 14 ) # render with customization. n_waffle( data = data, total = 100, rows = 18, columns = 14, margin = list( top = 10, right = 10, bottom = 10, left = 120 ), colors = list(scheme = "nivo"), borderColor = list( from = "color", modifiers = list( c("darker", 1.3) ) ), animate = TRUE, motionStiffness = 90, motionDamping = 11, legends = list( list( anchor = "top-left", direction = "column", justify = FALSE, translateX = -100, translateY = 0, itemsSpacing = 4, itemWidth = 100, itemHeight = 20, itemDirection = "left-to-right", itemOpacity = 1, itemTextColor = "#777", symbolSize = 20, effects = list( list( on = "hover", style = list( itemTextColor = "#000", itemBackground = "#f7fafb" ) ) ) ) ) )