Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I have created a tree visualisation in VEGA within the deneb visual, and i am just looking for a little bit of VEGA help as i am currently on the learning curve of from Vega-Lite to Vega.
Now basically what i am trying to achieve is to format the color or the dash of the links between nodes based on a field in my data, the field is called relationship.
For example when the relationship field is X, i need the link between nodes to either be dashed or red.
The snippet of VEGA below is the path mark that i used to create the links between nodes.
{
"type": "path",
"from": {"data": "links"},
"encode": {
"update": {
"path": {"field": "path"},
"stroke": {"value": "#ccc"}
}
}
},
Any help is very much appreciated.
@giammariam not sure if this is something you could lend any advice to, TIA.
Solved! Go to Solution.
Hi, @DW868990
Maybe you can try the following VEGA code:
{
"type": "path",
"from": {"data": "links"},
"encode": {
"update": {
"path": {"field": "path"},
"stroke": {
"condition": [
{"test": "datum.relationship == 'X'", "value": "red"},
{"test": "datum.relationship == 'Y'", "value": "blue"} // Example for another condition
],
"value": "#ccc" // Default color
},
"strokeDash": {
"condition": [
{"test": "datum.relationship == 'X'", "value": [5, 5]} // Example for dashed line
],
"value": null // Default to solid line
}
}
}
}
It is recommended that you read the official VEGA tutorial:
As you learn VEGA, we recommend that you read up on other excellent VEGA code:
Vega Data Visualization Examples - Power of Business Intelligence (powerofbi.org)
Explore examples and get inspired | Observable (observablehq.com)
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @DW868990
Maybe you can try the following VEGA code:
{
"type": "path",
"from": {"data": "links"},
"encode": {
"update": {
"path": {"field": "path"},
"stroke": {
"condition": [
{"test": "datum.relationship == 'X'", "value": "red"},
{"test": "datum.relationship == 'Y'", "value": "blue"} // Example for another condition
],
"value": "#ccc" // Default color
},
"strokeDash": {
"condition": [
{"test": "datum.relationship == 'X'", "value": [5, 5]} // Example for dashed line
],
"value": null // Default to solid line
}
}
}
}
It is recommended that you read the official VEGA tutorial:
As you learn VEGA, we recommend that you read up on other excellent VEGA code:
Vega Data Visualization Examples - Power of Business Intelligence (powerofbi.org)
Explore examples and get inspired | Observable (observablehq.com)
How to Get Your Question Answered Quickly
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Jianpeng Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
User | Count |
---|---|
86 | |
85 | |
68 | |
67 | |
63 |
User | Count |
---|---|
210 | |
118 | |
116 | |
81 | |
74 |