| vol_widget | R Documentation |
Puts the viewer in an R Markdown document, a shiny
application or the RStudio viewer, driving the same page that
vol_standalone() writes.
vol_widget(
payload,
options = list(),
panel = TRUE,
width = NULL,
height = NULL,
elementId = NULL,
inputId = NULL
)
payload |
A |
options |
Named list of viewer settings applied once the page has loaded. Any state key the page carries is reachable; see Details. |
panel |
Logical. Draw the control panel of the page, which is the
default and is what |
width, height |
Widget size, passed to htmlwidgets. |
elementId |
Optional element identifier. |
inputId |
Identifier under which the widget reports back to shiny.
Set it to the output identifier when the widget is rendered with
|
Render a payload as a widget
The widget hosts the viewer in a frame of its own and talks to it with messages, so there is one renderer behind the file, the widget and the application, and no second copy to keep in step.
The settings options accepts are the ones the panel exposes: the camera
as azim, elev, dist, panX and panY; the colour scale as vmin,
vmax, gamma and cmapRow; the density as od and ow; the geometry
as zex, d0, d1, x0, x1, y0, y1 and ortho; the depth slab as
slab, slabT, slabZ and slabNorm; the motions as spin and sweep;
the quality as steps and adaptive; and the appearance as light,
showLand, showBox and panel.
Inside shiny the widget reports three events through
shiny::observeEvent(): <inputId>_ready when the payload has loaded,
carrying the grid and the depth span; <inputId>_camera whenever the
camera settles; and <inputId>_snapshot when a snapshot has been taken.
An object of class htmlwidget.
vol_payload() for the payload, vol_widget_output() and
render_vol_widget() for the shiny pair, vol_snapshot() to save a
PNG from the server, shinyVolumr() for the whole workflow.
w <- vol_widget(vol_example_payload(),
options = list(slab = TRUE, slabT = 25, slabZ = 50))
class(w)
if (interactive()) w
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.