Description Usage Arguments Value Author(s) References See Also
This is a high-level, reasonably specialized function for adding interactive controls to an SVG document that dynamically (i.e. at viewing time) control the visiblity/invisibility of elements on the plot. It was developed to toggle the appearance of curves (time series) in a matplot and also across panels in a lattice plot.
This uses the SVG widgets from Andreas Neumann to allow the viewer to toggle the elements displayed in the viewing region of the plot.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | radioShowHide(doc, insertScripts = TRUE, within = FALSE,
group = FALSE,
labels = paste("Series", seq(length = numSeries)),
extraWidth = 15 * (max(nchar(labels)) + 1),
save = if(!is(doc, "XMLInternalDocument")) doc,
id.prefix = "series",
checkboxCallback = if (is.na(within))
"togglePanel"
else
"toggle",
jscripts = c("helper_functions.js",
"timer.js",
"checkbox_and_radiobutton.js",
"hideSVGElements.js"),
numPanels = 1)
|
doc |
the SVG plot, given as either a file name or the XML tree
returned from |
insertScripts |
a logical value indicating whether to insert the specified JavaScript code or merely use a reference to the files in the SVG document. |
within |
a logical value that indicates whether the plot was created
with a call to |
group |
unused! |
labels |
a character vector giving the labels to display beside the checkboxes. There should be one for each series/element in the plot. |
extraWidth |
the amount of horizontal space (in pixels?) that we add to the SVG viewbox to accomodate the check boxes. |
save |
a logical value that |
id.prefix |
a character string giving a value that is used as a
prefix for the |
checkboxCallback |
the name of the JavaScript function which is to be invoked at viewing time when the state of a check box is changed/toggled. |
jscripts |
a character vector giving the names of the JavaScript files needed to provide the viewing time functionality. |
numPanels |
the number of panels in the plot. This is relevant for lattice plots. |
Either the updated SVG document or the name of the file to which it was written. The function is called for its side effect on the SVG document.
Duncan Temple Lang
http://www.carto.net/papers/svg
addSlider
illustrates adding a different GUI component.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.