自定义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 (将#修改为@)