Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capability to update the chart from angular external controller #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ chart.enableAnimation();
```javascript
new EasyPieChart(element, {
barColor: function(percent) {
var ctx = this.renderer.getCtx();
var canvas = this.renderer.getCanvas();
var ctx = this.renderer.ctx();
var canvas = this.renderer.canvas();
var gradient = ctx.createLinearGradient(0,0,canvas.width,0);
gradient.addColorStop(0, "#ffe57e");
gradient.addColorStop(1, "#de5900");
Expand Down Expand Up @@ -265,4 +265,4 @@ Thanks to [Rafal Bromirski](http://www.paranoida.com/) for designing [this dribb


## Copyright
Copyright (c) 2015 Robert Fleischmann, contributors. Released under the MIT, GPL licenses
Copyright (c) 2016 Robert Fleischmann, contributors. Released under the MIT, GPL licenses
10 changes: 8 additions & 2 deletions dist/angular.easypiechart.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// like Node.
module.exports = factory(require("angular"));
} else {
factory(angular);
factory(root["angular"]);
}
}(this, function (angular) {

Expand Down Expand Up @@ -61,11 +61,17 @@
};
scope.options = angular.extend(options, scope.options);

var pieChart = new EasyPieChart(element[0], options);
var pieChart = new EasyPieChart(element[0], options),
currentValue = 0;

scope.$watch('percent', function(newVal, oldVal) {
currentValue = newVal;
pieChart.update(newVal);
});

scope.$on('update-easy-pie-chart', function() {
pieChart.update(currentValue);
});
}
};
}]);
Expand Down
2 changes: 1 addition & 1 deletion dist/angular.easypiechart.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/easypiechart.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jquery.easypiechart.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// like Node.
module.exports = factory(require("jquery"));
} else {
factory(jQuery);
factory(root["jQuery"]);
}
}(this, function ($) {

Expand Down
Loading