You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I m updating data-percent value dynamically of pie chart using Jquery. Value updated sucessfully but animation does not happen again. I tried below code but it gives error update is not defined
i got it working after doing the following :
`var active = false;
var element = document.querySelector('.chart');
var chart = new EasyPieChart(element, {
// your options goes here
});
chart.update(0);
function isScrolledIntoView(elem)
{
var docViewTop = jQuery(window).scrollTop();
var docViewBottom = docViewTop + jQuery(window).height();
var elemTop = jQuery(elem).offset().top;
var elemBottom = elemTop + jQuery(elem).height();
return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom) && (elemBottom <= docViewBottom) && (elemTop >= docViewTop));
}
jQuery( document ).ready(function() {
// in my case i only update it when the user is scrolled to it
if(isScrolledIntoView(jQuery('.chart')) && !active) {
charts.forEach(function(chart) {
chart.update(chart.el.dataset.percent);
});
active = true;
}
});`
Scenaria is,
I m updating data-percent value dynamically of pie chart using Jquery. Value updated sucessfully but animation does not happen again. I tried below code but it gives error update is not defined
$('.chart-circle').data('easyPieChart').update(40);
The text was updated successfully, but these errors were encountered: