Skip to content

Element.Line

Generates a <line> element

DaxLib.SVG.Element.Line( x1, y1, x2, y2, attributes, transforms )
Name Type Required Description
x1 STRING Starting X position (left edge is 0)
y1 STRING Starting Y position (top edge is 0)
x2 STRING Ending X position (left edge is 0)
y2 STRING Ending Y position (top edge is 0)
attributes STRING Direct SVG attributes to apply (e.g., "stroke-dasharray='5,5' marker-end='url(#arrow)'"), can generate with DaxLib.SVG.Attr.* or manually
transforms STRING Transformation to apply (can be generated with DaxLib.SVG.Transforms)

STRING <line> element

DaxLib.SVG.SVG(
    500,                // width
    100,                // height
    "0 0 100 20",       // viewbox
    DaxLib.SVG.Element.Line(
        1,              // x1
        5,              // y1
        80,             // x2
        5,              // y2
        DaxLib.SVG.Attr.Shapes(
            BLANK(),    // fill
            BLANK(),    // fillOpacity
            BLANK(),    // fillRule
            DaxLib.SVG.Colour.Theme(
                "Power BI",
                25
            ),          // stroke
            2,          // strokeWidth
            BLANK(),    // strokeOpacity
            BLANK()     // opacity
        ),              // attributes
        BLANK()         // transforms
    ),                  // contents
    BLANK()             // sortValue
)
function 'DaxLib.SVG.Element.Line' =
    (
        x1: STRING,
        y1: STRING,
        x2: STRING,
        y2: STRING,
        attributes: STRING,
        transforms: STRING
    ) =>  

        "<line" &
        " x1='" & x1 & "'" &
        " y1='" & y1 & "'" &
        " x2='" & x2 & "'" &
        " y2='" & y2 & "'" &
        IF( NOT ISBLANK( attributes ), " " & attributes & " " ) &
        IF( NOT ISBLANK( transforms ), " transform='" & transforms & "'" ) & 
        "/>"

Comments