aDataScene-shiny {shinyaframe} | R Documentation |
Shiny bindings for aDataScene
Description
Output and render functions for using aDataScene within Shiny applications.
Usage
aDataSceneOutput(outputId, ..., skipDependencies = FALSE)
renderADataScene(expr, env = parent.frame(), quoted = FALSE)
Arguments
outputId |
output variable to read from |
... |
Attributes, A-Frame components, and/or child elements for output in HTML. |
skipDependencies |
Option to omit packaged A-Frame JavaScript libraries. See details. |
expr |
An expression that returns a call to |
env |
The environment in which to evaluate |
quoted |
Is |
Details
A-Frame v0.7.1, gg-aframe v0.2.3, and
aframe-environment-component v1.0.0 come packaged with
shinyaframe. To use different versions, set skipDependencies
to TRUE
and source the libraries directly (for
example with includeScript
or
tag
).
See Also
'gg-aframe' syntax documentation
Examples
# Simple 3D scatterplot.
# See package vignette for additional asethetics, guides, and legends
if (interactive()) {
library(dplyr)
library(shiny)
library(scales)
shinyApp(
ui = fluidPage(
aDataSceneOutput(
outputId = "mydatascene",
# gg-aframe plot syntax
atags$entity(
plot = "", position = "0 1.6 -1.38", rotation = "0 45 0",
atags$entity(
`layer-point` = "", `mod-oscillate` = "",
`data-binding__sepal.length`="target: layer-point.x",
`data-binding__sepal.width`="target: layer-point.y",
`data-binding__petal.length`="target: layer-point.z",
# add 4th positional by animating y position between two mappings
`data-binding__petal.width`="target: mod-oscillate.y",
`data-binding__species`="target: layer-point.shape"
)
)
)
),
server = function(input, output, session) {
output$mydatascene <- renderADataScene({
names(iris) <- tolower(names(iris))
iris %>%
# scale positional data
mutate_if(is.numeric, rescale) %>%
aDataScene()
})
}
)
}
[Package shinyaframe version 1.0.1 Index]