Element.Rect¶
Generates a <rect> element
| Name | Type | Required | Description |
|---|---|---|---|
| x | STRING | The x position | |
| y | STRING | The y position | |
| width | STRING | The width (pixels or percentage) | |
| height | STRING | The height (pixels or percentage) | |
| rx | STRING | x radius for rounded corners | |
| ry | STRING | y radius for rounded corners | |
| 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 <rect> element
DaxLib.SVG.SVG(
500, // width
100, // height
"0 0 100 20", // viewbox
DaxLib.SVG.Element.Rect(
"50%", // x
"0%", // y
"40%", // width
8, // height
blank(), // rx
blank(), // ry
DaxLib.SVG.Attr.Shapes(
DaxLib.SVG.Colour.Theme(
"Power BI",
25
), // fill
0.3, // fillOpacity
BLANK(), // fillRule
DaxLib.SVG.Colour.Theme(
"Power BI",
25
), // stroke
2, // strokeWidth
0.9, // strokeOpacity
BLANK() // opacity
), // attributes
DaxLib.SVG.Transforms(
-15, // translate
5, // rotate
BLANK(), // scale
-20, // skewX
BLANK() // skewY
) // transforms
), // contents
BLANK() // sortValue
)
function 'DaxLib.SVG.Element.Rect' =
(
x: STRING,
y: STRING,
width: STRING,
height: STRING,
rx: STRING,
ry: STRING,
attributes: STRING,
transforms: STRING
) =>
"<rect" &
" x='" & x & "'" &
" y='" & y & "'" &
" width='" & width & "'" &
" height='" & height & "'" &
IF( NOT ISBLANK( rx ), " rx='" & rx & "'" ) &
IF( NOT ISBLANK( ry ), " ry='" & ry & "'" ) &
IF( NOT ISBLANK( attributes ), " " & attributes & " " ) &
IF( NOT ISBLANK( transforms ), " transform='" & transforms & "'" ) &
"/>"