Forum Discussion
Azure Map conditional line color
Hi,
Is it possible to conditionally change the color of a path line in the Azure Map visual? I can conditionally change the color of the bubbles but not the line.
I need to indicate during a trip if the vehicle was above a specific speed by coloring the line with a different color.
This is what I have for now:
I need something like this:
Hi LangMan123
This is my workaround suggestion:
- Create a Legend column for your red and green paths.
- Duplicate the red lines as green and merge them into your main table.
- Create a Legend Sort Order column and assign a higher number to the red line.
- Use the Sort by Column option to sort the Legend column using this sort order column.
I have attached the sample I created for your reference.
10 Replies
- rohit1991Super User
Hii LangMan123
Line color is a single static setting for the entire path, so you can’t change it dynamically based on speed or any other condition.
Workarounds: split the route into multiple line layers (or separate records) by speed band so each layer has a fixed color, or use points/bubbles (which do support conditional coloring) or a custom map visual if true conditional line coloring is required.- LangMan123Regular Visitor
Only method kind of working is by using the bubbles, but the client would like to see this on the line without bubbles.
Do you know of any custom map visual? I tried RouteMap but it's using Bing maps which are not supported any longer.
- JamieHoldingResolver I
Yes this is possible, you just need a way of grouping them (Path ID) and an order of the grouping (Path Order) so PBI knows how to sequence them. You can then change the colours based on a legend.
This Video illustrates the point. Let me know how you get on!
- LangMan123Regular Visitor
I tried and it's not working. When I use the Path ID for speeding and not, it creates two seperate routes, one for speeding and one for not speeding.
- JamieHoldingResolver I
As rohit1991 explained, you'd need to split each speeding/non-speeding segment into parts, so you'd end up with multiple speeding/non-speeding path IDs, I'd even suggest doing each individual pair of points as a single path ID and just marking up each path ID to be speeding/non-speeding.
- umad-dataNew Member
Thank you for raising this question. I have encountered a very similar issue.
I am still learning Power BI, and based on my reading and research, I found a few possible approaches. I am sharing them here for discussion and would appreciate confirmation or corrections from experienced members.
Splitting the route into segments in the data model based on speed conditions and assigning a unique Path ID to each segment, then using the Legend field to apply fixed colors.
Using the Bubbles layer while keeping a single route line color and applying conditional formatting to reflect speed at each point.
Exploring custom map visuals from AppSource that may provide more flexibility.
These approaches have not been tested by me yet, but they seem logical based on what I have read. Any guidance would be appreciated. Thank you. - kushanNaSuper User
Hi LangMan123
This is my workaround suggestion:
- Create a Legend column for your red and green paths.
- Duplicate the red lines as green and merge them into your main table.
- Create a Legend Sort Order column and assign a higher number to the red line.
- Use the Sort by Column option to sort the Legend column using this sort order column.
I have attached the sample I created for your reference.
- v-prasareCommunity Support
Hi LangMan123,
We would like to confirm if our community members answer resolves your query or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are happy to help you.
kushanNa, rohit1991, JamieHolding ,Thanks for your prompt responseThank you for your patience and look forward to hearing from you.
Best Regards,
Prashanth Are
MS Fabric community support - v-prasareCommunity Support
Hi LangMan123,
We would like to confirm if our community members answer resolves your query or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are happy to help you.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Prashanth Are
MS Fabric community support