使用简易饼图,我试图用 JSON 中的值更改属性数据百分比的值,但是使用我通常在 jQuery (3.5.1) 中执行的方式,在这种情况下不起作用,我不知道为什么.
我试图设置数据百分比的 DIV 是:
<div class="chart easy-pie-chart-1" id="ConversionCostPercentage" data-percent="">
<span class="percent1"></span>
</div>
我尝试使用以下值设置的 jQuery:
$('#ConversionCostPercentage').attr('data-percent', thejson.ConversionCostPercentage);
和
$('#ConversionCostPercentage').data('percent', thejson.ConversionCostPercentage);
目前执行 console.log(thejson.ConversionCostPercentage) 返回 55 .. 有人知道吗?