Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have finally succeeded in creating a working custom visual.
I have also successfully added an image to the visual:
let image = this.svg.append("svg:image") .attr('x', 15) .attr('y', -10) .attr('width', width * 0.2) .attr('height', height * 0.2) .attr("xlink:href", logo) //logo is a path
However, resizing this image with transparent background leaves behind artifacts, like this:
Using a picture with a white background works better, but it doesn't really fix the problem as resizing the picture quickly leaves the same trail. I can "draw" with the picture, so if I rezize the visual slowly enough I can hide the artifacts. That is not my goal though, as those artifacts shouldn't be there in the first place.
How do I fix that?
EDIT: I just noticed, that it doesn't leave behind artifacts if the visual is resized with the "latches" on the top or left side. Those only stay there if the middle right, bottom right, and bottom middle ones are used. Is the problem somehow with points the image is attached to?
Solved! Go to Solution.
That's because 'svg:image' is not a valid selector.
d3.selectAll('svg > image').remove();
Every time the custom visual is resized, it will call update method. So in your case, more and more new images are appended.
Thank you for your answer - that's what I thought.
How should I got about fixing it?
Adding a
d3.selectAll('svg:image').remove();
before the code where I add the picture only accomplishes that the image doesn't even show up in the visual. I also tried initializing image in the class scope but the image still doesn't show up that way.
That's because 'svg:image' is not a valid selector.
d3.selectAll('svg > image').remove();
That worked, thank you for bearing with my noobines.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
7 | |
6 | |
3 | |
2 | |
2 |