Forum Discussion

VizDataLtd's avatar
VizDataLtd
Helper I
2 years ago

How do I access selections from other visuals, if not via selectionManager?

Hello, 

 

I have a custom visual showing categories of data (e.g. days of week). My visual renders without any numeric series required. In Capabilities, supportsHighlight is set to true.

 

When I click "Monday" on my visual, other standard visuals on the page correctly highlight Monday, if they are showing the same category data. By this I mean, Monday stays 100% opaque, while the other values reduce to 40%.

 

However, when I click Monday on these other visuals, there is no behaviour at all on my visual. I thought that selections made on other visuals would be recorded within selectionManager. When I console.log(this.selectionManager) in the update function, selectedIds array is empty. Similarly if i log this.selectionManager.getSelectionIds() - this array only shows anything if I have clicked my own visual. I have this line in the constructor:

 

 

 

this.selectionManager = this.host.createSelectionManager();

 

 

 

I use this.selectionManager.select() when the user clicks my visual. But how I do access the user's clicks on other visuals, if not via selectionManager.selectedIds? 

 
I wonder if I need something further in capabilities? I notice that when I try to add this, selections stop working completely:
"objects": { "general": { "properties": { "filter": { "type": { "filter": true } }, "selfFilter": { "type": { "filter": true } } } } },
 
I am using BasicFilters when I place my own filters.
 
Thanks
Emma

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  VizDataLtd ,

     

    Conveniently you can explain in detail "When I try to add it, the selection stops working altogether:

    "objects": { "general": { "properties": { "filter ": { "type": { "filter": true } }, "selfFilter": { "type": { "filter": true } } } }," for the exact problem occurrence and some screenshots?

    Also can you check if this official documentation is of any help?

    Develop custom visuals in Power BI - Power BI | Microsoft Learn

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Hi Liu, 

     

    I mean that if I add the filter and selfFilter properties into objects.general within capabilities, highlighting stops working. I have read that this is expected behaviour.

     

    The problem is that I do not know where I can see the selections users have made in other visuals, so that I can apply those to my custom visual.

     

    Thanks for any help.

     

    Emma