Description Usage Arguments Details Value Author(s) References See Also Examples
This package allows one to show files in a web page produced by the SVG deices in RSVGTipsDevice or SVGAnnotation. The former allows one to easily place tooltips and links to URLs, the latter allows for some very fancy javascripting to make dynamic graphics.
1 |
f |
optional filename storing file with output |
width |
width of canvas in pixels |
height |
height of canvas in pixels |
container |
parent container for processing object |
... |
not used |
The SVG devices are non-interactive device and requires a file to be
written to the file system. These files should have a .svg
extension as they are severd from a web page. As such, there are
facilities to create a temporary file in a public webspace
getStaticTempFile
. This function uses the variable
gWidgetsWWWStaticDir
which must be configured for
RApache. The function convertStaticFileToUrl
gives the URL for the file on the file system.
The svalue<-
method is used to update the graphic.
Unlike the gcanvas
widget, only the constructor needs the
width and height specified. The SVG graphics "S"cale to fill the
allotted space.
Adding a handler to this device is not yet supported. However, the
SVGAnnotation package allows one to do very interesting things
with svg graphic files.
The gcanvas
widget is a similar function for providing graphical output within a browser.
Returns a proto object with class gSvg.
John Verzani
The RSVGTipsDevice
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
w <- gwindow("svg test")
g <- ggroup(cont = w)
sg <- gsvg(cont = g)
makePlot <- function() {
require(RSVGTipsDevice, quietly=TRUE, warn=FALSE) # must require within callback
f <- getStaticTmpFile(ext=".svg") ## use the extension or paste later
devSVGTips(f)
plot(rnorm(100))
dev.off()
f
}
svalue(sg) <- makePlot()
## can update
b <- gbutton("click me", cont = g, handler = function(h,...) {
svalue(sg) <- makePlot()
})
visible(w) <- TRUE
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.