[选择了视觉对象(通过鼠标或键盘)时,“视觉效果”窗格将突出显示视觉对象类型图标并列出与所选视觉对象有关的内容。
我如何实现这种功能?
无法选择在活动页面中检查每个visual.isActive(),因为您不知道何时检查,并且不会传播html元素(用于嵌入)click / change事件。
[tried buttonClicked,dataSelected事件,它们不正确。
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Handling-Events
是否支持?
Power BI Embedded当前不支持听视觉选择的事件。当前支持事件的对象是报表,仪表板和磁贴。
但是,您可以使用此代码获得特定页面的视觉效果。
report.on("loaded", function() {
report.getPages()
.then(function(pages) {
// Retrieve first page.
var firstPage = pages[0];
firstPage.getVisuals()
.then(function(visuals) {
console.log(visuals); // It will give you the list of visuals of the current page
})
})
});
您还可以监听仪表板的tileClicked事件,因为它将为您提供特定于图块的信息。
tile.on("tileClicked", function (event) {
Log.logText("Tile clicked event");
Log.log(event.detail);
});
请参考:https://github.com/Microsoft/PowerBI-JavaScript/wiki/Handling-Events