Skip to content

Viz.ProgressBar

Renders a progress bar as an SVG data URI showing value progression

DaxLib.SVG.Viz.ProgressBar( valueRefExpr, trackRefExpr, color, orientation, width, height )
Parameter Type Required Default Description
valueRefExpr NUMERIC EXPR Value expression
trackRefExpr NUMERIC EXPR Track measure (maximum value)
color STRING BLANK() Optional fill color. Defaults to Power BI theme color
orientation STRING "Horizontal" Optional orientation: "Horizontal" or "Vertical". Defaults to "Horizontal"
width INT64 120 Optional: SVG width. Defaults to 120
height INT64 48 Optional: SVG height. Defaults to 48

STRING SVG Progress Bar

DaxLib.SVG.Viz.ProgressBar(
    [Completed],        // valueRefExpr
    [Target],           // trackRefExpr
    ,                   // color
    "Horizontal",       // orientation
    200,                // width
    20                  // height
)
// Returns an SVG data URI with an embedded progress bar
// Set as a measure with DataCategory = "ImageUrl"
function 'DaxLib.SVG.Viz.ProgressBar' =
        (
            valueRefExpr: NUMERIC EXPR,
            trackRefExpr: NUMERIC EXPR,
            color: STRING = BLANK(),
            orientation: STRING = "Horizontal",
            width: INT64 = 120,
            height: INT64 = 48
        ) =>

            VAR _Marks =
                DaxLib.SVG.Compound.ProgressBar(
                    0, 
                    0, 
                    width, 
                    height,
                    valueRefExpr,
                    trackRefExpr, 
                    color, 
                    "#E1DFDD",
                    orientation
                )

            RETURN
                IF( NOT ISBLANK( _Marks ), DaxLib.SVG.SVG( "100%", "100%", _Marks, "0 0 " & width & " " & height ) )