Calendar Visualization
n_calendar( data = NULL, day = NULL, value = NULL, from = NULL, to = NULL, render = c("svg", "canvas"), ..., width = NULL, height = NULL, elementId = NULL )
data | a data.frame contains day and value for create the calendar. |
---|---|
day, value | column names of day and value. if not provided, it will use the first column as day, and the second column as value. |
from | start date. |
to | end date. |
render | "svg" (responsive) 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 nivo calendar component
library(nivor) # generate data df <- data.frame( day = seq.Date( from = as.Date("2016-08-23"), length.out = 1500, by = "days" ), value = round(runif(1500) * 1000, 0) ) # render in responsive (svg) with style. n_calendar( data = df, from = "2016-01-01", to = "2019-12-31", colors = c("#d6e685", "#8cc665", "#44a340", "#1e6823") ) # render in canvas with customization. n_calendar( df, render = "canvas", emptyColor = "#aa7942", from = "2016-01-01", to = "2021-12-31", colors = c("#61cdbb", "#97e3d5", "#e8c1a0", "#f47560"), margin = list(top = 40, right = 40, bottom = 50, left = 40), direction = "vertical", monthBorderColor = "#ffffff", dayBorderWidth = 0, dayBorderColor = "#ffffff", legends = list( list( anchor = "bottom-right", direction = "row", translateY = 36, itemCount = 4, itemWidth = 42, itemHeight = 36, itemsSpacing = 14, itemDirection = "right-to-left" ) ) )