Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Using Images for force graph custom visual

Hi,

 

Does anyone know how to add images to the nodes so that the nodes display either as an icon or image?

 

Much appreciated if someone could help me. I know there is an image url property in the nodes section.

 

 

force graph.png

 

cheers

 

Datadude28

 

6 REPLIES 6
JerryNixon
Microsoft Employee
Microsoft Employee

This is so confusing. Let me help. 

First, let's just look at the internal logic with some quasi code.

 

if EMPTY("Format:Image url")
  return INVALID_URL

if EMPTY("Format:Image")
  return INVALID_URL

if HASDESTINATION()
  if EMPTY("Fields:Source Type")
    return INVALID_URL
  else
    return CONCAT("Format:Image url", "Fields:Source Type", "Format:Image")
else
  if EMPTY("Fields:Target Type")
    return INVALID_URL
  else
    return CONCAT("Format:Image url", "Fields:Target Type", "Format:Image")

 

The whole point of this is to let you build an image URL based on the node type.  

What if you just want one image (not to build the URL based on type)?
SOLVED: Just put a question mark "?" at the end of the URL. Like this...

JerryNixon_0-1647537231550.png

Yes, the docs could be more clear.

// Jerry

ankitpatira
Community Champion
Community Champion

@Anonymous Check out this video on something similar. You should also test out by putting in online image url in image url section.

Anonymous
Not applicable

force graph images.png

 

 

I tried using an image Url and it is still not working. Any ideas. The video is outdated and not as the latest release of Power BI desktop.

 

regards

 

Datadude28

 

Hi,

 

You need to  set url to “Image url”. See screenshot below.

 

This is sample url: https://raw.githubusercontent.com/Microsoft/PowerBI-visuals-core/resources/images/reports/ForceGraph/

 

Be noted that Image url is the base url for images. Full url is composed by "base url + sourceType or targetType + image extension".

 

1.png

 

For details, you can go to https://visuals.azureedge.net/powerbi-visuals/ForceGraph1449359463895/sample-report/ForceGraph.pbix to download the a sample for ForceGraph.

See screenshot from it.

 

2.png

 

Best Regards

Alex

Anonymous
Not applicable

I see,

 

 

How do you use your own custom image?

 

and also how does the image Url works?

 

 

lastly, how can I make my own image Url?

 

cheers

 

DataDude28

Hi ,

 

Let me show you a detailed example.

 

I have a dataset like below.

 

1.png

 

I create a website in my local with 2 images under \images called tomcat.gif and printer.gif. See screenshot below.

 

2.png

 

3.png

 

Now I create a focegraph with config below.

 

The Image URL is: http://localhost:8081/powercase/images/

  

4.png

 

5.png

 

Note that:

1. Image is specified in the SourceType or TargetType columns, the first time a node shows up in the dataset, its image is set, it's not changed if it's set later in the dataset

 

2. Full url is composed by "base url + sourceType or targetType + image extension"

 

For example:

 

In column “Source” and “Target”, A appeared first in row 1 “Source” column, so its image should be the pic in “SourceType”. It is tomcat. So the full url for node A is Image url + tomcat + Image extension.

 

D appeared first in row 4 “Target” column, so its image shoud be the pic in “TargetType”. It is printer.

So the full url for node D is image url + printer + Image extension.

 

Best Regards

Alex

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.