Skip to content

Def.Circle

Generates a reusable <circle> definition

DaxLib.SVG.Def.Circle( defId, cx, cy, r, attributes, transforms )
Name Type Required Description
defId STRING The unique identifier for the circle
cx STRING X center coordinate
cy STRING Y center coordinate
r STRING Radius
attributes STRING Direct SVG attributes to apply (e.g., "fill='none' stroke='blue'"), can generate with DaxLib.SVG.Attr.* or manually
transforms STRING Transformation to apply (can be generated with DaxLib.SVG.Transforms)

STRING <circle> definition

DaxLib.SVG.Def.Circle(
    "myCircle", 
    "50", 
    "50", 
    "40", 
    DaxLib.SVG.Attr.Shapes(
        "red",      // fill
        BLANK(),    // fillOpacity
        BLANK(),    // fillRule
        "blue",     // stroke
        2,          // strokeWidth
        BLANK(),    // strokeOpacity
        BLANK()     // opacity
    ), 
    BLANK()
)
// Returns: <circle id='myCircle' cx='50' cy='50' r='40' fill='red' stroke='blue' stroke-width='2' />
function 'DaxLib.SVG.Def.Circle' = 
    (
        defId: STRING,
        cx: STRING,
        cy: STRING,  
        r: STRING,
        attributes: STRING,
        transforms: STRING
    ) =>

        "<circle id='" & defId & "'" &
        " cx='" & cx & "'" &
        " cy='" & cy & "'" &
        " r='" & r & "'" &
        IF( NOT ISBLANK( attributes ), " " & attributes & " " ) &
        IF( NOT ISBLANK( transforms ), " transform='" & transforms & "'" ) &
        "/>"

Comments