Skip to content

Def.Paths

Create a reusable path definition

DaxLib.SVG.Def.Paths( defId, d, attributes, transforms )
Parameter Type Required Description
defId STRING The unique identifier for the path
d STRING The path data string (e.g., "M10 10 L90 90")
attributes STRING Optional: Direct SVG attributes to apply (e.g., "fill='none' stroke='blue'"), can generate with DaxLib.SVG.Attr.* or manually
transforms STRING Optional: Transformation to apply (can be generated with DaxLib.SVG.Transforms)

STRING definition

DaxLib.SVG.Def.Paths(
    "myPath",
    "M10 10 L90 90",
    DaxLib.SVG.Attr.Shapes(
        "none",     // fill
        BLANK(),    // fillOpacity
        BLANK(),    // fillRule
        "black",    // stroke
        2,          // strokeWidth
        BLANK(),    // strokeOpacity
        BLANK()     // opacity
    ),
    BLANK()
)
// Returns: <path id='myPath' d='M10 10 L90 90' fill='none' stroke='black' stroke-width='2' />
function 'DaxLib.SVG.Def.Paths' =
        (
            defId: STRING,
            d: STRING,
            attributes: STRING,
            transforms: STRING
        ) =>

            "<path id='" & defId & "'" &
            " d='" & d & "'" &
            IF( NOT ISBLANK( attributes ), " " & attributes & " " ) &
            IF( NOT ISBLANK( transforms ), " transform='" & transforms & "'" ) &
            "/>"