Description Usage Arguments Value Receiver-specific options Transmitter-specific options Transceiver-specific options Note Examples
Use crosstool
to define generic HTML elements with limited
crosstalk functionality. These elements can be used to control
crosstalk-enabled applications and to transcode key values across
multiple crosstalk groups.
1 2 |
data |
A crosstalk SharedData object. Currently only used for the crosstalk group. |
class |
The transmitter and receiever widgets use limited uni-directional crosstalk communication. Transceiver widgets are more like normal crosstalk widgets. |
html |
A valid HTML element string. |
value |
The HTML object's I/O field name, for instance 'value' for some 'input' HTML elements. |
... |
Additional arguments passed directly to the JavaScript code (see the notes). |
width |
Widget width. |
height |
Widget height. |
An HTML widget object.
lookup optional vector; when specified use values from this vector as indexed by the crosstalk key.
channel set to "filter" to use the crosstalk filter handle (https://rstudio.github.io/crosstalk/filter.html), defaults to the crosstalk selection handle (https://rstudio.github.io/crosstalk/selection.html).
lookup optional vector; when specified use values from this vector as indexed by the crosstalk key.
init optional scalar or vector; when specified broadcast this value to the crosstalk group upon initialization.
channel set to "filter" to use the crosstalk filter handle (https://rstudio.github.io/crosstalk/filter.html), defaults to the crosstalk selection handle (https://rstudio.github.io/crosstalk/selection.html).
Note that the HTML object values specified by the value
argument are transmitted.
lookup optional vector; when specified use values from this vector as indexed by the crosstalk key.
init optional scalar or vector; when specified broadcast this value to the crosstalk group upon initialization.
relay an optinal SharedData object to relay select messages from the
data
group, optionally transcoding them through the lookup
vector. If relay
is not specified then the 2nd group defaults to
the data
crosstalk group.
channel set to "filter" to use the crosstalk filter handle (https://rstudio.github.io/crosstalk/filter.html), defaults to the crosstalk selection handle (https://rstudio.github.io/crosstalk/selection.html).
reset optional vector of crosstalk group keys; use with init
when data == relay
(one crosstalk group) to reset the initial
filter/select handle. Only happens once–after resetting the transceiver will
no longer relay messages.
Crosstool behaves differently than many other crosstalk widgets. They generally communicate uni-directionally and only on a single crosstalk channel (Filter, Select) at a time to other widgets, optionally receiving from and sending to different crosstalk groups. They may transmit raw HTML element values, say from sliders or drop-down menus. They can transcode crosstalk keys through optional lookup vectors.
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 | ## Not run:
# Debug/display crosstalk filter key state:
library(crosstalk)
library(crosstool)
library(htmltools)
library(d3scatter) # devtools::install_github("jcheng5/d3scatter")
x = iris[sample(150, 50), ]
rownames(x) = NULL
x$key = state.name
sd = SharedData$new(x, key=~key)
d1 = d3scatter(sd, x=~Petal.Length, y=~Petal.Width, color=~Species, width="100%")
d2 = d3scatter(sd, x=~Sepal.Length, y=~Sepal.Width, color=~Species, width="100%")
rx = crosstool(sd, "receiver", html="<span style='font-size:14pt;'/>", value="innerText", width="100%")
bscols(d1, d2, rx, widths=c(4,4,4))
# Use 'transmitter' to set initial selection state:
x = iris[sample(150, 50), ]
rownames(x) = NULL
x$key = state.name
sd = SharedData$new(x, key=~key)
d1 = d3scatter(sd, x=~Petal.Length, y=~Petal.Width, color=~Species, width="100%")
d2 = d3scatter(sd, x=~Sepal.Length, y=~Sepal.Width, color=~Species, width="100%")
rx = crosstool(sd, "receiver", html="<span style='font-size:14pt;'/>", value="innerText", width="100%")
Make an initial random selection and use the 'init' option
i = sample(state.name, 10)
tx = crosstool(sd, "transmitter", init=i)
bscols(d1, d2, rx, tx, widths=c(4,4,4,0))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.