Skip to content

Defs

This section documents SVG definition (defs) functions, which allow you to define reusable SVG elements such as <linearGradient>, <clipPath>, and shapes. Shapes can be reused by invoking them with DaxLib.SVG.Element.UseDef(), providing the matching id. The use of Defs to define Shapes which are invoked multiple times can reduce overall SVG string length and improve performance in Power BI.

Defining Defs

DaxLib.SVG.Def.* should be wrapped in DaxLib.SVG.Element.Defs() to add <defs>...</defs> tags.

DaxLib.SVG.Element.Defs(
        DaxLib.SVG.Def.Circle(...) &
        DaxLib.SVG.Def.Rect(...)
)
// Returns: <defs>...</defs>