This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Power BI reports that you embed in apps contain visuals, such as charts, heat maps, and gauges. These visuals have headers that make actions available to users. When you use Power BI, you can hide or show the header of each visual in a report. Each visual has a card in theFormatting section of theVisualizations pane calledVisual header. You can use that card to turn the visual's header on and off. Learn more about visual headers inVisual headers.
Examples of actions in visual headers include:
Sometimes it's useful to hide these actions. For instance, when two visuals overlap, you might not want to display both visuals' headers.
This API provides a way to hide or show headers of all the visuals in a report or only specific ones. You can configure the visibility on report load, or you can call the ReportupdateSettings
method to change the visibility after a report has loaded, seeUpdate report settings at runtime.
You can use the API in many scenarios, including the following use cases:
To hide or show visual headers in the API, you configure certain parameters in a report's settings. SeeConfigure report settings for general information on configuring options in embedded reports.
With visual headers, visibility is currently the only setting that you can configure. To hide or display headers, you provide a list of visual header configuration objects. Each one contains a settings object and can also include a selector.Selectors identify the visuals that you're applying the settings to. Learn more about selectors inSelectors.
The type of the configuration object that you provide to the API isIVisualSettings. Later in this article, you'll findexamples that show how to use this interface in your code.Power BI models lists all interface definitions that the examples use.
Note the following points:
The API applies configuration settings in the following order:
updateSettings
API.If more than one setting can apply to a visual, the API uses the last setting that applies. TheHide all but one visual header example in the next section illustrates this point.
These examples show different ways of using the API to hide or show visual headers.
This simple scenario provides customers with a clean report view by hiding all the visual headers in a report:
let embedConfig = { ... settings: { ... visualSettings: { visualHeaders: [ { settings: { visible: false } /* No selector is listed. The API hides the headers of all the visuals in the report. */ } ] } }};...let report = powerbi.embed(embedContainer, embedConfig);
This example uses a selector to apply a visibility setting to a single visual. This scenario comes up when you want to hide functionality that doesn't make sense for a visual. Use this code in that case:
let embedConfig = { ... settings: { ... visualSettings: { visualHeaders: [ { settings: { visible: false }, selector: { $schema: "http://powerbi.com/product/schema#visualSelector", visualName: <The name of the visual> // You can retrieve the name by using getVisuals. } } ] } }};...let report = powerbi.embed(embedContainer, embedConfig);
Use this code to hide all visual headers in a report except a specific visual's header:
let embedConfig = { ... settings: { ... visualSettings: { visualHeaders: [ { settings: { visible: false } /* No selector is listed. The API hides the headers of all the visuals in the report. */ }, { settings: { visible: true }, selector: { $schema: "http://powerbi.com/product/schema#visualSelector", visualName: <The name of the visual> // You can retrieve the name by using getVisuals. } } ] } }};...let report = powerbi.embed(embedContainer, embedConfig);
If you'd like to make more than one header visible, you can extend this code. Set up additional instances ofIVisualHeader
with thevisible
parameter insettings
set totrue
. For each visual that should have a visible header, add oneIVisualHeader
instance to the list.
View
instead ofEdit
orSave
.