Skip to content

Viz.Boxplot

Renders a box plot as an SVG data URI showing statistical distribution

DaxLib.SVG.Viz.Boxplot( axisRef, measureRef, color, showOutliers, width, height )
Parameter Type Required Default Description
axisRef ANYREF EXPR Axis reference column
measureRef NUMERIC EXPR Measure expression
color STRING BLANK() Optional box fill color. Defaults to Power BI theme color
showOutliers BOOLEAN FALSE() Optional: show outlier points. Defaults to FALSE
width INT64 120 Optional: SVG width. Defaults to 120
height INT64 48 Optional: SVG height. Defaults to 48

STRING SVG Box Plot

DaxLib.SVG.Viz.Boxplot(
    Products[Product],  // axisRef
    [Total Cost],       // measureRef
    ,                   // color
    TRUE,               // showOutliers
    200,                // width
    60                  // height
)
// Returns an SVG data URI with an embedded box plot
// Set as a measure with DataCategory = "ImageUrl"
function 'DaxLib.SVG.Viz.Boxplot' =
        (
            axisRef: ANYREF EXPR,
            measureRef: NUMERIC EXPR,
            color: STRING = BLANK(),
            showOutliers: BOOLEAN = FALSE(),
            width: INT64 = 120,
            height: INT64 = 48
        ) =>

            VAR _Marks =
                DaxLib.SVG.Compound.Boxplot(
                    0, 
                    0, 
                    width, 
                    height,
                    axisRef,
                    measureRef, 
                    color
                )

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