Using Easy Pie Chart, I am trying to change the value of attribut data-percent with value from JSON, but using the ways I normally do in jQuery (3.5.1), does not work in this case, and I cannot figure out why.
The DIV I am trying to set the data-percent on is:
<div class="chart easy-pie-chart-1" id="ConversionCostPercentage" data-percent="">
<span class="percent1"></span>
</div>
The jQuery I have tried to set the value with :
$('#ConversionCostPercentage').attr('data-percent', thejson.ConversionCostPercentage);
and
$('#ConversionCostPercentage').data('percent', thejson.ConversionCostPercentage);
Doing a console.log(thejson.ConversionCostPercentage) returns 55 at the moment .. Anyone have a clue?
With a little push from @RoryMacCrossan I was let in the right direction to solve it .. I went to Easy Pie Chart GitHub site and looked at the documentation, and fell over 3 little jQuery examples (https://github.com/rendro/easy-pie-chart#jquery-1) which resultet in using the below, which fixed it:
$('.chart').data('easyPieChart').update(thejson.ConversionCostPercentage);