Good news! As of API v2.2.0
Custom visuals now support drillthrough
The official developer blog mentions it in the Nov 2018 post.
To enable drillthrough, the visual just need to support Context Menu (detailed instructions in Adding Context-Menu to the Bar Chart). Once a context menu event is triggered on anything sending a dataPoint.selectionId
, the menu will include a drillthrough option.
If you are using D3, and store your SVG as this.svg
in your code, the basic code can look something like:
this.svg.on('contextmenu', () => {
const mouseEvent: MouseEvent = d3.event as MouseEvent;
const eventTarget: EventTarget = mouseEvent.target;
let dataPoint = d3.select(eventTarget).datum();
this.selectionManager.showContextMenu(dataPoint? dataPoint.selectionId : {}, {
x: mouseEvent.clientX,
y: mouseEvent.clientY
});
mouseEvent.preventDefault();
});
(copied from custom visuals official documentation - as linked above)
Note how the selection.id is passed in the selectionManager.showContextMenu()
call - that's what enables drillthrough.
Disclaimer: I'm a Microsoft employee, working in one of Power BI development teams. This answer is posted based on my personal knowledge and experience, and is not endorsed or approved by Microsoft in any way.