File: asRow.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 (78 lines) | stat: -rw-r--r-- 2,523 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
74
75
76
77
78
\name{asRow}
\alias{asRow}
\alias{getWidgetId}
\title{
Convenience functions for RGL HTML layouts
}
\description{
The \code{asRow} function arranges objects in a row in the display;
the \code{getWidgetId} function extracts the HTML element ID
from an HTML widget.
}
\usage{
asRow(..., last = NA, height = NULL, colsize = 1)
getWidgetId(widget)
}
\arguments{
  \item{\dots}{
Either a single \code{"combineWidgets"} object produced by
\code{asRow} or a \code{\%>\%} pipe of RGL objects, 
or several objects intended for rearrangement.
}
  \item{last}{
If not \code{NA}, the number of objects from \code{...} that
are to be arranged in a row.  Earlier ones will remain in a column.
}
  \item{height}{
An optional height for the resulting row.  This is normally specified
in pixels, but will be rescaled as necessary to fit the display.
}
  \item{colsize}{
A vector of relative widths for the columns in the row.
}
  \item{widget}{
A single HTML widget from which to extract the HTML element ID.
  }
}
\details{
Using \code{asRow} requires that the \pkg{manipulateWidget}
package is installed.

\code{asRow} produces a \code{"combineWidgets"} object which
is a single column whose last element is another \code{"combineWidgets"} object which is a single row.

If \code{n} objects are given as input and \code{last} is given a value
less than \code{n}, the first \code{n - last} objects will be displayed
in a column above the row containing the \code{last} objects.
}
\value{
\code{asRow} returns a single \code{"combineWidgets"} object suitable for display or nesting
within a more complicated display.

\code{getWidgetId} returns a character string containing the 
HTML element ID of the widget.
}
\author{
Duncan Murdoch
}

\seealso{
\link{pipe} for the \code{\%>\%} operator.  The \HTMLVignette{WebGL}{}{User Interaction in WebGL} vignette
gives more details.
}
\examples{
if (requireNamespace("manipulateWidget", quietly = TRUE) &&
    require("crosstalk", quietly = TRUE)) {
  sd <- SharedData$new(mtcars)
  ids <- plot3d(sd$origData(), col = mtcars$cyl, type = "s")
  # Copy the key and group from existing shared data
  rglsd <- rglShared(ids["data"], key = sd$key(), group = sd$groupName())
  w <- rglwidget(shared = rglsd) \%>\%
       asRow("Mouse mode: ", rglMouse(getWidgetId(.)), 
             "Subset: ", filter_checkbox("cylinderselector", 
		               "Cylinders", sd, ~ cyl, inline = TRUE),
             last = 4, colsize = c(1,2,1,2), height = 60)
  if (interactive() || in_pkgdown_example())
    w
}
}