mjs_line: metricsgraphics.js linechart "geom"

Description Usage Arguments Value Note Examples

Description

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

Usage

1
2
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

Note

If you plan on using cusom colors, all lines must have a color value or the result is non-deterministic.

Examples

1
2
3
4
data.frame(year=seq(1790, 1970, 10),
           uspop=as.numeric(uspop)) %>%
  mjs_plot(x=year, y=uspop) %>%
  mjs_line()

metricsgraphics documentation built on May 1, 2019, 8:07 p.m.