]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Shave off some bytes (#8362)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Mon, 1 Feb 2021 13:39:43 +0000 (15:39 +0200)
committerGitHub <noreply@github.com>
Mon, 1 Feb 2021 13:39:43 +0000 (08:39 -0500)
src/core/core.controller.js
src/core/core.layouts.js

index 4360c01ef9e5ccd716afd5f3608d0e1bae2f3851..3a143bf60a27fc89995a9da7459d7aa7587b3c89 100644 (file)
@@ -323,10 +323,7 @@ class Chart {
                me.scales = scales;
 
                each(scales, (scale) => {
-                       // Set LayoutItem parameters for backwards compatibility
-                       scale.fullSize = scale.options.fullSize;
-                       scale.position = scale.options.position;
-                       scale.weight = scale.options.weight;
+                       layouts.configure(me, scale, scale.options);
                        layouts.addBox(me, scale);
                });
        }
index 970a2a10b5140197d8883fd4e216268364a0460c..baf1637baaf8838ae8d22ca01a4d83fbb0efd500 100644 (file)
@@ -284,17 +284,9 @@ export default {
         * @param {object} options - the new item options.
         */
        configure(chart, item, options) {
-               const props = ['fullSize', 'position', 'weight'];
-               const ilen = props.length;
-               let i = 0;
-               let prop;
-
-               for (; i < ilen; ++i) {
-                       prop = props[i];
-                       if (Object.prototype.hasOwnProperty.call(options, prop)) {
-                               item[prop] = options[prop];
-                       }
-               }
+               item.fullSize = options.fullSize;
+               item.position = options.position;
+               item.weight = options.weight;
        },
 
        /**