11/*!
2- * Chart.js v2.9.3
2+ * Chart.js v2.9.4
33 * https://www.chartjs.org
4- * (c) 2019 Chart.js Contributors
4+ * (c) 2020 Chart.js Contributors
55 * Released under the MIT License
66 */
77(function (global, factory) {
@@ -2107,6 +2107,10 @@ if (typeof window !== 'undefined') {
21072107
21082108var chartjsColor = Color;
21092109
2110+ function isValidKey(key) {
2111+ return ['__proto__', 'prototype', 'constructor'].indexOf(key) === -1;
2112+ }
2113+
21102114/**
21112115 * @namespace Chart.helpers
21122116 */
@@ -2282,7 +2286,7 @@ var helpers = {
22822286 }
22832287
22842288 if (helpers.isObject(source)) {
2285- var target = {} ;
2289+ var target = Object.create(source) ;
22862290 var keys = Object.keys(source);
22872291 var klen = keys.length;
22882292 var k = 0;
@@ -2303,6 +2307,12 @@ var helpers = {
23032307 * @private
23042308 */
23052309 _merger: function(key, target, source, options) {
2310+ if (!isValidKey(key)) {
2311+ // We want to ensure we do not copy prototypes over
2312+ // as this can pollute global namespaces
2313+ return;
2314+ }
2315+
23062316 var tval = target[key];
23072317 var sval = source[key];
23082318
@@ -2318,6 +2328,12 @@ var helpers = {
23182328 * @private
23192329 */
23202330 _mergerIf: function(key, target, source) {
2331+ if (!isValidKey(key)) {
2332+ // We want to ensure we do not copy prototypes over
2333+ // as this can pollute global namespaces
2334+ return;
2335+ }
2336+
23212337 var tval = target[key];
23222338 var sval = source[key];
23232339
@@ -3816,7 +3832,7 @@ helpers$1.extend(DatasetController.prototype, {
38163832 */
38173833 _configure: function() {
38183834 var me = this;
3819- me._config = helpers$1.merge({} , [
3835+ me._config = helpers$1.merge(Object.create(null) , [
38203836 me.chart.options.datasets[me._type],
38213837 me.getDataset(),
38223838 ], {
@@ -7086,7 +7102,8 @@ function updateDims(chartArea, params, layout) {
70867102 chartArea.h = newHeight;
70877103
70887104 // return true if chart area changed in layout's direction
7089- return layout.horizontal ? newWidth !== chartArea.w : newHeight !== chartArea.h;
7105+ var sizes = layout.horizontal ? [newWidth, chartArea.w] : [newHeight, chartArea.h];
7106+ return sizes[0] !== sizes[1] && (!isNaN(sizes[0]) || !isNaN(sizes[1]));
70907107 }
70917108}
70927109
@@ -7390,7 +7407,7 @@ var platform_basic = {
73907407 }
73917408};
73927409
7393- var platform_dom = "/*\n * DOM element rendering detection\n * https://davidwalsh.name/detect-node-insertion\n */\n@keyframes chartjs-render-animation {\n\tfrom { opacity: 0.99; }\n\tto { opacity: 1; }\n}\n\ n.chartjs-render-monitor {\n\tanimation: chartjs-render-animation 0.001s;\n}\n\ n/*\n * DOM element resizing detection\n * https://github.com/marcj/css-element-queries\n */\n.chartjs-size-monitor,\n.chartjs-size-monitor-expand,\n.chartjs-size-monitor-shrink {\n\tposition: absolute;\n\tdirection: ltr;\n\tleft: 0;\n\ttop: 0;\n\tright: 0;\n\tbottom: 0;\n\toverflow: hidden;\n\tpointer-events: none;\n\tvisibility: hidden;\n\tz-index: -1;\n}\n\ n.chartjs-size-monitor-expand > div {\n\tposition: absolute;\n\twidth: 1000000px;\n\theight: 1000000px;\n\tleft: 0;\n\ttop: 0;\n}\n\ n.chartjs-size-monitor-shrink > div {\n\tposition: absolute;\n\twidth: 200%;\n\theight: 200%;\n\tleft: 0;\n\ttop: 0;\n} \n";
7410+ var platform_dom = "/*\r\ n * DOM element rendering detection\r\ n * https://davidwalsh.name/detect-node-insertion\r\ n */\r\ n@keyframes chartjs-render-animation {\r\ n\tfrom { opacity: 0.99; }\r\ n\tto { opacity: 1; }\r\ n}\r\n\r\ n.chartjs-render-monitor {\r\ n\tanimation: chartjs-render-animation 0.001s;\r\ n}\r\n\r\ n/*\r\ n * DOM element resizing detection\r\ n * https://github.com/marcj/css-element-queries\r\ n */\r\ n.chartjs-size-monitor,\r\ n.chartjs-size-monitor-expand,\r\ n.chartjs-size-monitor-shrink {\r\ n\tposition: absolute;\r\ n\tdirection: ltr;\r\ n\tleft: 0;\r\ n\ttop: 0;\r\ n\tright: 0;\r\ n\tbottom: 0;\r\ n\toverflow: hidden;\r\ n\tpointer-events: none;\r\ n\tvisibility: hidden;\r\ n\tz-index: -1;\r\ n}\r\n\r\ n.chartjs-size-monitor-expand > div {\r\ n\tposition: absolute;\r\ n\twidth: 1000000px;\r\ n\theight: 1000000px;\r\ n\tleft: 0;\r\ n\ttop: 0;\r\ n}\r\n\r\ n.chartjs-size-monitor-shrink > div {\r\ n\tposition: absolute;\r\ n\twidth: 200%;\r\ n\theight: 200%;\r\ n\tleft: 0;\r\ n\ttop: 0;\r\n}\r \n";
73947411
73957412var platform_dom$1 = /*#__PURE__*/Object.freeze({
73967413__proto__: null,
@@ -8098,7 +8115,7 @@ var core_scaleService = {
80988115 },
80998116 getScaleDefaults: function(type) {
81008117 // Return the scale defaults merged with the global settings so that we always use the latest ones
8101- return this.defaults.hasOwnProperty(type) ? helpers$1.merge({} , [core_defaults.scale, this.defaults[type]]) : {};
8118+ return this.defaults.hasOwnProperty(type) ? helpers$1.merge(Object.create(null) , [core_defaults.scale, this.defaults[type]]) : {};
81028119 },
81038120 updateScaleDefaults: function(type, additions) {
81048121 var me = this;
@@ -9173,7 +9190,7 @@ core_defaults._set('global', {
91739190 * returns a deep copy of the result, thus doesn't alter inputs.
91749191 */
91759192function mergeScaleConfig(/* config objects ... */) {
9176- return helpers$1.merge({} , [].slice.call(arguments), {
9193+ return helpers$1.merge(Object.create(null) , [].slice.call(arguments), {
91779194 merger: function(key, target, source, options) {
91789195 if (key === 'xAxes' || key === 'yAxes') {
91799196 var slen = source[key].length;
@@ -9213,9 +9230,9 @@ function mergeScaleConfig(/* config objects ... */) {
92139230 * a deep copy of the result, thus doesn't alter inputs.
92149231 */
92159232function mergeConfig(/* config objects ... */) {
9216- return helpers$1.merge({} , [].slice.call(arguments), {
9233+ return helpers$1.merge(Object.create(null) , [].slice.call(arguments), {
92179234 merger: function(key, target, source, options) {
9218- var tval = target[key] || {} ;
9235+ var tval = target[key] || Object.create(null) ;
92199236 var sval = source[key];
92209237
92219238 if (key === 'scales') {
@@ -9232,7 +9249,7 @@ function mergeConfig(/* config objects ... */) {
92329249}
92339250
92349251function initConfig(config) {
9235- config = config || {} ;
9252+ config = config || Object.create(null) ;
92369253
92379254 // Do NOT use mergeConfig for the data object because this method merges arrays
92389255 // and so would change references to labels and datasets, preventing data updates.
@@ -11213,6 +11230,8 @@ function computeLabelSizes(ctx, tickFonts, ticks, caches) {
1121311230 var widths = [];
1121411231 var heights = [];
1121511232 var offsets = [];
11233+ var widestLabelSize = 0;
11234+ var highestLabelSize = 0;
1121611235 var i, j, jlen, label, tickFont, fontString, cache, lineHeight, width, height, nestedLabel, widest, highest;
1121711236
1121811237 for (i = 0; i < length; ++i) {
@@ -11240,11 +11259,13 @@ function computeLabelSizes(ctx, tickFonts, ticks, caches) {
1124011259 widths.push(width);
1124111260 heights.push(height);
1124211261 offsets.push(lineHeight / 2);
11262+ widestLabelSize = Math.max(width, widestLabelSize);
11263+ highestLabelSize = Math.max(height, highestLabelSize);
1124311264 }
1124411265 garbageCollect(caches, length);
1124511266
11246- widest = widths.indexOf(Math.max.apply(null, widths) );
11247- highest = heights.indexOf(Math.max.apply(null, heights) );
11267+ widest = widths.indexOf(widestLabelSize );
11268+ highest = heights.indexOf(highestLabelSize );
1124811269
1124911270 function valueAt(idx) {
1125011271 return {
@@ -20752,4 +20773,4 @@ core_controller.helpers.each(
2075220773
2075320774return src;
2075420775
20755- })));
20776+ })));
0 commit comments