Description Usage Arguments Details Value Note Examples
mjs_plot()
initializes the metricsgraphics.js html widget
and takes a data frame & (bare or quoted) x & y column names as minimum input.
This must be piped to a "geom" (metricsgraphics.js only supports single
"geom" layers) and can also be piped to other mjs_
functions that
manipulate aesthetics.
1 2 3 4 |
data |
data frame |
x |
bare or quoted name of column to use for x values |
y |
bare or quoted name of column to use for y values |
show_rollover_text |
determines whether or not to show any text when a data point is rolled over. |
linked |
inks together all other graphs whose linked option is set to true.
When one graphic in that set is rolled over, the corresponding values in the other
graphics are also rolled over (default: |
decimals |
the number of decimals to show in a rollover (default: |
format |
sets the format of the data object, which is to say,
|
missing_is_hidden |
if true and if the data object is a time series, missing data points will be treated as zeros |
left |
the size of the left margin in pixels. |
right |
the size of the right margin in pixels. |
top |
the size of the top margin in pixels. |
bottom |
the size of the bottom margin in pixels. |
buffer |
the buffer size in pixels between the actual chart area and the margins. |
width |
Width in pixels (optional, defaults to automatic sizing) |
height |
Height in pixels (optional, defaults to automatic sizing) |
title |
plot title |
description |
plot description |
See MetricsGraphics.js for more information.
metricsgraphics object
Plot title
and description
work best when the widget is in
a Bootstrap template. They also increase the overall plot area (height,
mostly) since they add <div>
s. The description
will be
visible in the upper left area (on ?
hover) if not displayed
in a Boostrap template.
1 2 3 4 5 6 7 8 9 10 11 | data.frame(year=seq(1790, 1970, 10),
uspop=as.numeric(uspop)) %>%
mjs_plot(x=year, y=uspop) %>%
mjs_line()
# accessor params can also be quoted
data.frame(year=seq(1790, 1970, 10),
uspop=as.numeric(uspop)) %>%
mjs_plot(x="year", y="uspop") %>%
mjs_line()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.