I am using easypiecharts in angular. I am trying to add an attribute(data-statusId) to the markup and use that in js to change the color of the progress bar. When data-opt= 8, it should turn to grey or else should be green.But my condition is failing all the time because, greyBar value is returned as "undefined" all the time.
Attached the screenshots for reference. I need to access the value under dataset for "opt".
.directive('isLoaded', function () {
return {
restrict: 'A', //Attribute type
link: function (scope, elements, arguments) {
ProgressMeter($('#inprogress-card').find('.progress-icon'), false);
}
}
});
function Meter($ele, isPopUp) {
setTimeout(function () {
if (isPopUp && $ele.find('canvas').length > 0) {
$ele.data('easyPieChart').update(0);
$ele.data('easyPieChart').update($ele.attr('data-percent'));
}
else {
$ele.easyPieChart({
easing: 'easeOutBounce',
scaleColor: false,
lineWidth: 4,
trackColor: '#CCCCCC',
barColor: function () {
var greyBar = $ele.data('opt');
if (typeof(greyBar) != 'undefined')
return '#44AD3A'
else
return '#989798'
},
lineCap: 'round',
onStep: function (from, to, percent) {
}
});
}
}, 100);
}`
HTML:
<div class="progress-icon" data-opt="{{list.Status}}" data-percent=" {{ (20/30)* 100)}} ">