Skip to content

Tutuchan/morrisjs

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Build Status

morris.js for R - 0.2.4

This package is an interface to the morris.js charting library.

Installation

devtools::install_github("tutuchan/morrisjs")

Examples

Line chart

morrisjs(mdeaths) %>% 
  mjsLine()

Bar chart

morrisjs(mdeaths) %>% 
  mjsBar()

Area chart

morrisjs(mdeaths) %>% 
  mjsArea()

Donut chart

morrisjs(list(c("Label 1", "Label 2"), c(10, 20))) %>% 
  mjsDonut()

Inputs

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.frames or tbl_dfs with the first column being of class Date:

df <- tibble::tibble(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.

Options

All options are listed on the morris.js github page and can be passed as parameters to the mjs* functions.

About

An interface to the morris.js charting library.

Resources

License

Stars

Watchers

Forks

Packages

No packages published