1

I am not able to refresh this piechart div on click of that image using angularjs

div containing my image:

<div class="col-md-3 col-sm-12 col-xs-12">
                    <div class="panel panel-primary text-center no-boder blue">
                        <div class="panel-left pull-left blue">
                            <i class="fa fa fa-comments fa-5x"></i>
                        </div>
                        <div class="panel-right">
                            <h3>Assessment</h3>
                        </div>
                        <img src="assets/images/refresh.png" ng-click="refreshChart()"/>
                    </div>
                </div>

div i want to refresh:

  <div class="col-xs-6 col-md-3">
                    <div class="panel panel-default">
                        <div class="panel-body easypiechart-panel">
                          **<div class="easypiechart" id="easypiechart-blue" data-percent="82"><span class="percent">82%</span>**
                            </div>
                        </div>
                    </div>
                </div>

app.js code

var sampleApp1 = angular.module('sampleApp1', []);
sampleApp1.controller('dashctrl', function($scope) {

$scope.refreshChart = function (){
$('.chart').data('#easypiechart-blue').update(40);
};  

});

1 Answers1

0

Create a method on your controller (AngularJs) and use this to redraw(reset the data and update chart) $('.chart').data('easyPieChart').update(40); .

$scope.refreshChart = function (){
    $('.chart').data('newChartData').update(40);
}

and in your html

<img src="assets/images/refresh.png" data-ng-click="refreshChart()"/>

The best option is to do a little detection work on yourself and see that your case is exactly what they have on first page. button to refresh pie charts (https://rendro.github.io/easy-pie-chart/)

Dinca Adrian
  • 1,190
  • 11
  • 21