Viz.Bars¶
Renders a bar chart as an SVG data URI showing measure values across an axis
DaxLib.SVG.Viz.Bars( axisRef, measureRef, color, minMarkColor, maxMarkColor, showAxis, width, height )
| Parameter | Type | Required | Description |
|---|---|---|---|
| axisRef | ANYREF EXPR | Axis reference column | |
| measureRef | NUMERIC EXPR | Measure expression | |
| color | STRING | Optional series color. Defaults to theme color | |
| minMarkColor | STRING | Optional: The hex color for the minimum value bar | |
| maxMarkColor | STRING | Optional: The hex color for the maximum value bar | |
| showAxis | BOOLEAN | Optional axis toggle. Defaults to FALSE | |
| width | INT64 | Optional: SVG width. Defaults to 120 | |
| height | INT64 | Optional: SVG height. Defaults to 48 |
STRING SVG Bar Chart
DaxLib.SVG.Viz.Bars(
Dates[Date], // axisRefColumn
[Total Cost], // measureRefExpr
BLANK(), // color (uses default theme)
BLANK(), // minMarkColor
BLANK(), // maxMarkColor
TRUE, // showAxis
200, // width
60 // height
)
// Returns an SVG data URI with an embedded bar chart
// Set as a measure with DataCategory = "ImageUrl"
function 'DaxLib.SVG.Viz.Bars' =
(
axisRef: ANYREF EXPR,
measureRef: NUMERIC EXPR,
color: STRING,
minMarkColor: STRING,
maxMarkColor: STRING,
showAxis: BOOLEAN,
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.Bars(
0, 0, _W, _H, 0, 0,
axisRef, measureRef, _Color, minMarkColor, maxMarkColor, showAxis, 8
)
RETURN
IF( NOT ISBLANK( _Marks ), DaxLib.SVG.SVG( "100%", "100%", "0 0 " & _W & " " & _H, _Marks, BLANK() ) )