diff --git a/src/easypiechart.js b/src/easypiechart.js index 1f072fb..d0bdcce 100644 --- a/src/easypiechart.js +++ b/src/easypiechart.js @@ -103,6 +103,7 @@ var EasyPieChart = function(el, opts) { this.update = function(newValue) { newValue = parseFloat(newValue); if (options.animate.enabled) { + options.animate.stopped = false; this.renderer.animate(currentValue, newValue); } else { this.renderer.draw(newValue); @@ -129,5 +130,25 @@ var EasyPieChart = function(el, opts) { return this; }; + /** + * Stop animation + * @return {object} Instance of the plugin for method chaining + */ + this.stop = function () { + this.renderer.stop(); + currentValue = options.value; + return this; + }; + + /** + * Update options + * @param newOptions + * @returns {EasyPieChart} + */ + this.setOptions = function (newOptions) { + $.extend(true, options, newOptions); + return this; + }; + init(); };