cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
emma_s
Frequent Visitor

Custom visual: should cross filtering occur automatically?

Hello, I have built a treemap visual. I am using Pbiviz v3.1. I have tooltips working via ISelectionID. I thought this meant that filtering of other graphics would work automatically (I'm sure it has in the past) but it isn't working. When I click on one block of the treemap (via the developer visual), it doesn't reduce the colour strength of the other blocks, and doesn't produce any filtering of other charts on the page.

 

Can someone just tell me if I'm right, in that cross filtering should work automatically, as long as ISelectionID is working? 

 

categories.values.forEach((item, index) => {
const selID: ISelectionId = host.createSelectionIdBuilder().withCategory(categories, index).createSelectionId();
treemapDataPoints.push({
category: <string>item,
selectionId: selID,
value: 0
});
})

 

I notice that when I hover over a standard graphics, the cursor is an arrow. With my custom treemap, the cursor is a hand. I don't know if this is significant!  

 

Thanks for any help

2 REPLIES 2
Super User I
Super User I

Re: Custom visual: should cross filtering occur automatically?

Hi @emma_s,

Hopefully I'm understanding your challenge correctly. By default, all custom visuals will accept cross-filtered data from other visuals, slicers or page filters. This will restrict the available data in your dataView and does not require any further effort from your side.

If you are referring to highlighting - where your visual updates to only highlight partial data, or you want to click selectionId-bound objects in your visual to filter others - then no, this has never been enabled by default and has to be specifically coded into your visual.

The docs have a good starting point for this, using the sample bar chart repo.

Good luck!

Daniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




emma_s
Frequent Visitor

Re: Custom visual: should cross filtering occur automatically?

HI @dm-p. Thanks for your reply. My problem was a bit different to what you thought. My graphic responded correctly to filtering from other graphics. But when I clicked the graphical elements of my graphic, they did not cause filtering in other graphics.

 

I had thought this was standard behaviour once I assigned a SelectionID to the graphical elements. It is not. For anyone wanting to build filtering into their custom visuals, search for selectionManager here: https://github.com/microsoft/PowerBI-visuals-sampleBarChart/blob/master/src/barChart.ts

 

You need to create and "register a callback" on the selectionManager in constructor(). Then you need an onclick event (as you would have in regular d3 or javascript) in the update() function, but in this case you need to reference the selectionManager within that event. There are many functions and references to be added to make this work. The bar chart code linked here gives you enough to work it out.

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors