Events
Power BI DataViz World Championships
14 Feb, 16 - 31 Mar, 16
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Every Power BI visual can display a context menu. The context menu allows you to perform various operations on the visual, such as analyzing, summarizing, or copying it. When you right-click anywhere inside a visual's viewport (or long-press for touch devices), the context menu displays. There are two modes of context menus for each visual. The mode that displays depends on where you click inside the visual:
To have Power BI display a context menu for your visual, use selectionManager.showContextMenu()
with parameters selectionId
and a position (as an {x:, y:}
object).
Note
selectionManager.showContextMenu()
is available from Visuals API version 2.2.0. To find out which version you’re using, check the apiVersion
in the pbiviz.json file.ContextMenu
modes (empty space and data point).The following example shows how to add a context menu to a visual. The code is taken from the barChart.ts
file, which is part of the sample BarChart visual:
constructor(options: VisualConstructorOptions) {
...
this.handleContextMenu();
}
private handleContextMenu() {
this.rootSelection.on('contextmenu', (event: PointerEvent, dataPoint) => {
this.selectionManager.showContextMenu(dataPoint ? dataPoint: {}, {
x: mouseEvent.clientX,
y: mouseEvent.clientY
});
mouseEvent.preventDefault();
});
}
More questions? Ask the Power BI Community
Events
Power BI DataViz World Championships
14 Feb, 16 - 31 Mar, 16
With 4 chances to enter, you could win a conference package and make it to the LIVE Grand Finale in Las Vegas
Learn moreTraining
Module
Use visuals in Power BI - Training
Create and customize visuals to present data in compelling and insightful ways.
Certification
Microsoft Certified: Power BI Data Analyst Associate - Certifications
Demonstrate methods and best practices that align with business and technical requirements for modeling, visualizing, and analyzing data with Microsoft Power BI.
Documentation
Add bookmark support for Power BI custom visuals - Power BI
Learn how to add bookmark support to your custom visuals in Power BI so that you can switch between different bookmarked states.
Apply selection to multiple visuals feature in Power BI - Power BI
This article describes how to apply a selection to multiple visuals by using the support multiple visual selection feature in Power BI.
Creating a dialog box in a Power BI visual - Power BI
Learn how to create a dialog box in a Power BI visual to display additional information to the customer in a separate window.