Help to change bar color of Easy Pie Chart with click event

Help to change bar color of Easy Pie Chart with click event

I'm using Easy Pie Chart and this is working well with the following code:
  1. $('.chart').easyPieChart({
  2.       size: '150',
  3.       easing: 'easeOutBounce',
  4.       barColor : $(".cbg").css("backgroundColor"),
  5.       onStep: function(from, to, percent){
  6.             $(this.el).find('.percent').text(Math.round(percent));
  7.       }
  8. });
I've a color switcher that switches the color of my theme. Now I want to switch the color of the bar with the color of the theme. So I write the following code. But it is not working.
  1. $("#switcher span").click(function(){
  2.       $('.chart').easyPieChart({
  3.             size: '150',
  4.             easing: 'easeOutBounce',
  5.             barColor : $(this).css("backgroundColor"),
  6.             onStep: function(from, to, percent){
  7.                   $(this.el).find('.percent').text(Math.round(percent));
  8.             }
  9.       });
  10. });
Could anybody help me? Thanks in advance.