Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hola
He estado tratando de crear gráficos de viñetas dentro de la tabla con variables. No funciona y genera el icono de "imagen". Apuesto a que es un problema relacionado con el código SVG, pero como no soy un experto en él y no puedo encontrar una solución para resolver este problema, estaría encantado de obtener ayuda 🙂 Aquí está el código a continuación, ¡gracias de antemano!
Bullet =
VAR vBackground = "%23ffffff"
VAR vBarColor = Switch(
True(),
[losspln] <= [targetpln], "%2339a964",
[targetpln] = 0, "%23ffa160",
[losspln] > [targetpln], "%23cd1319"
)
VAR vActBarColor = "%23333333"
VAR vTargetBarColor = "%23888888"
// Base Text for drawing
VAR vBaseText =
"data:image/svg+xml;utf8, <svg width='100' height='100' version='1.1' xmlns='http://www.w3.org/2000/svg' style= 'background: " & vBackground & "'>
<rect x='0' y='25' rx='2' ry='2' width='100' height='50' style='fill:" & vBarColor & ";stroke-width:0;fill-opacity:1' />
<rect x='0' y='45' rx='2' ry='2' width=""#Actual"" height='10' style='fill:" & vActBarColor & ";stroke-width:0;fill-opacity:1' />
<rect x=""#Budget"" y='30' rx='2' ry='2' width='6' height='40' style='fill:" & vTargetBarColor & ";stroke:black;stroke-width:0;fill-opacity:1;stroke-opacity:1' />
</svg>"
VAR vObjects = ALL(Resource[Resource Short])
VAR vMaxActual = MAXX( vObjects, [losspln] )
VAR vMaxGoal = MAXX( vObjects, [targetpln] )
VAR vXAxisRangeBase = MAX( vMaxActual, vMaxGoal )
VAR vActual = INT( DIVIDE( [losspln], vXAxisRangeBase ) * 90 )
VAR vGoal = INT( DIVIDE( [targetpln], vXAxisRangeBase ) * 90 )
VAR vReturn = SUBSTITUTE( SUBSTITUTE( vBaseText, "#Actual", vActual ), "#Goal", vGoal )
RETURN IF( [losspln], vReturn, BLANK() )
Solved! Go to Solution.
¿Qué muestra el código svg cuando lo cambias a texto y lo ves en modo de enfoque?
Tendrás que tener cuidado de que tus valores de anchura y altura se escapen correctamente...
width=""#Actual"" tendrá que ser algo así como... width="&"'"&"#Actual"&"'"&"
¿Qué muestra el código svg cuando lo cambias a texto y lo ves en modo de enfoque?
Tendrás que tener cuidado de que tus valores de anchura y altura se escapen correctamente...
width=""#Actual"" tendrá que ser algo así como... width="&"'"&"#Actual"&"'"&"
Sí, eso obviamente era un problema con los apóstrofos. Cambiado también ' a ""
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |