Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Tengo un gráfico de burbujas en Power BI que hice usando el objeto visual de Deneb en Vega-lite. Soy nuevo en Vega-lite, así que todavía estoy aprendiendo. Quiero que cada burbuja tenga una etiqueta con el título de esa fila. Sin embargo, quiero que las etiquetas no se superpongan si es posible. ¿Hay alguna manera de hacer que las etiquetas no se superpongan? Las etiquetas también se superponen a la leyenda de la derecha. También estaba pensando en filtrar para que solo las burbujas más grandes tengan una etiqueta, pero tampoco estoy seguro de cómo hacerlo.
Aquí hay una captura de pantalla que muestra cómo las etiquetas se superponen entre sí y la leyenda.
Aquí está mi script con algunos datos ficticios para mostrar el problema:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"name": "dataset"
},
"width": 950,
"height": 400,
"encoding": {
"x": {
"field": "Date",
"type": "temporal",
"axis": {"grid": false, "format":"Q%q %Y"}
},
"y": {
"field": "Prob",
"type": "quantitative",
"axis": {"title": "prob"}
},
"tooltip" : [
{"field":"Title", "type": "nominal"},
{"field":"Group", "type": "nominal"},
{"field":"Section", "type": "nominal"},
{"field":"Amount", "type": "nominal"},
{"field":"ID#", "type":"nominal"},
{"field":"Description", "type":"nominal"}
]
},
"layer":[{
"mark":{
"type": "circle",
"opacity": 0.8,
"stroke": "black",
"strokeWidth": 1
},
"encoding": {
"size": {
"field": "Amount",
"type": "quantitative",
"title": "",
"legend": "",
"scale": {"rangeMax": 1000}
},
"color": {
"field": "Group",
"type": "nominal"
}
}
},
{
"mark":{
"type": "circle",
"opacity": 0.8,
"stroke": "black",
"strokeWidth": 1
},
"encoding": {
"size": {
"field": "Amount",
"type": "quantitative",
"title": "",
"legend": "",
"scale": {"rangeMax": 1000}
},
"color": {
"field": "Group",
"type": "nominal"
}
}
},
{
"mark":{
"type": "text",
"align": "left",
"baseline": "top",
"dx":8,
"limit":150,
"angle":-25
},
"encoding": {
"text":{"field":"Title", "type":"nominal"}
},
"transform": [
{
"type": "label",
"anchor": ["top", "bottom", "right", "left"],
"offset": [1],
"size": {"signal": "[width + 60, height]"}
}
]
}
]
}
Hola @asodie,
Actualmente no es posible en Vega-Lite, pero Vega tiene una transformación de etiqueta que se puede usar para evitar la superposición de marcas de texto. Portar esto a Vega-Lite está en la hoja de ruta, pero los desarrolladores no tienen ETA en este momento. Si esto es algo que necesitas, entonces tendrás que convertir tu especificación para usar Vega en lugar de Vega-Lite.
Saludos
Daniel
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.