While applying the Javascript getProperty function we are getting the default value is only null value in Power BI Embedded. Is there any option where we get the default state of the each visual state in power BI?
Asked
Active
Viewed 275 times
1 Answers
0
To get the properties of all the visuals in the report, first get all the pages of the report, then get all the visuals of the current active page. Now for all the visuals, use getProperty()
to get the state of the visual.
Please follow the code snippets below:
- Get all the pages on the report:
const pages = await report.getPages();
- Find the active page:
let page = pages.filter(function (page) {
return page.isActive
})[0];
- Get all the visuals of active page:
const visuals = await page.getVisuals();
- Traverse visuals and get the properties of all the visuals:
for(let i=0;i<visuals.length;i++){
const property = await visuals[i].getProperty(
{ objectName: "legend", propertyName: "position" }
);
console.log("visual - property:\n", property);
}
Please find the reference here: https://learn.microsoft.com/javascript/api/overview/powerbi/visual-properties#properties-apis

Rohit Ronte
- 129
- 3