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

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.

Issue on adding visual interactions to my custom visual

Hello,

There is something wrong when I try to add a select interaction by clicking the visual,
both this.host.createSelectionManager().select() and this.host.createSelectionManager().clear() were not working, the this.host.createSelectionManager().hasSelection() keep returning false and this.host.createSelectionManager().getSelectionIds() keep returning empty.

And I have screenshots of my code and packages version list here:

Vallaria_0-1729503848286.png

Vallaria_1-1729503913040.png

Vallaria_2-1729504297390.png

Vallaria_3-1729504323632.png

{
  "name": "visual",
  "description": "default_template_value",
  "version": "1.0.0.0",
  "repository": {
    "type": "default_template_value",
    "url": "default_template_value"
  },
  "license": "MIT",
  "scripts": {
    "pbiviz": "pbiviz",
    "start": "pbiviz start",
    "package": "pbiviz package",
    "lint": "npx eslint . --ext .js,.jsx,.ts,.tsx"
  },
  "dependencies": {
    "@types/d3": "7.4.0",
    "d3": "7.8.5",
    "powerbi-visuals-api": "~5.3.0",
    "powerbi-visuals-utils-formattingmodel": "6.0.0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^5.59.11",
    "eslint": "^8.42.0",
    "eslint-plugin-powerbi-visuals": "^0.8.1",
    "typescript": "4.9.3"
  }
}


Can anyone provide suggestions on how to fix it?

Status: Investigating
Comments
Anonymous
Not applicable

Hi  @Vallaria ,

 

 

Based on your error meassage, you may check these below:

1.The selection manager is properly initialized in your visual's constructor:

2.You are creating selection IDs correctly for your data points. For example:

3.Your click event handlers are correctly set up to use the selection manager

4.You are using the correct API version that supports the methods you are calling. 

It might be helpful to review the Power BI documentation Power BI visual data point selections - Power BI | Microsoft Learn

 

Best regards.
Community Support Team_Caitlyn

Vallaria
Regular Visitor

Thanks for your reply, @Anonymous 
Based on your message, I have check each of the item but still cannot identify the cause of the problem; here are the details for my checking:
1. The 
createSelectionManager() has been initialized like this and not showing any error:

Vallaria_0-1729594231129.png

Vallaria_1-1729594325144.png

Vallaria_2-1729594407313.png

2. The selection ID has been created and use like this (I also try this.selectionManager.clear() as the screenshot on my first message yesterday but nothing happens, the this.selectionManager.hasSelection() keep returning 'false', so maybe the create code is not causing the problem?😞

Vallaria_4-1729594679874.png

Vallaria_3-1729594628994.png

3. The click event set up like this (the console.log() works fine when I click the visual😞

Vallaria_5-1729595626034.png

4. Can't find which version of "powerbi-visuals-api" and "powerbi-visuals-utils-formattingmodel" should be use for createSelectionManager() on the document; here is my version info:

Vallaria_6-1729595919352.png

 

Can you find the cause of the problem with these information?
If you need more information, please let me know. I'm really looking forward to your help in solving this problem.

Thanks and Best Regards

Vallaria