Learn R Programming

metricsgraphics (version 0.9.0)

mjs_line: metricsgraphics.js linechart "geom"

Description

This function adds a line "geom" to a metricsgraphics.js html widget.

Usage

mjs_line(mjs, area = FALSE, animate_on_load = FALSE, color = NULL, interpolate = "cardinal")

Arguments

mjs
metricsgraphics plot object
area
fill in area under line? (default: FALSE - no)
animate_on_load
animate the drawing of the plot on page load? (default: FALSE - no)
color
line color (hex string or valid HTML color string). Use NULL (the default) to use the default Metrics Graphics colors or if you plan on controlling the colors with CSS.
interpolate
the interpolation function to use when rendering lines. possible values: ("cardinal", "linear", "linear-closed", "step", "step-before", "step-after", "basis", "basis-open", "basis-closed", "bundle", "cardinal-open", "cardinal-closed", "monotone", "basic")

Value

metricsgraphics object

Examples

Run this code
data.frame(year=seq(1790, 1970, 10),
           uspop=as.numeric(uspop)) %>%
  mjs_plot(x=year, y=uspop) %>%
  mjs_line()

Run the code above in your browser using DataLab