Def.LinearGradient¶
Generates a reusable <linearGradient> definition
| Name | Type | Required | Description |
|---|---|---|---|
| defId | STRING | The unique identifier for the gradient | |
| stops | STRING | Concatenated list of one or more DaxLib.SVG.Def.GradientStop elements |
|
| x1 | STRING | Start X position | |
| y1 | STRING | Start Y position | |
| x2 | STRING | End X position | |
| y2 | STRING | End Y position |
STRING <linearGradient> definition
DaxLib.SVG.SVG(
500,
100,
"0 0 100 20",
DaxLib.SVG.Element.Defs(
DaxLib.SVG.Def.LinearGradient(
"myGradient", // id
DaxLib.SVG.Def.GradientStop(
"20%", // offset
DaxLib.SVG.Colour.Theme(
"Power BI",
25
), // colour
BLANK() // opacity
) &
DaxLib.SVG.Def.GradientStop(
"80%", // offset
DaxLib.SVG.Colour.Theme(
"Power BI",
26
), // colour
BLANK() // opacity
), // stops
BLANK(), // x1
BLANK(), // y1
BLANK(), // x2
BLANK() // y2
) // contents
) &
DaxLib.SVG.Element.Rect(
2, // x
2, // y
"80%", // width
"80%", // height
BLANK(), // rx
BLANK(), // ry
DaxLib.SVG.Attr.Shapes(
"url(""" & "#myGradient" & """)", // fill
BLANK(), // fillOpacity
BLANK(), // fillRule
BLANK(), // stroke
BLANK(), // strokeWidth
BLANK(), // strokeOpacity
BLANK() // opacity
), // attributes
BLANK() // transforms
),
BLANK() // sortValue
)
function 'DaxLib.SVG.Def.LinearGradient' =
(
defId: STRING,
stops: STRING,
x1: STRING,
y1: STRING,
x2: STRING,
y2: STRING
) =>
"<linearGradient" &
" id='" & defId & "'" &
IF( NOT ISBLANK( x1 ), " x1='" & x1 & "'" ) &
IF( NOT ISBLANK( y1 ), " y1='" & y1 & "'" ) &
IF( NOT ISBLANK( x2 ), " x2='" & x2 & "'" ) &
IF( NOT ISBLANK( y2 ), " y2='" & y2 & "'" ) &
">" &
stops &
"</linearGradient>"