]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Better organize calls in main controller (#7345)
authorBen McCann <322311+benmccann@users.noreply.github.com>
Mon, 18 May 2020 13:49:07 +0000 (06:49 -0700)
committerGitHub <noreply@github.com>
Mon, 18 May 2020 13:49:07 +0000 (09:49 -0400)
src/core/core.controller.js

index bc60d506fc6b5760b12fe1d4d9bc0f78f218541c..c71c8c26f0933955482340196e2a414cce82dbaf 100644 (file)
@@ -119,8 +119,6 @@ function updateConfig(chart) {
        chart.options.scales = scaleConfig;
 
        chart._animationsDisabled = isAnimationDisabled(newOptions);
-       chart.ensureScalesHaveIDs();
-       chart.buildOrUpdateScales();
 }
 
 const KNOWN_POSITIONS = new Set(['top', 'bottom', 'left', 'right', 'chartArea']);
@@ -539,6 +537,9 @@ export default class Chart {
 
                updateConfig(me);
 
+               me.ensureScalesHaveIDs();
+               me.buildOrUpdateScales();
+
                // plugins options references might have change, let's invalidate the cache
                // https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
                plugins.invalidate(me);