Skip to content

Element.Circle

Generates a <circle> element

DaxLib.SVG.Element.Circle( cx, cy, r, attributes, transforms )
Name Type Required Description
cx STRING The x position of the center
cy STRING The y position of the center
r STRING The radius
attributes STRING Direct SVG attributes to apply (e.g., "fill='red' stroke-width='2'"), can generate with DaxLib.SVG.Attr.* or manually
transforms STRING Transformation to apply (can be generated with DaxLib.SVG.Transforms)

STRING <circle> element

DaxLib.SVG.SVG(
    500,                // width
    100,                // height
    "0 0 100 20",       // viewbox
    DaxLib.SVG.Element.Circle(
        50,             // cx
        10,             // cy
        "10%",          // r
        DaxLib.SVG.Attr.Shapes(
            DaxLib.SVG.Colour.Theme(
                "Power BI",
                25
            ),              // fill
            0.5,            // fillOpacity
            BLANK(),        // fillRule   
            DaxLib.SVG.Colour.Theme(
                "Power BI",
                25
            ),              // stroke
            1,              // strokeWidth
            BLANK(),        // strokeOpacity
            BLANK()         // opacity
        ),              // attributes
        BLANK()         // transforms
    ),                  // contents
    BLANK()             // sortValue
)
function 'DaxLib.SVG.Element.Circle' = 
    (
        cx: STRING,
        cy: STRING,
        r: STRING,
        attributes: STRING,
        transforms: STRING
    ) =>

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

Comments