This package is an interface to the morris.js charting library.
devtools::install_github("tutuchan/morrisjs")
morrisjs(mdeaths) %>%
mjsLine
morrisjs(mdeaths) %>%
mjsBar
morrisjs(mdeaths) %>%
mjsArea
morrisjs(list(c("Label 1", "Label 2"), c(10, 20))) %>%
mjsDonut
For lines, areas and bars, inputs can be either ts
, xts
or mts
:
morrisjs(mdeaths) %>%
mjsLine
morrisjs(ts.union(fdeaths, mdeaths)) %>%
mjsLine
They can also be data.frame
s or tbl_df
s with the first column being of class Date
:
df <- dplyr::data_frame(date = as.Date(c("2011-01-01", "2011-02-01", "2011-03-01")),
series1 = rnorm(3), series2 = rnorm(3))
morrisjs(df) %>%
mjsLine
For donuts, inputs should be a list of two elements: a vector of characters and a vector of numerics.
All options are listed on the morris.js github page and can be passed as parameters to the mjs
functions.