Skip to content

Viz.Jitter

Renders a jitter plot as an SVG data URI showing value distribution as scattered points

DaxLib.SVG.Viz.Jitter( axisRef, measureRef, color, width, height )
Parameter Type Required Description
axisRef ANYREF EXPR Axis reference column
measureRef NUMERIC EXPR Measure expression
color STRING Optional point color. Defaults to Power BI theme color
width INT64 Optional: SVG width. Defaults to 120
height INT64 Optional: SVG height. Defaults to 48

STRING SVG Jitter Plot

DaxLib.SVG.Viz.Jitter(
    Products[Product],  // axisRefColumn
    [Total Cost],       // measureRefExpr
    BLANK(),            // color (uses default theme)
    200,                // width
    60                  // height
)
// Returns an SVG data URI with an embedded jitter plot
// Set as a measure with DataCategory = "ImageUrl"
function 'DaxLib.SVG.Viz.Jitter' =
        (
            axisRef: ANYREF EXPR,
            measureRef: NUMERIC EXPR,
            color: STRING,
            width: INT64,
            height: INT64
        ) =>

            VAR _W = IF( ISBLANK( width ), 120, width )
            VAR _H = IF( ISBLANK( height ), 48, height )
            VAR _Color = IF( NOT ISBLANK( color ), color, DaxLib.SVG.Color.Theme( "Power BI", 1 ) )
            VAR _Marks =
                DaxLib.SVG.Compound.Jitter(
                    0, 0, _W, _H, 0, 0,
                    axisRef, measureRef, _Color, BLANK()
                )

            RETURN
                IF( NOT ISBLANK( _Marks ), DaxLib.SVG.SVG( "100%", "100%", "0 0 " & _W & " " & _H, _Marks, BLANK() ) )