svg()
Produces an SVG "svg"
element.
Syntax
svg(
id STRING,
x STRING,
y STRING,
width STRING,
height STRING,
viewBox STRING,
preserveAspectRatio STRING
RETURNS om.DomNode
- id is the SVG object identifier.
- x,
y
,width
, height define the SVG viewport. - viewBox defines the SVG viewbox.
preserveAspectRatio
is the aspect ratio to preserve.
Usage
This function creates an "svg" SVG DOM element definition from the parameters.
SVG allows to create nested svg sub-elements with their own coordinate system.
Build a tree of svg elements as you need.
Note: The root svg element must be created with the
setRootSVGAttributes()
function.The viewport is defined by the x
, y
, width
and
height
attributes.
The viewbox is defined by the viewBox
string for example as "0 0 100
100"
.
See SVG reference documentation for more details about viewport, viewbox and aspect ratio concepts.
Example
DEFINE root_svg, n om.DomNode
...
LET n = fglsvgcanvas.svg("day_1",
NULL, NULL, NULL, NULL,
"0 0 500 500",
"xMidYMid meet"
)
...
CALL root_svg.appendChild( n )