如何解决自定义PowerBI Visual将显示数据,即使已删除DataField之后
我正在尝试使用Microsoft通过以下链接提供的示例来创建我的第一个自定义PowerBI可视化- https://docs.microsoft.com/en-us/power-bi/developer/visuals/develop-circle-card
但是,我观察到,即使删除了与视觉相关的数据字段,自定义视觉仍会显示旧/较早的数据。例如:我将“销售”字段添加为340。现在,当我删除它时,旧数据340仍在自定义视图中显示。您能帮忙解决这个问题吗?谢谢。
Please see the screenshot of the issue here
我正在将代码发布到更新功能中-
public update(options: VisualUpdateOptions) {
console.log('Visual update',options);
let dataView: DataView = options.dataViews[0];
let width: number = options.viewport.width;
let height: number = options.viewport.height;
this.svg.attr("width",width);
this.svg.attr("height",height);
let radius: number = Math.min(width,height) / 2.2;
this.circle
.style("fill","white")
.style("fill-opacity",0.5)
.style("stroke","black")
.style("stroke-width",2)
.attr("r",radius)
.attr("cx",width / 2)
.attr("cy",height / 2);
let fontSizeValue: number = Math.min(width,height) / 5;
this.textValue
.text(<string>dataView.single.value) //.text("Value")
.attr("x","50%")
.attr("y","50%")
.attr("dy","0.35em")
.attr("text-anchor","middle")
.style("font-size",fontSizeValue + "px");
let fontSizeLabel: number = fontSizeValue / 4;
this.textLabel
.text(dataView.metadata.columns[0].displayName) //.text("Label")
.attr("x",height / 2)
.attr("dy",fontSizeValue / 1.2)
.attr("text-anchor",fontSizeLabel + "px");
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。