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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
mankeycloun
Regular Visitor

Adding image to visual

Hello everyone!

I'm hardly trying to place an image file in my custom visual, but still can't acheive any result.

I'm not so experienced, so I would be very thankful for any help.

Many thanks!

1 ACCEPTED SOLUTION

If anybody faces the same problem, there is a code of src/visual.ts file just below.

Image of logo appears on the visual screen and can be scaled automaticly depending on scale of the visual window.

The only problem is showing image without binding any data to a visual.

 

_____________________________________________________________________________________________________________________________

module powerbi.extensibility.visual {


export class Visual implements IVisual {

private logo:d3.Selection<SVGImageElement>;
private svg:d3.Selection<SVGImageElement>;
private padding: number = 10; 

constructor(options: VisualConstructorOptions) {

this.svg=d3.select(options.element).append('svg')
.attr("x",0)
.attr("y",0)
.attr("width",1000)
.attr("height",1000);

this.logo = this.svg.append('svg');

 

this.svg=this.logo.append("image")
.attr("xlink:href","https://upload.wikimedia.org/wikipedia/ru/b/b8/Inteco_logo.png")
.attr("x", 0)
.attr("y", 0);

}

public update(options: VisualUpdateOptions) {

this.svg
.attr("width",options.viewport.width)
.attr("height",options.viewport.height);


}

public destroy(): void {

}
}
}

_____________________________________________________________________________________________________________________________

View solution in original post

3 REPLIES 3
mankeycloun
Regular Visitor

I have found the way to solve it!

Deal is done!

Anonymous
Not applicable

Hi @mankeycloun,

Glad to hear the issue is solved. You can share the solution in this forum, that way, other community members would benefit from your solution when they get same issues.

Thanks,
Lydia Zhang

If anybody faces the same problem, there is a code of src/visual.ts file just below.

Image of logo appears on the visual screen and can be scaled automaticly depending on scale of the visual window.

The only problem is showing image without binding any data to a visual.

 

_____________________________________________________________________________________________________________________________

module powerbi.extensibility.visual {


export class Visual implements IVisual {

private logo:d3.Selection<SVGImageElement>;
private svg:d3.Selection<SVGImageElement>;
private padding: number = 10; 

constructor(options: VisualConstructorOptions) {

this.svg=d3.select(options.element).append('svg')
.attr("x",0)
.attr("y",0)
.attr("width",1000)
.attr("height",1000);

this.logo = this.svg.append('svg');

 

this.svg=this.logo.append("image")
.attr("xlink:href","https://upload.wikimedia.org/wikipedia/ru/b/b8/Inteco_logo.png")
.attr("x", 0)
.attr("y", 0);

}

public update(options: VisualUpdateOptions) {

this.svg
.attr("width",options.viewport.width)
.attr("height",options.viewport.height);


}

public destroy(): void {

}
}
}

_____________________________________________________________________________________________________________________________

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors