addLink: Add a hyperlink to an SVG element

Description Usage Arguments Value Author(s) References See Also Examples

Description

This makes an SVG element "clickable" via a hyperlink which will view the URL.

Usage

1
addLink(n, url, addArea = NA, css = getDefaultSVGCSS(), style = "link", silent = FALSE, ...)

Arguments

n

the XML/SVG node

url

the target of the link

addArea

a logical value indicating whether to create a new rectangle node as the area the link will be active and put the existing contents of n into the rectangle. The dimensions of the rectangle are calculated from the contents of n.

css

the CSS content (file or string) to add to the document if style is not an inlined CSS style but the name of a CSS class.

style

a character string giving the name of the CSS class to use for any new SVG element that might be added to represent the event area, i.e. if a rectangle is added to "enclose" text or a phrase. This can be be either a class name or an inline CSS specification of the form "name: value; name: value; ...". To remove any ambiguity about whether it is a class name or inine specfication of CSS values, one can use I to indicate it is a collection of CSS values, e.g. style = I("fill: red; stroke: orange;")

silent

a logical controlling whether addCSS emits a warning if there is a directive to load the CSS file is already in the target document.

...

additional parameters for methods

Value

The newly created link node, i.e. the <a xlink:href=".."> element. The return value is typically not important as the node has been added to the document.

Author(s)

Duncan Temple Lang

References

The SVG specification http://www.w3.org/Graphics/SVG/

See Also

addAxesLinks

Examples

1
2
3
4
5
6
7
8
9
  doc = svgPlot(plot(1:10, main = "The SVGAnnotation Package"))
  nodes = getAxesLabelNodes(doc)
  addLink(nodes, c("http://ww.r-project.org",
                    "http://www.omegahat.org",
                    "http://www.omegahat.org/SVGAnnotation"))

  nodes = getPlotPoints(doc)
  addLink(nodes,
           paste("http://ww.r-project.org", seq(along = nodes), sep =""))

duncantl/SVGAnnotation documentation built on May 15, 2019, 5:57 p.m.