Fix initial animations (#7511)

* Fix initial animations

* CC
This commit is contained in:
Jukka Kurkela 2020-06-17 00:56:42 +03:00 committed by GitHub
parent 988464323f
commit c439d816fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -229,7 +229,7 @@ class Chart {
this.$plugins = undefined; this.$plugins = undefined;
this.$proxies = {}; this.$proxies = {};
this._hiddenIndices = {}; this._hiddenIndices = {};
this.attached = true; this.attached = false;
// Add the chart instance to the global namespace // Add the chart instance to the global namespace
Chart.instances[me.id] = me; Chart.instances[me.id] = me;
@ -333,16 +333,13 @@ class Chart {
retinaScale(me, newRatio); retinaScale(me, newRatio);
if (!silent) { if (!silent) {
// Notify any plugins about the resize
plugins.notify(me, 'resize', [newSize]); plugins.notify(me, 'resize', [newSize]);
// Notify of resize callCallback(options.onResize, [newSize], me);
if (options.onResize) {
options.onResize(me, newSize);
}
// Only apply 'resize' mode if we are attached, else do a regular update. if (me.attached) {
me.update(me.attached && 'resize'); me.update('resize');
}
} }
} }