SVG¶
Wraps content in SVG container for Power BI visualization
Tip
Any measures use these UDFs must have DataCategory = "ImageUrl"
| Parameter | Type | Required | Description |
|---|---|---|---|
| width | STRING | width (pixels or percentage) | |
| height | STRING | height (pixels or percentage) | |
| viewbox | STRING | Optional: viewBox (e.g., "0 0 100 100") | |
| contents | STRING | To include one or more SVG elements (e.g., from DaxLib.SVG.Element functions) | |
| sortValue | NUMERIC | Optional: Sort value for ordering in tables |
STRING SVG string
function 'DaxLib.SVG.SVG' =
(
width : STRING,
height : STRING,
viewbox : STRING,
contents : STRING,
sortValue : NUMERIC
) =>
"data:image/svg+xml;utf8," &
"<svg " &
"width='" & width & "' height='" & height & "' " &
IF( NOT ISBLANK( viewbox ), "viewBox='" & viewbox & "' " ) &
"xmlns='http://www.w3.org/2000/svg'>" &
IF( NOT ISBLANK( sortValue ), "<desc>" & FORMAT( sortValue, "000000000000" ) & "</desc>" ) &
contents &
"</svg>"