diff --git a/src/controllers/controller.bar.js b/src/controllers/controller.bar.js index 12ca5a53474..6d89e0708b5 100644 --- a/src/controllers/controller.bar.js +++ b/src/controllers/controller.bar.js @@ -256,7 +256,7 @@ module.exports = DatasetController.extend({ me._updateElementGeometry(rectangle, index, reset, options); - rectangle.pivot(); + rectangle.pivot(me.chart._animationsDisabled); }, /** diff --git a/src/controllers/controller.bubble.js b/src/controllers/controller.bubble.js index 48c0a2ee46d..50a9b2d0435 100644 --- a/src/controllers/controller.bubble.js +++ b/src/controllers/controller.bubble.js @@ -122,7 +122,7 @@ module.exports = DatasetController.extend({ y: y, }; - point.pivot(); + point.pivot(me.chart._animationsDisabled); }, /** diff --git a/src/controllers/controller.doughnut.js b/src/controllers/controller.doughnut.js index 8df290ad402..4b29d422617 100644 --- a/src/controllers/controller.doughnut.js +++ b/src/controllers/controller.doughnut.js @@ -271,7 +271,7 @@ module.exports = DatasetController.extend({ model.endAngle = model.startAngle + model.circumference; } - arc.pivot(); + arc.pivot(chart._animationsDisabled); }, calculateTotal: function() { diff --git a/src/controllers/controller.line.js b/src/controllers/controller.line.js index 59793279eb4..d73332e7571 100644 --- a/src/controllers/controller.line.js +++ b/src/controllers/controller.line.js @@ -103,7 +103,7 @@ module.exports = DatasetController.extend({ // Now pivot the point for animation for (i = 0, ilen = points.length; i < ilen; ++i) { - points[i].pivot(); + points[i].pivot(me.chart._animationsDisabled); } }, diff --git a/src/controllers/controller.polarArea.js b/src/controllers/controller.polarArea.js index 2e172ff80fc..b4c5ba48015 100644 --- a/src/controllers/controller.polarArea.js +++ b/src/controllers/controller.polarArea.js @@ -220,7 +220,7 @@ module.exports = DatasetController.extend({ } }); - arc.pivot(); + arc.pivot(chart._animationsDisabled); }, countVisibleElements: function() { diff --git a/src/controllers/controller.radar.js b/src/controllers/controller.radar.js index 1a0bee2fada..049c6cf8efa 100644 --- a/src/controllers/controller.radar.js +++ b/src/controllers/controller.radar.js @@ -75,6 +75,7 @@ module.exports = DatasetController.extend({ var line = meta.dataset; var points = meta.data || []; var config = me._config; + var animationsDisabled = me.chart._animationsDisabled; var i, ilen; // Compatibility: If the properties are defined with only the old name, use those values @@ -90,7 +91,7 @@ module.exports = DatasetController.extend({ // Model line._model = me._resolveDatasetElementOptions(); - line.pivot(); + line.pivot(animationsDisabled); // Update Points for (i = 0, ilen = points.length; i < ilen; ++i) { @@ -102,7 +103,7 @@ module.exports = DatasetController.extend({ // Now pivot the point for animation for (i = 0, ilen = points.length; i < ilen; ++i) { - points[i].pivot(); + points[i].pivot(animationsDisabled); } }, diff --git a/src/core/core.controller.js b/src/core/core.controller.js index ad841ca6ec7..e3fce696504 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -116,6 +116,14 @@ function initConfig(config) { return config; } +function isAnimationDisabled(config) { + return !config.animation || !( + config.animation.duration || + (config.hover && config.hover.animationDuration) || + config.responsiveAnimationDuration + ); +} + function updateConfig(chart) { var newOptions = chart.options; @@ -129,6 +137,7 @@ function updateConfig(chart) { newOptions); chart.options = chart.config.options = newOptions; + chart._animationsDisabled = isAnimationDisabled(newOptions); chart.ensureScalesHaveIDs(); chart.buildOrUpdateScales(); @@ -692,9 +701,11 @@ helpers.extend(Chart.prototype, /** @lends Chart */ { var me = this; var i, ilen; - for (i = 0, ilen = (me.data.datasets || []).length; i < ilen; ++i) { - if (me.isDatasetVisible(i)) { - me.getDatasetMeta(i).controller.transition(easingValue); + if (!me._animationsDisabled) { + for (i = 0, ilen = (me.data.datasets || []).length; i < ilen; ++i) { + if (me.isDatasetVisible(i)) { + me.getDatasetMeta(i).controller.transition(easingValue); + } } } diff --git a/src/core/core.element.js b/src/core/core.element.js index 89bbc59d07a..dc98270c866 100644 --- a/src/core/core.element.js +++ b/src/core/core.element.js @@ -63,8 +63,13 @@ class Element { this.hidden = false; } - pivot() { + pivot(animationsDisabled) { var me = this; + if (animationsDisabled) { + me._view = me._model; + return me; + } + if (!me._view) { me._view = helpers.extend({}, me._model); }