Viz.Heatmap¶
Renders a heatmap as an SVG data URI showing data density using kernel density estimation
Kernel Density Estimation (KDE)
KDE is a statistical method that estimates the probability density function of your data by placing a "kernel" (typically a normal distribution) at each data point. The heatmap visualizes data density across the range, creating smooth gradients that reveal patterns and concentrations in your dataset.
Key Parameters:
-
Samples: Controls the resolution of the density calculation (higher = smoother, but slower performance)
-
Bandwidth: Controls the smoothing level - smaller values create sharper peaks around data points, larger values create broader, smoother distributions
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| axisRef | ANYREF EXPR | Axis reference column | ||
| measureRef | NUMERIC EXPR | Measure expression | ||
| color | STRING | BLANK() |
Optional color for high density areas. Defaults to Power BI theme color | |
| width | INT64 | 120 |
Optional: SVG width. Defaults to 120 | |
| height | INT64 | 48 |
Optional: SVG height. Defaults to 48 |
STRING SVG Heatmap
function 'DaxLib.SVG.Viz.Heatmap' =
(
axisRef: ANYREF EXPR,
measureRef: NUMERIC EXPR,
color: STRING = BLANK(),
width: INT64 = 120,
height: INT64 = 48
) =>
VAR _Marks =
DaxLib.SVG.Compound.Heatmap(
0,
0,
width,
height,
axisRef,
measureRef,
50,
1,
color
)
RETURN
IF( NOT ISBLANK( _Marks ), DaxLib.SVG.SVG( "100%", "100%", _Marks, "0 0 " & width & " " & height ) )