Skip to content

Element.Group

Generates SVG group element Transformations applied to the element are performed on its child elements, and its attributes are inherited by its children. It can also group multiple elements to be referenced later with the element

DaxLib.SVG.Element.Group( contents, opacity, transforms )
Parameter Type Required Default Description
contents STRING Content to group (recommend including all content in a single _SvgGroup variable defined upstream)
opacity STRING BLANK() Optional: Opacity for entire group (0-1, optional)
transforms STRING BLANK() Optional: Transform (e.g., "translate(50,50) rotate(45)") (can be generated with DaxLib.SVG.Transforms)

STRING element

DaxLib.SVG.Element.Group(
    "<circle ... />", 
    "translate(10,10)", 
    0.8
    )
// Returns: <g transform='translate(10,10)' opacity='0.8'><circle ... /></g>
function 'DaxLib.SVG.Element.Group' =
        (
            contents : STRING,
            opacity : STRING = BLANK(),
            transforms : STRING = BLANK()
        ) =>

            "<g" &
            IF( NOT ISBLANK( transforms ), " transform='" & transforms & "'" ) &
            IF( NOT ISBLANK( opacity ), " opacity='" & opacity & "'" ) &
            ">" & contents & "</g>"