]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Remove Element.initialize (#6777)
authorBen McCann <322311+benmccann@users.noreply.github.com>
Thu, 21 Nov 2019 12:06:15 +0000 (04:06 -0800)
committerEvert Timberg <evert.timberg+github@gmail.com>
Thu, 21 Nov 2019 12:06:15 +0000 (07:06 -0500)
docs/getting-started/v3-migration.md
src/core/core.controller.js
src/core/core.element.js
src/core/core.tooltip.js
src/plugins/plugin.legend.js
src/plugins/plugin.title.js

index 3dfd79bd0975f5abee32bc04bf71f2048c4e96fc..f803f5b3a22e764619dd7bf13e2cdb2a013944ac 100644 (file)
@@ -71,6 +71,7 @@ Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released
 * `DatasetController.addElementAndReset`
 * `Element.getArea`
 * `Element.height`
+* `Element.initialize`
 * `Element.inLabelRange`
 * `IPlugin.afterScaleUpdate`. Use `afterLayout` instead
 * `Line.calculatePointY`
index a1325394a51f107e42aba17b3d1adca86bd0081c..dee8ebc53a9c7981602d39fa172d55a5a7ef4853 100644 (file)
@@ -952,7 +952,7 @@ helpers.extend(Chart.prototype, /** @lends Chart */ {
                        _chart: me,
                        _data: me.data,
                        _options: me.options.tooltips
-               }, me);
+               });
        },
 
        /**
index 799ec82a4abe2d107501ce3ccd8289dbcd427bfd..f4feb4bd6ec0f138dd867c08e4b209f9d6192f6b 100644 (file)
@@ -58,12 +58,8 @@ class Element {
                helpers.extend(this, configuration);
 
                // this.hidden = false; we assume Element has an attribute called hidden, but do not initialize to save memory
-
-               this.initialize.apply(this, arguments);
        }
 
-       initialize() {}
-
        pivot(animationsDisabled) {
                var me = this;
                if (animationsDisabled) {
index e6a439f83482633fbc9569bd7e8bfe75d86b156d..c23a4073ab6b417e1b6b83b3f470340f88b54f0c 100644 (file)
@@ -485,6 +485,12 @@ function getBeforeAfterBodyLines(callback) {
 }
 
 class Tooltip extends Element {
+       constructor(config) {
+               super(config);
+
+               this.initialize();
+       }
+
        initialize() {
                var me = this;
                me._model = getBaseModel(me._options);
index 83f1cf3d9593bbf35acc45206313122fd13817b3..8bceb9f5312b36ed4691f2bcfa875f1e8cea6baa 100644 (file)
@@ -113,8 +113,10 @@ function getBoxWidth(labelOpts, fontSize) {
  */
 class Legend extends Element {
 
-       initialize(config) {
-               var me = this;
+       constructor(config) {
+               super();
+
+               const me = this;
                helpers.extend(me, config);
 
                // Contains hit boxes for each dataset (in dataset order)
index fd64c3d5bbc52495abf82d5f699dca433191f83e..158d023c70257bfa057a2e0cebc203317627ff41 100644 (file)
@@ -21,7 +21,9 @@ defaults._set('global', {
  * IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!
  */
 class Title extends Element {
-       initialize(config) {
+       constructor(config) {
+               super();
+
                var me = this;
                helpers.extend(me, config);