Skip to content

Def.Paths

Generates a reusable <path> definition

DaxLib.SVG.Def.Paths( defId, d, attributes, transforms )
Name 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 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 <path> 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 & "'" ) &
        "/>"

Comments