i need to reset a bootstrap bar chart before i set their values. So i need to reset chart completely, but i don't know how to reset values and animations without need to set them to "0". Any idea?
My .js looks like this:
function chart(){
$.get("/apicountryajax",function(data) {
if($('.verticalChart')) {
//NEED RESET HERE
var i=0;
$('.singleBar').each(function(){
var dataObj=data['objects'][i];
var cName=dataObj['countryName'];
var cCount=parseFloat(dataObj['countryCount'])*100;
var percent=cCount+"%";
i++;
$(this).find('.value').animate({height:percent}, 2000, function() {
$(this).find('span').fadeIn();
$(this).find('span').html(percent);
});
$(this).find('.title').html(cName);
});
}
});