Skip to content

Attr.Stroke

Comprehensive stroke attributes function

DaxLib.SVG.Attr.Stroke( stroke, strokeWidth, strokeOpacity, strokeDasharray, strokeDashoffset, strokeLinecap, strokeLinejoin, strokeMiterlimit, markerStart, markerMid, markerEnd )
Parameter Type Required Description
stroke STRING Stroke color (e.g., "#FF0000", "red"). Omitted if not specified
strokeWidth INT64 Stroke width. Omitted if not specified
strokeOpacity DECIMAL Stroke opacity (0-1). Omitted if not specified
strokeDasharray STRING Stroke dasharray pattern (e.g., "5,5" for dashed). Omitted if not specified
strokeDashoffset STRING Stroke dashoffset. Omitted if not specified
strokeLinecap STRING Stroke linecap ("butt", "round", "square"). Omitted if not specified
strokeLinejoin STRING Stroke linejoin ("miter", "round", "bevel"). Omitted if not specified
strokeMiterlimit STRING Miter limit for stroke joins. Omitted if not specified
markerStart STRING Marker for start of line (e.g., 'url(#arrowStart)'). Omitted if not specified
markerMid STRING Marker for middle points of line. Omitted if not specified
markerEnd STRING Marker for end of line (e.g., 'url(#arrowEnd)'). Omitted if not specified

STRING An attribute string that can be used directly in SVG elements

DaxLib.SVG.Attr.Stroke("#0000FF", 2, 1, "5,5", "0", "round", "round", "", "", "", "url(#arrow)")
// Returns "stroke='#0000FF' stroke-width='2' stroke-opacity='1' stroke-dasharray='5,5' stroke-dashoffset='0' stroke-linecap='round' stroke-linejoin='round' marker-end='url(#arrow)'"
function 'DaxLib.SVG.Attr.Stroke' =
        (
            stroke: STRING,
            strokeWidth: INT64,
            strokeOpacity: DOUBLE,
            strokeDasharray: STRING,
            strokeDashoffset: STRING,
            strokeLinecap: STRING,
            strokeLinejoin: STRING,
            strokeMiterlimit: STRING,
            markerStart: STRING,
            markerMid: STRING,
            markerEnd: STRING
        ) =>
            VAR _Stroke =           IF(NOT ISBLANK(stroke),           "stroke='" & stroke & "' ")
            VAR _StrokeWidth =      IF(NOT ISBLANK(strokeWidth),      "stroke-width='" & strokeWidth & "' ")
            VAR _StrokeOpacity =    IF(NOT ISBLANK(strokeOpacity),    "stroke-opacity='" & strokeOpacity & "' ")
            VAR _StrokeDasharray =  IF(NOT ISBLANK(strokeDasharray),  "stroke-dasharray='" & strokeDasharray & "' ")
            VAR _StrokeDashoffset = IF(NOT ISBLANK(strokeDashoffset), "stroke-dashoffset='" & strokeDashoffset & "' ")
            VAR _StrokeLinecap =    IF(NOT ISBLANK(strokeLinecap),    "stroke-linecap='" & strokeLinecap & "' ")
            VAR _StrokeLinejoin =   IF(NOT ISBLANK(strokeLinejoin),   "stroke-linejoin='" & strokeLinejoin & "' ")
            VAR _StrokeMiterlimit = IF(NOT ISBLANK(strokeMiterlimit), "stroke-miterlimit='" & strokeMiterlimit & "' ")
            VAR _MarkerStart =      IF(NOT ISBLANK(markerStart),      "marker-start='" & markerStart & "' ")
            VAR _MarkerMid =        IF(NOT ISBLANK(markerMid),        "marker-mid='" & markerMid & "' ")
            VAR _MarkerEnd =        IF(NOT ISBLANK(markerEnd),        "marker-end='" & markerEnd & "' ")

            RETURN
                _Stroke &
                _StrokeWidth &
                _StrokeOpacity &
                _StrokeDasharray &
                _StrokeDashoffset &
                _StrokeLinecap &
                _StrokeLinejoin &
                _StrokeMiterlimit &
                _MarkerStart &
                _MarkerMid &
                _MarkerEnd