File: toggleWidget.Rd

package info (click to toggle)
rgl 1.3.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,968 kB
  • sloc: cpp: 23,234; ansic: 7,462; javascript: 6,125; sh: 3,555; makefile: 2
file content (73 lines) | stat: -rw-r--r-- 2,080 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
\name{toggleWidget}
\alias{toggleWidget}
\title{
An HTML widget to toggle display of elements of a scene
}
\description{
This function produces a button in an HTML scene
that will toggle the display of items in the scene.
}
\usage{
toggleWidget(sceneId, 
             ids = tagged3d(tags), tags = NULL, hidden = integer(),
             subscenes = NULL, 
             label, 
             ...)
}
\arguments{
  \item{sceneId}{
The HTML id of the RGL scene being controlled,
or an object as in \code{\link{playwidget}}.
}
  \item{ids, hidden}{
The RGL id numbers of the objects to toggle.  Those in \code{ids}
are initially shown; those in \code{hidden} are initially hidden.
}
  \item{tags}{
  Alternate way to specify \code{ids}.  Ignored if \code{ids} is
given.
  }
  \item{subscenes}{
The subscenes in which to toggle the objects.
}
  \item{label}{
The label to put on the button.  The default is set
from the expression passed to \code{ids} or the value of \code{tags}. 
}
  \item{\dots}{
Additional arguments to pass to \code{\link{playwidget}}.
}
}
\details{
Like \code{\link{playwidget}}, this function is designed
to work within the \pkg{htmlwidgets} framework.  
If the value is printed, the button will be inserted
into the output.

It is also designed to work with \pkg{magrittr}-style
pipes:  the result of \code{\link{rglwidget}} or
other widgets can be piped into it to add it 
to a display.  It can also appear first in the 
pipeline, if \code{sceneId} is set to \code{NA}.
}
\value{
A widget suitable for use in an \pkg{Rmarkdown}-generated web
page, or elsewhere.
}
\author{
Duncan Murdoch
}
\seealso{
\code{\link{toggleButton}} for the older style
of HTML control.  The \HTMLVignette{WebGL}{}{User Interaction in WebGL} vignette
gives more details.
}
\examples{
theplot <- plot3d(rnorm(100), rnorm(100), rnorm(100), col = "red")
widget <- rglwidget(height = 300, width = 300) \%>\%
  toggleWidget(theplot["data"], 
               hidden = theplot[c("xlab", "ylab", "zlab")], 
               label = "Points")
if (interactive() || in_pkgdown_example())
  widget
}