Forum Discussion
DAX Measure for Conditional Color for Sparklines (SVG format)
Hi ,
Need help from experts , my client requirements
1) Draw a Sparkline using SVG (Was able to get done)
2) Based on selected Date Filter , Sparkline should be charted for last 4 quarters. (Was able to get done)
3) Client wants to change Line color using Linear Gradient based on the condition (Result Field )(I am having difficulty and need help)
7 Replies
- lbendlinSuper User
Gradients are defined a little different than your sample code.
Gradients in SVG - SVG: Scalable Vector Graphics | MDN (mozilla.org)
VAR Defs = "<defs> <linearGradient id='grad' x1='0' y1='25' x2='0' y2='50' gradientUnits='userSpaceOnUse'> <stop stop-color='green' offset='0' /> <stop stop-color='yellow' offset='50%' /> <stop stop-color='red' offset='1' /> </linearGradient> </defs>"- swasimHelper I
Yes , i dont know . Th Gradients i just copied from internet and i dont know how to resolve. how do we pass to the PBI sparkline based on condition.
I dont want this hardcoding. Line color should be based on the condition in the excel.
<stop stop-color='green' offset='0' /> <stop stop-color='yellow' offset='50%' /> <stop stop-color='red' offset='1' />Its based on the color from excel. Already based on the condition the color coding is in the excel.
- lbendlinSuper User
Your conditions change over time. That means you cannot use lines for the coloring, you would need to use single dots and color these accordingly.