Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a custom visual I am working on where I am building out a map with leaflet & trying to add in the ability to click on the map and have it filter the other visual on the page.
I am looking at the following docs
https://github.com/PowerBi-Projects/PowerBI-visuals/blob/master/Visual/Selection.md
https://learn.microsoft.com/en-us/power-bi/developer/visuals/selection-api
Whjen I try to add this
const categorySelectionId = this.host.createSelectionIdBuilder()
into either my update or constructor for my visual I get the error
Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'.
I am running powerbi-visuals-tools version - 5.5.1 and have the following versions in package.json
"powerbi-visuals-api": "~5.3.0",
"powerbi-visuals-utils-dataviewutils": "^6.1.0",
"powerbi-visuals-utils-formattingmodel": "6.0.0",
"powerbi-visuals-utils-interactivityutils": "^6.0.4"
What am I doing wrong here?
Hi, @Grzy7316
1.Firstly, have you correctly imported the relevant variables:
import IVisual = powerbi.extensibility.IVisual;
import IVisualHost = powerbi.extensibility.visual.IVisualHost;
2.Secondly, I recommend checking whether you have created class properties for both the host and the selection manager.
private host: IVisualHost;
private selectionManager: ISelectionManager;
For further details, please refer to:
3.Next, please refer to the following code for the IVisualHost interface services:
export interface IVisualHost extends extensibility.IVisualHost {
createSelectionIdBuilder: () => visuals.ISelectionIdBuilder;
For further details, please refer to:
powerbi-visuals-api/src/visuals-api.d.ts at main · microsoft/powerbi-visuals-api · GitHub
Visual API for Power BI Visuals - Power BI | Microsoft Learn
4.Here are some relevant example links that I hope will be helpful to you:
PowerBI-visuals-sampleBarChart/src/barChart.ts at main · microsoft/PowerBI-visuals-sampleBarChart · ...
Adding Interactions To Your Power BI Custom Visual
Solved: Visuals interactions - Microsoft Fabric Community
Best Regards,
Leroy Lu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 4 | |
| 4 | |
| 3 |