power bi - 自定义视觉 - 矩阵选择不更新其他视觉
power bi - custom visual - matrix selection not update other visual
与 power bi - forum - developer
相同的问题
我尝试使用我的矩阵自定义视觉对象创建选区,但在其他视觉对象上会出错
这是我的转换,使用构建器 withMatrixNode
function visualTransform(options: VisualUpdateOptions, host: IVisualHost): DataViewModel {
let dataViews = options.dataViews[0];
var rows = dataViews.matrix.rows;
let listSelectionId: DataListSelection[] = [];
let selectionIdBuilder = host.createSelectionIdBuilder();
rows.root.children.forEach(x => {
listSelectionId.push({
value: x.value,
selectionId: selectionIdBuilder.withMatrixNode(x, rows.levels).createSelectionId()
});
if (x.children)
x.children.forEach(z => {
listSelectionId.push({
value: z.value,
selectionId: selectionIdBuilder.withMatrixNode(z, rows.levels).createSelectionId()
});
if (z.children)
z.children.forEach(a => {
listSelectionId.push({
value: a.value,
selectionId: selectionIdBuilder.withMatrixNode(a, rows.levels).createSelectionId()
});
})
})
});
return {
dataPoints: listSelectionId
}
}
我已经添加点击侦听器以获取选择 ID 并在管理器中将其选中,这是控制台日志
但是我的页面在其他视觉中总是出错:
我的选择代码有什么问题?
还有一个问题,我已经在我的管理器中声明了 selectcallback 但从未在其他视觉对象进行选择时调用
this.selectionManager = this.host.createSelectionManager();
console.log('constructor allow interaction', this.host.allowInteractions);
this.selectionManager.registerOnSelectCallback(() => {
console.log('selection manager callback', this.selectionManager.getSelectionIds());
});
this.selectionIdBuilder = options.host.createSelectionIdBuilder();
通过移除 let
解决这个问题
let selectionIdBuilder = host.createSelectionIdBuilder();
与 power bi - forum - developer
相同的问题我尝试使用我的矩阵自定义视觉对象创建选区,但在其他视觉对象上会出错
这是我的转换,使用构建器 withMatrixNode
function visualTransform(options: VisualUpdateOptions, host: IVisualHost): DataViewModel {
let dataViews = options.dataViews[0];
var rows = dataViews.matrix.rows;
let listSelectionId: DataListSelection[] = [];
let selectionIdBuilder = host.createSelectionIdBuilder();
rows.root.children.forEach(x => {
listSelectionId.push({
value: x.value,
selectionId: selectionIdBuilder.withMatrixNode(x, rows.levels).createSelectionId()
});
if (x.children)
x.children.forEach(z => {
listSelectionId.push({
value: z.value,
selectionId: selectionIdBuilder.withMatrixNode(z, rows.levels).createSelectionId()
});
if (z.children)
z.children.forEach(a => {
listSelectionId.push({
value: a.value,
selectionId: selectionIdBuilder.withMatrixNode(a, rows.levels).createSelectionId()
});
})
})
});
return {
dataPoints: listSelectionId
}
}
我已经添加点击侦听器以获取选择 ID 并在管理器中将其选中,这是控制台日志
但是我的页面在其他视觉中总是出错:
我的选择代码有什么问题? 还有一个问题,我已经在我的管理器中声明了 selectcallback 但从未在其他视觉对象进行选择时调用
this.selectionManager = this.host.createSelectionManager();
console.log('constructor allow interaction', this.host.allowInteractions);
this.selectionManager.registerOnSelectCallback(() => {
console.log('selection manager callback', this.selectionManager.getSelectionIds());
});
this.selectionIdBuilder = options.host.createSelectionIdBuilder();
通过移除 let
解决这个问题let selectionIdBuilder = host.createSelectionIdBuilder();