Internal function that creates an interactive MAIDR widget from a ggplot object. This is called internally by render_maidr() and should not be called directly. Use maidr_output() and render_maidr() for Shiny integration instead.
Usage
maidr_widget(
plot,
use_cdn = NULL,
width = NULL,
height = NULL,
element_id = NULL,
fig_width = NULL,
fig_height = NULL,
hover_mode = NULL,
...
)Arguments
- plot
A ggplot object, a lattice (trellis) object, or NULL to auto-detect recorded Base R plots
- use_cdn
Logical. Controls where MAIDR.js is loaded from, matching
show()andsave_html():TRUE: Use CDN (requires internet), loading the latest published MAIDR.js unlessmaidr.cdn_versionpins oneFALSE: Use local bundled files (works offline)NULL(default): Auto-detect based on internet availability
This differs from
maidr_html_dependencies(), whereNULLmeans bundled. The widget renders throughcreate_maidr_iframe()andcreate_standalone_html(), which probes for connectivity, so an unsetuse_cdnloads from the CDN on a machine that is online.- width
The width of the widget in pixels or CSS units (default: NULL for auto-sizing)
- height
The height of the widget in pixels or CSS units (default: NULL for auto-sizing)
- element_id
A unique identifier for the widget (default: NULL for auto-generated)
- fig_width, fig_height
The size to draw the chart at, in inches, as
widthandheightset it inshow(): each a single positive number no larger than 50, orNULL(the default) for 7 x 5 in, 12 x 6 in for a candlestick chart. Not the widget's size, whichwidthandheightset; a chart wider than the widget shrinks to fit it.- hover_mode
The chart's starting hover mode, as in
show():"pointermove","click"or"off", orNULL(the default) forgetOption("maidr.hover_mode").- ...
Additional arguments passed to create_maidr_html()