]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Update dependencies and alter privacy of functions (#7138)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sat, 22 Feb 2020 13:35:16 +0000 (15:35 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Feb 2020 13:35:16 +0000 (08:35 -0500)
* Update dependencies

* Fix privacy problems

* color lib & consistency

* Review update

* getLabelCapacity

* Review update

28 files changed:
docs/getting-started/v3-migration.md
package-lock.json
package.json
src/controllers/controller.bar.js
src/controllers/controller.bubble.js
src/controllers/controller.doughnut.js
src/controllers/controller.horizontalBar.js
src/controllers/controller.line.js
src/controllers/controller.polarArea.js
src/controllers/controller.radar.js
src/core/core.controller.js
src/core/core.datasetController.js
src/core/core.interaction.js
src/core/core.plugins.js
src/core/core.scale.js
src/helpers/helpers.color.js
src/plugins/plugin.filler.js
src/plugins/plugin.legend.js
src/plugins/plugin.tooltip.js
src/scales/scale.category.js
src/scales/scale.linear.js
src/scales/scale.linearbase.js
src/scales/scale.logarithmic.js
src/scales/scale.radialLinear.js
src/scales/scale.time.js
test/specs/controller.radar.tests.js
test/specs/core.datasetController.tests.js
test/specs/scale.time.tests.js

index e6dd7ef424e0f8a813351eae7a2fd4965f050f0a..9f3dc4f40b4e91d81ac62d893e9575a3bbb965ab 100644 (file)
@@ -133,13 +133,14 @@ Animation system was completely rewritten in Chart.js v3. Each property can now
 * `Line.calculatePointY`
 * `LogarithmicScale.minNotZero`
 * `Scale.getRightValue`
-* `Scale.handleDirectionalChanges` is now private
 * `Scale.longestLabelWidth`
 * `Scale.longestTextCache` is now private
 * `Scale.margins` is now private
 * `Scale.mergeTicksOptions`
 * `Scale.ticksAsNumbers`
 * `Scale.tickValues` is now private
+* `TimeScale.getLabelCapacity` is now private
+* `TimeScale.tickFormatFunction` is now private
 * `Title.margins` is now private
 * The tooltip item's `x` and `y` attributes were removed. Use `datasetIndex` and `index` to get the element and any corresponding data from it
 
@@ -150,7 +151,7 @@ Animation system was completely rewritten in Chart.js v3. Each property can now
 * `Element._model`
 * `Element._view`
 * `LogarithmicScale._valueOffset`
-* `TimeScale._getPixelForOffset`
+* `TimeScale.getPixelForOffset`
 * `TimeScale.getLabelWidth`
 * `Tooltip._lastActive`
 
@@ -182,9 +183,6 @@ Animation system was completely rewritten in Chart.js v3. Each property can now
 * `helpers.toDegrees` was renamed to `helpers.math.toDegrees`
 * `helpers.toRadians` was renamed to `helpers.math.toRadians`
 * `Scale.calculateTickRotation` was renamed to `Scale.calculateLabelRotation`
-* `TimeScale.getLabelCapacity` was renamed to `TimeScale._getLabelCapacity`
-* `TimeScale.getPixelForOffset` was renamed to `TimeScale._getPixelForOffset`
-* `TimeScale.tickFormatFunction` was renamed to `TimeScale._tickFormatFunction`
 * `Tooltip.options.legendColorBackgroupd` was renamed to `Tooltip.options.multiKeyBackground`
 
 #### Renamed private APIs
index 921968082107c080423443ce40b67feaf6e257ee..29cb3ce9c93ec98f29323b326243835f86448913 100644 (file)
       "dev": true
     },
     "@kurkle/color": {
-      "version": "0.1.3",
-      "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.1.3.tgz",
-      "integrity": "sha512-AEYY1u0xlvb7gyT1Dfe4cg6Brfk7ymmyFJkx2KUIIf/u+lvOPhvUqSwNYMEtBCrEO6KW2Iqtdy174HNa9R51Sg=="
+      "version": "0.1.6",
+      "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.1.6.tgz",
+      "integrity": "sha512-jOb40/8Ih98jEQq4gsBw6Wo35hD/XDDfbM/DaikRdEwNMdJAs/bipZugzUDeegTqHMlFFuA4oN28PVINMedm4A=="
     },
     "@rollup/plugin-commonjs": {
       "version": "11.0.2",
         "object-visit": "^1.0.0"
       }
     },
+    "marked": {
+      "version": "0.8.0",
+      "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.0.tgz",
+      "integrity": "sha512-MyUe+T/Pw4TZufHkzAfDj6HarCBWia2y27/bhuYkTaiUnfDYFnCP3KUN+9oM7Wi6JA2rymtVYbQu3spE0GCmxQ==",
+      "dev": true
+    },
     "matchdep": {
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/matchdep/-/matchdep-2.0.0.tgz",
       }
     },
     "rollup": {
-      "version": "1.31.0",
-      "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.31.0.tgz",
-      "integrity": "sha512-9C6ovSyNeEwvuRuUUmsTpJcXac1AwSL1a3x+O5lpmQKZqi5mmrjauLeqIjvREC+yNRR8fPdzByojDng+af3nVw==",
+      "version": "1.31.1",
+      "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.31.1.tgz",
+      "integrity": "sha512-2JREN1YdrS/kpPzEd33ZjtuNbOuBC3ePfuZBdKEybvqcEcszW1ckyVqzcEiEe0nE8sqHK+pbJg+PsAgRJ8+1dg==",
       "dev": true,
       "requires": {
         "@types/estree": "*",
       "dev": true
     },
     "typedoc": {
-      "version": "0.16.9",
-      "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.16.9.tgz",
-      "integrity": "sha512-UvOGoy76yqwCXwxPgatwgXWfsQ3FczyZ6ZNLjhCPK+TsDir6LiU3YB6N9XZmPv36E+7LA860mnc8a0v6YADKFw==",
+      "version": "0.16.10",
+      "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.16.10.tgz",
+      "integrity": "sha512-Eo1+K+XTiqSi4lz5cPrV4RncLv6abjCd/jfL5tTueNZGO2p8x2yDIrXkxL9C+SoLjJm2xpMs3CXYmTnilxk1cA==",
       "dev": true,
       "requires": {
         "@types/minimatch": "3.0.3",
             "graceful-fs": "^4.1.6"
           }
         },
-        "marked": {
-          "version": "0.8.0",
-          "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.0.tgz",
-          "integrity": "sha512-MyUe+T/Pw4TZufHkzAfDj6HarCBWia2y27/bhuYkTaiUnfDYFnCP3KUN+9oM7Wi6JA2rymtVYbQu3spE0GCmxQ==",
-          "dev": true
-        },
         "source-map": {
           "version": "0.6.1",
           "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
           "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
           "dev": true
+        },
+        "typescript": {
+          "version": "3.7.5",
+          "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
+          "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
+          "dev": true
         }
       }
     },
       }
     },
     "typescript": {
-      "version": "3.7.5",
-      "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
-      "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
+      "version": "3.8.2",
+      "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.2.tgz",
+      "integrity": "sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==",
       "dev": true
     },
     "uglify-js": {
       "dev": true
     },
     "underscore": {
-      "version": "1.9.1",
-      "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz",
-      "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==",
+      "version": "1.9.2",
+      "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.2.tgz",
+      "integrity": "sha512-D39qtimx0c1fI3ya1Lnhk3E9nONswSKhnffBI0gME9C99fYOkNi04xs8K6pePLhvl1frbDemkaBQ5ikWllR2HQ==",
       "dev": true
     },
     "undertaker": {
index 4e326e205069013505d2585a2d4cf38107a2f5e3..1953bcf09cd6c0a088034a6d8b51ea880c9a05d3 100644 (file)
     "moment": "^2.10.2",
     "pixelmatch": "^5.0.0",
     "resize-observer-polyfill": "^1.5.1",
-    "rollup": "^1.31.0",
+    "rollup": "^1.31.1",
     "rollup-plugin-babel": "^4.3.3",
     "rollup-plugin-cleanup": "^3.1.1",
     "rollup-plugin-terser": "^5.2.0",
-    "typedoc": "^0.16.9",
-    "typescript": "^3.7.5",
+    "typedoc": "^0.16.10",
+    "typescript": "^3.8.2",
     "yargs": "^14.2.2"
   },
   "dependencies": {
-    "@kurkle/color": "^0.1.3"
+    "@kurkle/color": "^0.1.6"
   }
 }
index 67b09bcdb46e23bfbb501cfc7c5a76704df289cf..69aa5dbe52832970115cb908bc0e8db650d25533 100644 (file)
@@ -125,8 +125,8 @@ function computeFlexCategoryTraits(index, ruler, options) {
 }
 
 function parseFloatBar(arr, item, vScale, i) {
-       const startValue = vScale._parse(arr[0], i);
-       const endValue = vScale._parse(arr[1], i);
+       const startValue = vScale.parse(arr[0], i);
+       const endValue = vScale.parse(arr[1], i);
        const min = Math.min(startValue, endValue);
        const max = Math.max(startValue, endValue);
        let barStart = min;
@@ -154,7 +154,7 @@ function parseFloatBar(arr, item, vScale, i) {
 function parseArrayOrPrimitive(meta, data, start, count) {
        const iScale = meta.iScale;
        const vScale = meta.vScale;
-       const labels = iScale._getLabels();
+       const labels = iScale.getLabels();
        const singleScale = iScale === vScale;
        const parsed = [];
        let i, ilen, item, entry;
@@ -162,12 +162,12 @@ function parseArrayOrPrimitive(meta, data, start, count) {
        for (i = start, ilen = start + count; i < ilen; ++i) {
                entry = data[i];
                item = {};
-               item[iScale.axis] = singleScale || iScale._parse(labels[i], i);
+               item[iScale.axis] = singleScale || iScale.parse(labels[i], i);
 
                if (isArray(entry)) {
                        parseFloatBar(entry, item, vScale, i);
                } else {
-                       item[vScale.axis] = vScale._parse(entry, i);
+                       item[vScale.axis] = vScale.parse(entry, i);
                }
 
                parsed.push(item);
@@ -184,27 +184,27 @@ export default class BarController extends DatasetController {
        /**
         * Overriding primitive data parsing since we support mixed primitive/array
         * data for float bars
-        * @private
+        * @protected
         */
-       _parsePrimitiveData(meta, data, start, count) {
+       parsePrimitiveData(meta, data, start, count) {
                return parseArrayOrPrimitive(meta, data, start, count);
        }
 
        /**
         * Overriding array data parsing since we support mixed primitive/array
         * data for float bars
-        * @private
+        * @protected
         */
-       _parseArrayData(meta, data, start, count) {
+       parseArrayData(meta, data, start, count) {
                return parseArrayOrPrimitive(meta, data, start, count);
        }
 
        /**
         * Overriding object data parsing since we support mixed primitive/array
         * value-scale data for float bars
-        * @private
+        * @protected
         */
-       _parseObjectData(meta, data, start, count) {
+       parseObjectData(meta, data, start, count) {
                const {iScale, vScale} = meta;
                const vProp = vScale.axis;
                const parsed = [];
@@ -212,12 +212,12 @@ export default class BarController extends DatasetController {
                for (i = start, ilen = start + count; i < ilen; ++i) {
                        obj = data[i];
                        item = {};
-                       item[iScale.axis] = iScale._parseObject(obj, iScale.axis, i);
+                       item[iScale.axis] = iScale.parseObject(obj, iScale.axis, i);
                        value = obj[vProp];
                        if (isArray(value)) {
                                parseFloatBar(value, item, vScale, i);
                        } else {
-                               item[vScale.axis] = vScale._parseObject(obj, vProp, i);
+                               item[vScale.axis] = vScale.parseObject(obj, vProp, i);
                        }
                        parsed.push(item);
                }
@@ -225,13 +225,13 @@ export default class BarController extends DatasetController {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getLabelAndValue(index) {
+       getLabelAndValue(index) {
                const me = this;
                const meta = me._cachedMeta;
                const {iScale, vScale} = meta;
-               const parsed = me._getParsed(index);
+               const parsed = me.getParsed(index);
                const custom = parsed._custom;
                const value = isFloatBar(custom)
                        ? '[' + custom.start + ', ' + custom.end + ']'
@@ -267,15 +267,15 @@ export default class BarController extends DatasetController {
                const base = vscale.getBasePixel();
                const horizontal = vscale.isHorizontal();
                const ruler = me._getRuler();
-               const firstOpts = me._resolveDataElementOptions(start, mode);
-               const sharedOptions = me._getSharedOptions(mode, rectangles[start], firstOpts);
-               const includeOptions = me._includeOptions(mode, sharedOptions);
+               const firstOpts = me.resolveDataElementOptions(start, mode);
+               const sharedOptions = me.getSharedOptions(mode, rectangles[start], firstOpts);
+               const includeOptions = me.includeOptions(mode, sharedOptions);
 
                let i;
 
                for (i = 0; i < rectangles.length; i++) {
                        const index = start + i;
-                       const options = me._resolveDataElementOptions(index, mode);
+                       const options = me.resolveDataElementOptions(index, mode);
                        const vpixels = me._calculateBarValuePixels(index, options);
                        const ipixels = me._calculateBarIndexPixels(index, ruler, options);
 
@@ -290,17 +290,17 @@ export default class BarController extends DatasetController {
 
                        // all borders are drawn for floating bar
                        /* TODO: float bars border skipping magic
-                       if (me._getParsed(i)._custom) {
+                       if (me.getParsed(i)._custom) {
                                model.borderSkipped = null;
                        }
                        */
                        if (includeOptions) {
                                properties.options = options;
                        }
-                       me._updateElement(rectangles[i], index, properties, mode);
+                       me.updateElement(rectangles[i], index, properties, mode);
                }
 
-               me._updateSharedOptions(sharedOptions, mode);
+               me.updateSharedOptions(sharedOptions, mode);
        }
 
        /**
@@ -313,7 +313,7 @@ export default class BarController extends DatasetController {
                const me = this;
                const meta = me._cachedMeta;
                const iScale = meta.iScale;
-               const metasets = iScale._getMatchingVisibleMetas(me._type);
+               const metasets = iScale.getMatchingVisibleMetas(me._type);
                const stacked = iScale.options.stacked;
                const ilen = metasets.length;
                const stacks = [];
@@ -382,7 +382,7 @@ export default class BarController extends DatasetController {
                let i, ilen;
 
                for (i = 0, ilen = meta.data.length; i < ilen; ++i) {
-                       pixels.push(iScale.getPixelForValue(me._getParsed(i)[iScale.axis]));
+                       pixels.push(iScale.getPixelForValue(me.getParsed(i)[iScale.axis]));
                }
 
                return {
@@ -403,11 +403,11 @@ export default class BarController extends DatasetController {
                const meta = me._cachedMeta;
                const vScale = meta.vScale;
                const minBarLength = options.minBarLength;
-               const parsed = me._getParsed(index);
+               const parsed = me.getParsed(index);
                const custom = parsed._custom;
                let value = parsed[vScale.axis];
                let start = 0;
-               let length = meta._stacked ? me._applyStack(vScale, parsed) : value;
+               let length = meta._stacked ? me.applyStack(vScale, parsed) : value;
                let head, size;
 
                if (length !== value) {
@@ -484,7 +484,7 @@ export default class BarController extends DatasetController {
                clipArea(chart.ctx, chart.chartArea);
 
                for (; i < ilen; ++i) {
-                       if (!isNaN(me._getParsed(i)[vScale.axis])) {
+                       if (!isNaN(me.getParsed(i)[vScale.axis])) {
                                rects[i].draw(me._ctx);
                        }
                }
@@ -496,10 +496,7 @@ export default class BarController extends DatasetController {
 
 BarController.prototype.dataElementType = Rectangle;
 
-/**
- * @private
- */
-BarController.prototype._dataElementOptions = [
+BarController.prototype.dataElementOptions = [
        'backgroundColor',
        'borderColor',
        'borderSkipped',
index 4f5455c9e558420e7f8cbee167a89471fa4eb305..d4ee27b8421e2ea13e0ae9e74dab996c59252db2 100644 (file)
@@ -34,17 +34,17 @@ export default class BubbleController extends DatasetController {
 
        /**
         * Parse array of objects
-        * @private
+        * @protected
         */
-       _parseObjectData(meta, data, start, count) {
+       parseObjectData(meta, data, start, count) {
                const {xScale, yScale} = meta;
                const parsed = [];
                let i, ilen, item;
                for (i = start, ilen = start + count; i < ilen; ++i) {
                        item = data[i];
                        parsed.push({
-                               x: xScale._parseObject(item, 'x', i),
-                               y: yScale._parseObject(item, 'y', i),
+                               x: xScale.parseObject(item, 'x', i),
+                               y: yScale.parseObject(item, 'y', i),
                                _custom: item && item.r && +item.r
                        });
                }
@@ -52,9 +52,9 @@ export default class BubbleController extends DatasetController {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getMaxOverflow() {
+       getMaxOverflow() {
                const me = this;
                const meta = me._cachedMeta;
                let i = (meta.data || []).length - 1;
@@ -66,13 +66,13 @@ export default class BubbleController extends DatasetController {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getLabelAndValue(index) {
+       getLabelAndValue(index) {
                const me = this;
                const meta = me._cachedMeta;
                const {xScale, yScale} = meta;
-               const parsed = me._getParsed(index);
+               const parsed = me.getParsed(index);
                const x = xScale.getLabelForValue(parsed.x);
                const y = yScale.getLabelForValue(parsed.y);
                const r = parsed._custom;
@@ -83,9 +83,6 @@ export default class BubbleController extends DatasetController {
                };
        }
 
-       /**
-        * @protected
-        */
        update(mode) {
                const me = this;
                const points = me._cachedMeta.data;
@@ -94,21 +91,18 @@ export default class BubbleController extends DatasetController {
                me.updateElements(points, 0, mode);
        }
 
-       /**
-        * @protected
-        */
        updateElements(points, start, mode) {
                const me = this;
                const reset = mode === 'reset';
                const {xScale, yScale} = me._cachedMeta;
-               const firstOpts = me._resolveDataElementOptions(start, mode);
-               const sharedOptions = me._getSharedOptions(mode, points[start], firstOpts);
-               const includeOptions = me._includeOptions(mode, sharedOptions);
+               const firstOpts = me.resolveDataElementOptions(start, mode);
+               const sharedOptions = me.getSharedOptions(mode, points[start], firstOpts);
+               const includeOptions = me.includeOptions(mode, sharedOptions);
 
                for (let i = 0; i < points.length; i++) {
                        const point = points[i];
                        const index = start + i;
-                       const parsed = !reset && me._getParsed(index);
+                       const parsed = !reset && me.getParsed(index);
                        const x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(parsed.x);
                        const y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(parsed.y);
                        const properties = {
@@ -118,28 +112,28 @@ export default class BubbleController extends DatasetController {
                        };
 
                        if (includeOptions) {
-                               properties.options = me._resolveDataElementOptions(i, mode);
+                               properties.options = me.resolveDataElementOptions(i, mode);
 
                                if (reset) {
                                        properties.options.radius = 0;
                                }
                        }
 
-                       me._updateElement(point, index, properties, mode);
+                       me.updateElement(point, index, properties, mode);
                }
 
-               me._updateSharedOptions(sharedOptions, mode);
+               me.updateSharedOptions(sharedOptions, mode);
        }
 
        /**
-        * @private
+        * @protected
         */
-       _resolveDataElementOptions(index, mode) {
+       resolveDataElementOptions(index, mode) {
                const me = this;
                const chart = me.chart;
                const dataset = me.getDataset();
-               const parsed = me._getParsed(index);
-               let values = super._resolveDataElementOptions(index, mode);
+               const parsed = me.getParsed(index);
+               let values = super.resolveDataElementOptions(index, mode);
 
                // Scriptable options
                const context = {
@@ -169,15 +163,9 @@ export default class BubbleController extends DatasetController {
        }
 }
 
-/**
- * @protected
- */
 BubbleController.prototype.dataElementType = Point;
 
-/**
- * @private
- */
-BubbleController.prototype._dataElementOptions = [
+BubbleController.prototype.dataElementOptions = [
        'backgroundColor',
        'borderColor',
        'borderWidth',
index 18474288167b7f50a09ac68c2c21ecb62d62912f..8a59990bbeec249ff84559220add9e822601f1ea 100644 (file)
@@ -143,9 +143,8 @@ export default class DoughnutController extends DatasetController {
 
        /**
         * Override data parsing, since we are not using scales
-        * @private
         */
-       _parse(start, count) {
+       parse(start, count) {
                const data = this.getDataset().data;
                const meta = this._cachedMeta;
                let i, ilen;
@@ -218,9 +217,9 @@ export default class DoughnutController extends DatasetController {
                const animateScale = reset && animationOpts.animateScale;
                const innerRadius = animateScale ? 0 : me.innerRadius;
                const outerRadius = animateScale ? 0 : me.outerRadius;
-               const firstOpts = me._resolveDataElementOptions(start, mode);
-               const sharedOptions = me._getSharedOptions(mode, arcs[start], firstOpts);
-               const includeOptions = me._includeOptions(mode, sharedOptions);
+               const firstOpts = me.resolveDataElementOptions(start, mode);
+               const sharedOptions = me.getSharedOptions(mode, arcs[start], firstOpts);
+               const includeOptions = me.includeOptions(mode, sharedOptions);
                let startAngle = opts.rotation;
                let i;
 
@@ -242,13 +241,13 @@ export default class DoughnutController extends DatasetController {
                                innerRadius
                        };
                        if (includeOptions) {
-                               properties.options = me._resolveDataElementOptions(index, mode);
+                               properties.options = me.resolveDataElementOptions(index, mode);
                        }
                        startAngle += circumference;
 
-                       me._updateElement(arc, index, properties, mode);
+                       me.updateElement(arc, index, properties, mode);
                }
-               me._updateSharedOptions(sharedOptions, mode);
+               me.updateSharedOptions(sharedOptions, mode);
        }
 
        calculateTotal() {
@@ -289,7 +288,7 @@ export default class DoughnutController extends DatasetController {
                                        arcs = meta.data;
                                        controller = meta.controller;
                                        if (controller !== me) {
-                                               controller._configure();
+                                               controller.configure();
                                        }
                                        break;
                                }
@@ -301,7 +300,7 @@ export default class DoughnutController extends DatasetController {
                }
 
                for (i = 0, ilen = arcs.length; i < ilen; ++i) {
-                       options = controller._resolveDataElementOptions(i);
+                       options = controller.resolveDataElementOptions(i);
                        if (options.borderAlign !== 'inner') {
                                max = Math.max(max, options.borderWidth || 0, options.hoverBorderWidth || 0);
                        }
@@ -343,11 +342,7 @@ export default class DoughnutController extends DatasetController {
 
 DoughnutController.prototype.dataElementType = Arc;
 
-
-/**
- * @private
- */
-DoughnutController.prototype._dataElementOptions = [
+DoughnutController.prototype.dataElementOptions = [
        'backgroundColor',
        'borderColor',
        'borderWidth',
index cedffa6789a6800b574e3a3cd2f3f8c450b49ae4..e406a165b49d8657e37e3a99cd4bc9af53d69446 100644 (file)
@@ -43,16 +43,16 @@ defaults.set('horizontalBar', {
 export default class HorizontalBarController extends BarController {
 
        /**
-        * @private
+        * @protected
         */
-       _getValueScaleId() {
+       getValueScaleId() {
                return this._cachedMeta.xAxisID;
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getIndexScaleId() {
+       getIndexScaleId() {
                return this._cachedMeta.yAxisID;
        }
 }
index 5a74b8b62eb66650d9e414e4c5e8672006fc39df..bb567060b32f8f056995ad0467785d8d728f78ec 100644 (file)
@@ -45,10 +45,10 @@ export default class LineController extends DatasetController {
                if (showLine && mode !== 'resize') {
                        const properties = {
                                points,
-                               options: me._resolveDatasetElementOptions()
+                               options: me.resolveDatasetElementOptions()
                        };
 
-                       me._updateElement(line, undefined, properties, mode);
+                       me.updateElement(line, undefined, properties, mode);
                }
 
                // Update Points
@@ -59,9 +59,9 @@ export default class LineController extends DatasetController {
                const me = this;
                const reset = mode === 'reset';
                const {xScale, yScale, _stacked} = me._cachedMeta;
-               const firstOpts = me._resolveDataElementOptions(start, mode);
-               const sharedOptions = me._getSharedOptions(mode, points[start], firstOpts);
-               const includeOptions = me._includeOptions(mode, sharedOptions);
+               const firstOpts = me.resolveDataElementOptions(start, mode);
+               const sharedOptions = me.getSharedOptions(mode, points[start], firstOpts);
+               const includeOptions = me.includeOptions(mode, sharedOptions);
                const spanGaps = valueOrDefault(me._config.spanGaps, me.chart.options.spanGaps);
                const maxGapLength = isNumber(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;
                let prevParsed;
@@ -69,9 +69,9 @@ export default class LineController extends DatasetController {
                for (let i = 0; i < points.length; ++i) {
                        const index = start + i;
                        const point = points[i];
-                       const parsed = me._getParsed(index);
+                       const parsed = me.getParsed(index);
                        const x = xScale.getPixelForValue(parsed.x);
-                       const y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(_stacked ? me._applyStack(yScale, parsed) : parsed.y);
+                       const y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(_stacked ? me.applyStack(yScale, parsed) : parsed.y);
                        const properties = {
                                x,
                                y,
@@ -80,26 +80,26 @@ export default class LineController extends DatasetController {
                        };
 
                        if (includeOptions) {
-                               properties.options = me._resolveDataElementOptions(index, mode);
+                               properties.options = me.resolveDataElementOptions(index, mode);
                        }
 
-                       me._updateElement(point, index, properties, mode);
+                       me.updateElement(point, index, properties, mode);
 
                        prevParsed = parsed;
                }
 
-               me._updateSharedOptions(sharedOptions, mode);
+               me.updateSharedOptions(sharedOptions, mode);
        }
 
        /**
-        * @private
+        * @protected
         */
-       _resolveDatasetElementOptions(active) {
+       resolveDatasetElementOptions(active) {
                const me = this;
                const config = me._config;
                const options = me.chart.options;
                const lineOptions = options.elements.line;
-               const values = super._resolveDatasetElementOptions(active);
+               const values = super.resolveDatasetElementOptions(active);
 
                // The default behavior of lines is to break at null values, according
                // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158
@@ -112,9 +112,9 @@ export default class LineController extends DatasetController {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getMaxOverflow() {
+       getMaxOverflow() {
                const me = this;
                const meta = me._cachedMeta;
                const border = me._showLine && meta.dataset.options.borderWidth || 0;
@@ -162,10 +162,7 @@ LineController.prototype.datasetElementType = Line;
 
 LineController.prototype.dataElementType = Point;
 
-/**
- * @private
- */
-LineController.prototype._datasetElementOptions = [
+LineController.prototype.datasetElementOptions = [
        'backgroundColor',
        'borderCapStyle',
        'borderColor',
@@ -178,10 +175,7 @@ LineController.prototype._datasetElementOptions = [
        'fill'
 ];
 
-/**
- * @private
- */
-LineController.prototype._dataElementOptions = {
+LineController.prototype.dataElementOptions = {
        backgroundColor: 'pointBackgroundColor',
        borderColor: 'pointBorderColor',
        borderWidth: 'pointBorderWidth',
index 0e1e3ad464de413dec2056bb269a6309df8c57db..125b4b011753daff30fe0197d7e98850fc53313f 100644 (file)
@@ -98,16 +98,16 @@ export default class PolarAreaController extends DatasetController {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getIndexScaleId() {
+       getIndexScaleId() {
                return this._cachedMeta.rAxisID;
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getValueScaleId() {
+       getValueScaleId() {
                return this._cachedMeta.rAxisID;
        }
 
@@ -180,10 +180,10 @@ export default class PolarAreaController extends DatasetController {
                                outerRadius,
                                startAngle,
                                endAngle,
-                               options: me._resolveDataElementOptions(index)
+                               options: me.resolveDataElementOptions(index)
                        };
 
-                       me._updateElement(arc, index, properties, mode);
+                       me.updateElement(arc, index, properties, mode);
                }
        }
 
@@ -231,10 +231,7 @@ export default class PolarAreaController extends DatasetController {
 
 PolarAreaController.prototype.dataElementType = Arc;
 
-/**
- * @private
- */
-PolarAreaController.prototype._dataElementOptions = [
+PolarAreaController.prototype.dataElementOptions = [
        'backgroundColor',
        'borderColor',
        'borderWidth',
index f53bf7567de679fa2735731b25ada70e201e2524..3b08c9143c87a34a7f63a6379e79a2cc7e4e81cd 100644 (file)
@@ -21,29 +21,29 @@ defaults.set('radar', {
 export default class RadarController extends DatasetController {
 
        /**
-        * @private
+        * @protected
         */
-       _getIndexScaleId() {
+       getIndexScaleId() {
                return this._cachedMeta.rAxisID;
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getValueScaleId() {
+       getValueScaleId() {
                return this._cachedMeta.rAxisID;
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getLabelAndValue(index) {
+       getLabelAndValue(index) {
                const me = this;
                const vScale = me._cachedMeta.vScale;
-               const parsed = me._getParsed(index);
+               const parsed = me.getParsed(index);
 
                return {
-                       label: vScale._getLabels()[index],
+                       label: vScale.getLabels()[index],
                        value: '' + vScale.getLabelForValue(parsed[vScale.axis])
                };
        }
@@ -53,15 +53,15 @@ export default class RadarController extends DatasetController {
                const meta = me._cachedMeta;
                const line = meta.dataset;
                const points = meta.data || [];
-               const labels = meta.iScale._getLabels();
+               const labels = meta.iScale.getLabels();
                const properties = {
                        points,
                        _loop: true,
                        _fullLoop: labels.length === points.length,
-                       options: me._resolveDatasetElementOptions()
+                       options: me.resolveDatasetElementOptions()
                };
 
-               me._updateElement(line, undefined, properties, mode);
+               me.updateElement(line, undefined, properties, mode);
 
                // Update Points
                me.updateElements(points, 0, mode);
@@ -79,7 +79,7 @@ export default class RadarController extends DatasetController {
                for (i = 0; i < points.length; i++) {
                        const point = points[i];
                        const index = start + i;
-                       const options = me._resolveDataElementOptions(index);
+                       const options = me.resolveDataElementOptions(index);
                        const pointPosition = scale.getPointPositionForValue(index, dataset.data[index]);
 
                        const x = reset ? scale.xCenter : pointPosition.x;
@@ -93,18 +93,18 @@ export default class RadarController extends DatasetController {
                                options
                        };
 
-                       me._updateElement(point, index, properties, mode);
+                       me.updateElement(point, index, properties, mode);
                }
        }
 
        /**
-        * @private
+        * @protected
         */
-       _resolveDatasetElementOptions(active) {
+       resolveDatasetElementOptions(active) {
                const me = this;
                const config = me._config;
                const options = me.chart.options;
-               const values = super._resolveDatasetElementOptions(active);
+               const values = super.resolveDatasetElementOptions(active);
 
                values.spanGaps = valueOrDefault(config.spanGaps, options.spanGaps);
                values.tension = valueOrDefault(config.lineTension, options.elements.line.tension);
@@ -117,10 +117,7 @@ RadarController.prototype.datasetElementType = Line;
 
 RadarController.prototype.dataElementType = Point;
 
-/**
- * @private
- */
-RadarController.prototype._datasetElementOptions = [
+RadarController.prototype.datasetElementOptions = [
        'backgroundColor',
        'borderColor',
        'borderCapStyle',
@@ -131,10 +128,7 @@ RadarController.prototype._datasetElementOptions = [
        'fill'
 ];
 
-/**
- * @private
- */
-RadarController.prototype._dataElementOptions = {
+RadarController.prototype.dataElementOptions = {
        backgroundColor: 'pointBackgroundColor',
        borderColor: 'pointBorderColor',
        borderWidth: 'pointBorderWidth',
index 7b684b08a2086f44bcb3efb1e6f5a2de90abc938..a232f947dcdc154867fe7a458fdf924a0532b65a 100644 (file)
@@ -424,8 +424,8 @@ export default class Chart {
                        scale.axis = scale.options.position === 'chartArea' ? 'r' : scale.isHorizontal() ? 'x' : 'y';
 
                        // parse min/max value, so we can properly determine min/max for other scales
-                       scale._userMin = scale._parse(scale.options.min);
-                       scale._userMax = scale._parse(scale.options.max);
+                       scale._userMin = scale.parse(scale.options.min);
+                       scale._userMax = scale.parse(scale.options.max);
 
                        // TODO(SB): I think we should be able to remove this custom case (options.scale)
                        // and consider it as a regular scale part of the "scales"" map only! This would
@@ -549,7 +549,7 @@ export default class Chart {
 
                // plugins options references might have change, let's invalidate the cache
                // https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
-               plugins._invalidate(me);
+               plugins.invalidate(me);
 
                if (plugins.notify(me, 'beforeUpdate') === false) {
                        return;
@@ -605,10 +605,10 @@ export default class Chart {
 
                me._layers = [];
                helpers.each(me.boxes, (box) => {
-                       // _configure is called twice, once in core.scale.update and once here.
+                       // configure is called twice, once in core.scale.update and once here.
                        // Here the boxes are fully updated and at their final positions.
-                       if (box._configure) {
-                               box._configure();
+                       if (box.configure) {
+                               box.configure();
                        }
                        me._layers.push(...box._layers());
                }, me);
@@ -732,9 +732,10 @@ export default class Chart {
        }
 
        /**
-        * @private
+        * Gets the visible dataset metas in drawing order
+        * @return {object[]}
         */
-       _getSortedVisibleDatasetMetas() {
+       getSortedVisibleDatasetMetas() {
                return this._getSortedDatasetMetas(true);
        }
 
@@ -750,7 +751,7 @@ export default class Chart {
                        return;
                }
 
-               const metasets = me._getSortedVisibleDatasetMetas();
+               const metasets = me.getSortedVisibleDatasetMetas();
                for (let i = metasets.length - 1; i >= 0; --i) {
                        me._drawDataset(metasets[i]);
                }
@@ -847,7 +848,7 @@ export default class Chart {
        }
 
        getVisibleDatasetCount() {
-               return this._getSortedVisibleDatasetMetas().length;
+               return this.getSortedVisibleDatasetMetas().length;
        }
 
        isDatasetVisible(datasetIndex) {
index bf14736a1d110a6255c4a19a42e5163c4af82271..752bb5b279547d310d0fb7ab2b37189ca86df674 100644 (file)
@@ -1,6 +1,11 @@
 import helpers from '../helpers/index';
 import Animations from './core.animations';
 
+/**
+ * @typedef { import("../core/core.controller").default } Chart
+ * @typedef { import("../core/core.scale").default } Scale
+ */
+
 const resolve = helpers.options.resolve;
 
 const arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'];
@@ -174,7 +179,7 @@ function getStackKey(indexScale, valueScale, meta) {
 }
 
 function getUserBounds(scale) {
-       const {min, max, minDefined, maxDefined} = scale._getUserBounds();
+       const {min, max, minDefined, maxDefined} = scale.getUserBounds();
        return {
                min: minDefined ? min : Number.NEGATIVE_INFINITY,
                max: maxDefined ? max : Number.POSITIVE_INFINITY
@@ -214,6 +219,10 @@ export default class DatasetController {
 
        static extend = helpers.inherits;
 
+       /**
+        * @param {Chart} chart
+        * @param {number} datasetIndex
+        */
        constructor(chart, datasetIndex) {
                this.chart = chart;
                this._ctx = chart.ctx;
@@ -236,7 +245,7 @@ export default class DatasetController {
        initialize() {
                const me = this;
                const meta = me._cachedMeta;
-               me._configure();
+               me.configure();
                me.linkScales();
                meta._stacked = isStacked(meta.vScale, meta);
                me.addElements();
@@ -270,21 +279,25 @@ export default class DatasetController {
                return this.chart.getDatasetMeta(this.index);
        }
 
+       /**
+        * @param {string} scaleID
+        * @return {Scale}
+        */
        getScaleForId(scaleID) {
                return this.chart.scales[scaleID];
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getValueScaleId() {
+       getValueScaleId() {
                return this._cachedMeta.yAxisID;
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getIndexScaleId() {
+       getIndexScaleId() {
                return this._cachedMeta.xAxisID;
        }
 
@@ -292,14 +305,14 @@ export default class DatasetController {
         * @private
         */
        _getValueScale() {
-               return this.getScaleForId(this._getValueScaleId());
+               return this.getScaleForId(this.getValueScaleId());
        }
 
        /**
         * @private
         */
        _getIndexScale() {
-               return this.getScaleForId(this._getIndexScaleId());
+               return this.getScaleForId(this.getIndexScaleId());
        }
 
        /**
@@ -372,7 +385,7 @@ export default class DatasetController {
        _labelCheck() {
                const me = this;
                const iScale = me._cachedMeta.iScale;
-               const labels = iScale ? iScale._getLabels() : me.chart.data.labels;
+               const labels = iScale ? iScale.getLabels() : me.chart.data.labels;
 
                if (me._labels === labels) {
                        return false;
@@ -436,7 +449,7 @@ export default class DatasetController {
         * Merges user-supplied and default dataset-level options
         * @private
         */
-       _configure() {
+       configure() {
                const me = this;
                me._config = helpers.merge({}, [
                        me.chart.options[me._type].datasets,
@@ -452,9 +465,10 @@ export default class DatasetController {
        }
 
        /**
-        * @private
+        * @param {number} start
+        * @param {number} count
         */
-       _parse(start, count) {
+       parse(start, count) {
                const me = this;
                const {_cachedMeta: meta, _data: data} = me;
                const {iScale, vScale, _stacked} = meta;
@@ -472,11 +486,11 @@ export default class DatasetController {
                        meta._sorted = true;
                } else {
                        if (helpers.isArray(data[start])) {
-                               parsed = me._parseArrayData(meta, data, start, count);
+                               parsed = me.parseArrayData(meta, data, start, count);
                        } else if (helpers.isObject(data[start])) {
-                               parsed = me._parseObjectData(meta, data, start, count);
+                               parsed = me.parseObjectData(meta, data, start, count);
                        } else {
-                               parsed = me._parsePrimitiveData(meta, data, start, count);
+                               parsed = me.parsePrimitiveData(meta, data, start, count);
                        }
 
 
@@ -496,8 +510,8 @@ export default class DatasetController {
                        updateStacks(me, parsed);
                }
 
-               iScale._invalidateCaches();
-               vScale._invalidateCaches();
+               iScale.invalidateCaches();
+               vScale.invalidateCaches();
        }
 
        /**
@@ -509,13 +523,13 @@ export default class DatasetController {
         * @returns {object} parsed item - item containing index and a parsed value
         * for each scale id.
         * Example: {xScale0: 0, yScale0: 1}
-        * @private
+        * @protected
         */
-       _parsePrimitiveData(meta, data, start, count) {
+       parsePrimitiveData(meta, data, start, count) {
                const {iScale, vScale} = meta;
                const iAxis = iScale.axis;
                const vAxis = vScale.axis;
-               const labels = iScale._getLabels();
+               const labels = iScale.getLabels();
                const singleScale = iScale === vScale;
                const parsed = new Array(count);
                let i, ilen, index;
@@ -523,8 +537,8 @@ export default class DatasetController {
                for (i = 0, ilen = count; i < ilen; ++i) {
                        index = i + start;
                        parsed[i] = {
-                               [iAxis]: singleScale || iScale._parse(labels[index], index),
-                               [vAxis]: vScale._parse(data[index], index)
+                               [iAxis]: singleScale || iScale.parse(labels[index], index),
+                               [vAxis]: vScale.parse(data[index], index)
                        };
                }
                return parsed;
@@ -539,9 +553,9 @@ export default class DatasetController {
         * @returns {object} parsed item - item containing index and a parsed value
         * for each scale id.
         * Example: {x: 0, y: 1}
-        * @private
+        * @protected
         */
-       _parseArrayData(meta, data, start, count) {
+       parseArrayData(meta, data, start, count) {
                const {xScale, yScale} = meta;
                const parsed = new Array(count);
                let i, ilen, index, item;
@@ -550,8 +564,8 @@ export default class DatasetController {
                        index = i + start;
                        item = data[index];
                        parsed[i] = {
-                               x: xScale._parse(item[0], index),
-                               y: yScale._parse(item[1], index)
+                               x: xScale.parse(item[0], index),
+                               y: yScale.parse(item[1], index)
                        };
                }
                return parsed;
@@ -566,9 +580,9 @@ export default class DatasetController {
         * @returns {object} parsed item - item containing index and a parsed value
         * for each scale id. _custom is optional
         * Example: {xScale0: 0, yScale0: 1, _custom: {r: 10, foo: 'bar'}}
-        * @private
+        * @protected
         */
-       _parseObjectData(meta, data, start, count) {
+       parseObjectData(meta, data, start, count) {
                const {xScale, yScale} = meta;
                const parsed = new Array(count);
                let i, ilen, index, item;
@@ -577,24 +591,24 @@ export default class DatasetController {
                        index = i + start;
                        item = data[index];
                        parsed[i] = {
-                               x: xScale._parseObject(item, 'x', index),
-                               y: yScale._parseObject(item, 'y', index)
+                               x: xScale.parseObject(item, 'x', index),
+                               y: yScale.parseObject(item, 'y', index)
                        };
                }
                return parsed;
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getParsed(index) {
+       getParsed(index) {
                return this._cachedMeta._parsed[index];
        }
 
        /**
-        * @private
+        * @protected
         */
-       _applyStack(scale, parsed) {
+       applyStack(scale, parsed) {
                const chart = this.chart;
                const meta = this._cachedMeta;
                const value = parsed[scale.axis];
@@ -606,9 +620,9 @@ export default class DatasetController {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getMinMax(scale, canStack) {
+       getMinMax(scale, canStack) {
                const meta = this._cachedMeta;
                const {data, _parsed} = meta;
                const sorted = meta._sorted && scale === meta.iScale;
@@ -662,10 +676,7 @@ export default class DatasetController {
                return {min, max};
        }
 
-       /**
-        * @private
-        */
-       _getAllParsedValues(scale) {
+       getAllParsedValues(scale) {
                const parsed = this._cachedMeta._parsed;
                const values = [];
                let i, ilen, value;
@@ -712,21 +723,21 @@ export default class DatasetController {
 
        /**
         * @return {number|boolean}
-        * @private
+        * @protected
         */
-       _getMaxOverflow() {
+       getMaxOverflow() {
                return false;
        }
 
        /**
-        * @private
+        * @protected
         */
-       _getLabelAndValue(index) {
+       getLabelAndValue(index) {
                const me = this;
                const meta = me._cachedMeta;
                const iScale = meta.iScale;
                const vScale = meta.vScale;
-               const parsed = me._getParsed(index);
+               const parsed = me.getParsed(index);
                return {
                        label: iScale ? '' + iScale.getLabelForValue(parsed[iScale.axis]) : '',
                        value: vScale ? '' + vScale.getLabelForValue(parsed[vScale.axis]) : ''
@@ -739,11 +750,11 @@ export default class DatasetController {
        _update(mode) {
                const me = this;
                const meta = me._cachedMeta;
-               me._configure();
+               me.configure();
                me._cachedAnimations = {};
                me._cachedDataOpts = {};
                me.update(mode);
-               meta._clip = toClip(helpers.valueOrDefault(me._config.clip, defaultClip(meta.xScale, meta.yScale, me._getMaxOverflow())));
+               meta._clip = toClip(helpers.valueOrDefault(me._config.clip, defaultClip(meta.xScale, meta.yScale, me.getMaxOverflow())));
                me._cacheScaleStackStatus();
        }
 
@@ -797,12 +808,12 @@ export default class DatasetController {
                const dataset = meta.dataset;
 
                if (!me._config) {
-                       me._configure();
+                       me.configure();
                }
 
                const options = dataset && index === undefined
-                       ? me._resolveDatasetElementOptions(active)
-                       : me._resolveDataElementOptions(index || 0, active && 'active');
+                       ? me.resolveDatasetElementOptions(active)
+                       : me.resolveDataElementOptions(index || 0, active && 'active');
                if (active) {
                        me._addAutomaticHoverColors(index, options);
                }
@@ -824,15 +835,15 @@ export default class DatasetController {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _resolveDatasetElementOptions(active) {
+       resolveDatasetElementOptions(active) {
                const me = this;
                const chart = me.chart;
                const datasetOpts = me._config;
                // @ts-ignore
                const options = chart.options.elements[me.datasetElementType._type] || {};
-               const elementOptions = me._datasetElementOptions;
+               const elementOptions = me.datasetElementOptions;
                const values = {};
                const context = me._getContext(undefined, active);
                let i, ilen, key, readKey, value;
@@ -853,9 +864,9 @@ export default class DatasetController {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _resolveDataElementOptions(index, mode) {
+       resolveDataElementOptions(index, mode) {
                const me = this;
                const active = mode === 'active';
                const cached = me._cachedDataOpts;
@@ -866,7 +877,7 @@ export default class DatasetController {
                const datasetOpts = me._config;
                // @ts-ignore
                const options = chart.options.elements[me.dataElementType._type] || {};
-               const elementOptions = me._dataElementOptions;
+               const elementOptions = me.dataElementOptions;
                const values = {};
                const context = me._getContext(index, active);
                const info = {cacheable: !active};
@@ -948,9 +959,9 @@ export default class DatasetController {
 
        /**
         * Utility for checking if the options are shared and should be animated separately.
-        * @private
+        * @protected
         */
-       _getSharedOptions(mode, el, options) {
+       getSharedOptions(mode, el, options) {
                if (!mode) {
                        // store element option sharing status for usage in interactions
                        this._sharedOptions = options && options.$shared;
@@ -962,9 +973,9 @@ export default class DatasetController {
 
        /**
         * Utility for determining if `options` should be included in the updated properties
-        * @private
+        * @protected
         */
-       _includeOptions(mode, sharedOptions) {
+       includeOptions(mode, sharedOptions) {
                if (mode === 'hide' || mode === 'show') {
                        return true;
                }
@@ -973,9 +984,9 @@ export default class DatasetController {
 
        /**
         * Utility for updating a element with new properties, using animations when appropriate.
-        * @private
+        * @protected
         */
-       _updateElement(element, index, properties, mode) {
+       updateElement(element, index, properties, mode) {
                if (mode === 'reset' || mode === 'none') {
                        Object.assign(element, properties);
                } else {
@@ -985,9 +996,9 @@ export default class DatasetController {
 
        /**
         * Utility to animate the shared options, that are potentially affecting multiple elements.
-        * @private
+        * @protected
         */
-       _updateSharedOptions(sharedOptions, mode) {
+       updateSharedOptions(sharedOptions, mode) {
                if (sharedOptions) {
                        this._resolveAnimations(undefined, mode).update(sharedOptions.target, sharedOptions.options);
                }
@@ -1044,14 +1055,14 @@ export default class DatasetController {
                        me._insertElements(numMeta, numData - numMeta);
                        if (changed && numMeta) {
                                // _insertElements parses the new elements. The old ones might need parsing too.
-                               me._parse(0, numMeta);
+                               me.parse(0, numMeta);
                        }
                } else if (numData < numMeta) {
                        meta.data.splice(numData, numMeta - numData);
                        meta._parsed.splice(numData, numMeta - numData);
-                       me._parse(0, numData);
+                       me.parse(0, numData);
                } else if (changed) {
-                       me._parse(0, numData);
+                       me.parse(0, numData);
                }
        }
 
@@ -1073,7 +1084,7 @@ export default class DatasetController {
                if (me._parsing) {
                        meta._parsed.splice(start, 0, ...new Array(count));
                }
-               me._parse(start, count);
+               me.parse(start, count);
 
                me.updateElements(elements, start, 'reset');
        }
@@ -1141,13 +1152,12 @@ DatasetController.prototype.datasetElementType = null;
 DatasetController.prototype.dataElementType = null;
 
 /**
- * Dataset element option keys to be resolved in _resolveDatasetElementOptions.
+ * Dataset element option keys to be resolved in resolveDatasetElementOptions.
  * A derived controller may override this to resolve controller-specific options.
  * The keys defined here are for backward compatibility for legend styles.
  * @type {string[]}
- * @private
  */
-DatasetController.prototype._datasetElementOptions = [
+DatasetController.prototype.datasetElementOptions = [
        'backgroundColor',
        'borderCapStyle',
        'borderColor',
@@ -1158,13 +1168,12 @@ DatasetController.prototype._datasetElementOptions = [
 ];
 
 /**
- * Data element option keys to be resolved in _resolveDataElementOptions.
+ * Data element option keys to be resolved in resolveDataElementOptions.
  * A derived controller may override this to resolve controller-specific options.
  * The keys defined here are for backward compatibility for legend styles.
  * @type {string[]|object}
- * @private
  */
-DatasetController.prototype._dataElementOptions = [
+DatasetController.prototype.dataElementOptions = [
        'backgroundColor',
        'borderColor',
        'borderWidth',
index d172f1a3553021b9bcfb719fd679cfb20c4102ff..b296db031fedcec628bfbec7edf61abfc861dbbe 100644 (file)
@@ -31,7 +31,7 @@ function getRelativePosition(e, chart) {
  * @param {function} handler - the callback to execute for each visible item
  */
 function evaluateAllVisibleItems(chart, handler) {
-       const metasets = chart._getSortedVisibleDatasetMetas();
+       const metasets = chart.getSortedVisibleDatasetMetas();
        let index, data, element;
 
        for (let i = 0, ilen = metasets.length; i < ilen; ++i) {
@@ -86,7 +86,7 @@ function binarySearch(metaset, axis, value, intersect) {
  * @param {boolean} [intersect] - consider intersecting items
  */
 function optimizedEvaluateItems(chart, axis, position, handler, intersect) {
-       const metasets = chart._getSortedVisibleDatasetMetas();
+       const metasets = chart.getSortedVisibleDatasetMetas();
        const value = position[axis];
        for (let i = 0, ilen = metasets.length; i < ilen; ++i) {
                const {index, data} = metasets[i];
@@ -205,7 +205,7 @@ export default {
                                return [];
                        }
 
-                       chart._getSortedVisibleDatasetMetas().forEach((meta) => {
+                       chart.getSortedVisibleDatasetMetas().forEach((meta) => {
                                const index = items[0].index;
                                const element = meta.data[index];
 
index 9709fbe2e9bb9b807efcea1af17d7a596c77b977..b38e9db66ee1da4705347797e2914286b4894499 100644 (file)
@@ -169,9 +169,8 @@ export class PluginService {
         * but in some cases, this reference can be changed by the user when updating options.
         * https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
         * @param {Chart} chart
-        * @private
         */
-       _invalidate(chart) {
+       invalidate(chart) {
                delete chart.$plugins;
        }
 }
index b9e454af906c82010915a081046a572283ec3771..94c21f6f092a446b716e1f7a550dd4df494dc0fb 100644 (file)
@@ -349,10 +349,9 @@ export default class Scale extends Element {
         * Parse a supported input value to internal representation.
         * @param {*} raw
         * @param {number} index
-        * @private
         * @since 3.0
         */
-       _parse(raw, index) { // eslint-disable-line no-unused-vars
+       parse(raw, index) { // eslint-disable-line no-unused-vars
                return raw;
        }
 
@@ -361,22 +360,22 @@ export default class Scale extends Element {
         * @param {object} obj
         * @param {string} axis
         * @param {number} index
-        * @private
         * @since 3.0
+        * @protected
         */
-       _parseObject(obj, axis, index) {
+       parseObject(obj, axis, index) {
                if (obj[axis] !== undefined) {
-                       return this._parse(obj[axis], index);
+                       return this.parse(obj[axis], index);
                }
                return null;
        }
 
        /**
         * @return {{min: number, max: number, minDefined: boolean, maxDefined: boolean}}
-        * @private
+        * @protected
         * @since 3.0
         */
-       _getUserBounds() {
+       getUserBounds() {
                let min = this._userMin;
                let max = this._userMax;
                if (isNullOrUndef(min) || isNaN(min)) {
@@ -391,22 +390,22 @@ export default class Scale extends Element {
        /**
         * @param {boolean} canStack
         * @return {{min: number, max: number}}
-        * @private
+        * @protected
         * @since 3.0
         */
-       _getMinMax(canStack) {
+       getMinMax(canStack) {
                const me = this;
                // eslint-disable-next-line prefer-const
-               let {min, max, minDefined, maxDefined} = me._getUserBounds();
+               let {min, max, minDefined, maxDefined} = me.getUserBounds();
                let minmax;
 
                if (minDefined && maxDefined) {
                        return {min, max};
                }
 
-               const metas = me._getMatchingVisibleMetas();
+               const metas = me.getMatchingVisibleMetas();
                for (let i = 0, ilen = metas.length; i < ilen; ++i) {
-                       minmax = metas[i].controller._getMinMax(me, canStack);
+                       minmax = metas[i].controller.getMinMax(me, canStack);
                        if (!minDefined) {
                                min = Math.min(min, minmax.min);
                        }
@@ -418,10 +417,7 @@ export default class Scale extends Element {
                return {min, max};
        }
 
-       /**
-        * @private
-        */
-       _invalidateCaches() {}
+       invalidateCaches() {}
 
        /**
         * Get the padding needed for the scale
@@ -449,9 +445,8 @@ export default class Scale extends Element {
 
        /**
         * @return {string[]}
-        * @private
         */
-       _getLabels() {
+       getLabels() {
                const data = this.chart.data;
                return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels || [];
        }
@@ -517,11 +512,11 @@ export default class Scale extends Element {
                const samplingEnabled = sampleSize < me.ticks.length;
                me._convertTicksToLabels(samplingEnabled ? sample(me.ticks, sampleSize) : me.ticks);
 
-               // _configure is called twice, once here, once from core.controller.updateLayout.
+               // configure is called twice, once here, once from core.controller.updateLayout.
                // Here we haven't been positioned yet, but dimensions are correct.
-               // Variables set in _configure are needed for calculateLabelRotation, and
+               // Variables set in configure are needed for calculateLabelRotation, and
                // it's ok that coordinates are not correct there, only dimensions matter.
-               me._configure();
+               me.configure();
 
                // Tick Rotation
                me.beforeCalculateLabelRotation();
@@ -546,9 +541,9 @@ export default class Scale extends Element {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _configure() {
+       configure() {
                const me = this;
                let reversePixels = me.options.reverse;
                let startPixel, endPixel;
@@ -1094,7 +1089,7 @@ export default class Scale extends Element {
                        return !!display;
                }
 
-               return this._getMatchingVisibleMetas().length > 0;
+               return this.getMatchingVisibleMetas().length > 0;
        }
 
        /**
@@ -1315,9 +1310,9 @@ export default class Scale extends Element {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _drawGrid(chartArea) {
+       drawGrid(chartArea) {
                const me = this;
                const gridLines = me.options.gridLines;
                const ctx = me.ctx;
@@ -1394,9 +1389,9 @@ export default class Scale extends Element {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _drawLabels(chartArea) {
+       drawLabels(chartArea) {
                const me = this;
                const optionTicks = me.options.ticks;
 
@@ -1449,9 +1444,9 @@ export default class Scale extends Element {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _drawTitle(chartArea) { // eslint-disable-line no-unused-vars
+       drawTitle(chartArea) { // eslint-disable-line no-unused-vars
                const me = this;
                const ctx = me.ctx;
                const options = me.options;
@@ -1529,9 +1524,9 @@ export default class Scale extends Element {
                        return;
                }
 
-               me._drawGrid(chartArea);
-               me._drawTitle();
-               me._drawLabels(chartArea);
+               me.drawGrid(chartArea);
+               me.drawTitle();
+               me.drawLabels(chartArea);
        }
 
        /**
@@ -1557,13 +1552,13 @@ export default class Scale extends Element {
                return [{
                        z: gz,
                        draw(chartArea) {
-                               me._drawGrid(chartArea);
-                               me._drawTitle();
+                               me.drawGrid(chartArea);
+                               me.drawTitle();
                        }
                }, {
                        z: tz,
                        draw(chartArea) {
-                               me._drawLabels(chartArea);
+                               me.drawLabels(chartArea);
                        }
                }];
        }
@@ -1572,11 +1567,10 @@ export default class Scale extends Element {
         * Returns visible dataset metas that are attached to this scale
         * @param {string} [type] - if specified, also filter by dataset type
         * @return {object[]}
-        * @private
         */
-       _getMatchingVisibleMetas(type) {
+       getMatchingVisibleMetas(type) {
                const me = this;
-               const metas = me.chart._getSortedVisibleDatasetMetas();
+               const metas = me.chart.getSortedVisibleDatasetMetas();
                const axisID = me.axis + 'AxisID';
                const result = [];
                let i, ilen;
index 1049dc236736fbd89883447ceef01859cc683f43..50d4fa4f78c8b55822af4bda9d039c25a8722822 100644 (file)
@@ -1,22 +1,11 @@
 import colorLib from '@kurkle/color';
 
-/**
- * @param {string | CanvasGradient | CanvasPattern} value
- */
 const isPatternOrGradient = (value) => value instanceof CanvasGradient || value instanceof CanvasPattern;
 
-/**
- * @param {string|CanvasGradient|CanvasPattern} value
- * @return {CanvasGradient|CanvasPattern|colorLib}
- */
 export function color(value) {
        return isPatternOrGradient(value) ? value : colorLib(value);
 }
 
-/**
- * @param {string|CanvasGradient|CanvasPattern} value
- * @return {string|CanvasGradient|CanvasPattern}
- */
 export function getHoverColor(value) {
        return isPatternOrGradient(value)
                ? value
index b296ac8c4cfd6f81ea6dcdcb8ac586f58d405e1e..3a4d24d179a57696f7a8379053f22555b85017ee 100644 (file)
@@ -121,7 +121,7 @@ class simpleArc {
 function computeCircularBoundary(source) {
        const {scale, fill} = source;
        const options = scale.options;
-       const length = scale._getLabels().length;
+       const length = scale.getLabels().length;
        const target = [];
        const start = options.reverse ? scale.max : scale.min;
        const end = options.reverse ? scale.min : scale.max;
@@ -433,7 +433,7 @@ export default {
        },
 
        beforeDatasetsDraw(chart) {
-               const metasets = chart._getSortedVisibleDatasetMetas();
+               const metasets = chart.getSortedVisibleDatasetMetas();
                const area = chart.chartArea;
                let i, meta;
 
index 1b8a27cd4da01da9a1bbf0c9b6595c514d047037..748f2ebcf9aaca5a77767dec4866717a0e9b75a8 100644 (file)
@@ -360,7 +360,7 @@ export class Legend extends Element {
                        return;
                }
 
-               me._drawTitle();
+               me.drawTitle();
                const rtlHelper = getRtlAdapter(opts.rtl, me.left, me._minSize.width);
                const ctx = me.ctx;
                const fontColor = valueOrDefault(labelOpts.fontColor, defaults.fontColor);
@@ -518,9 +518,9 @@ export class Legend extends Element {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _drawTitle() {
+       drawTitle() {
                const me = this;
                const opts = me.options;
                const titleOpts = opts.title;
index 75415ebb36d0dc4ae06de09d46d1647ea90158a7..8766cad414604ee6ee454b890e77acf388fa343d 100644 (file)
@@ -220,7 +220,7 @@ function splitNewlines(str) {
  */
 function createTooltipItem(chart, item) {
        const {datasetIndex, index} = item;
-       const {label, value} = chart.getDatasetMeta(datasetIndex).controller._getLabelAndValue(index);
+       const {label, value} = chart.getDatasetMeta(datasetIndex).controller.getLabelAndValue(index);
 
        return {
                label,
index 9a2e1fb592eb669dcc086674cfb5673cddec2e22..f95ca33e84073456745a839b4724f624341e7f48 100644 (file)
@@ -17,11 +17,8 @@ export default class CategoryScale extends Scale {
                this._valueRange = 0;
        }
 
-       /**
-        * @private
-        */
-       _parse(raw, index) {
-               const labels = this._getLabels();
+       parse(raw, index) {
+               const labels = this.getLabels();
                if (labels[index] === raw) {
                        return index;
                }
@@ -32,7 +29,7 @@ export default class CategoryScale extends Scale {
 
        determineDataLimits() {
                const me = this;
-               const max = me._getLabels().length - 1;
+               const max = me.getLabels().length - 1;
 
                me.min = Math.max(me._userMin || 0, 0);
                me.max = Math.min(me._userMax || max, max);
@@ -43,7 +40,7 @@ export default class CategoryScale extends Scale {
                const min = me.min;
                const max = me.max;
                const offset = me.options.offset;
-               let labels = me._getLabels();
+               let labels = me.getLabels();
 
                // If we are viewing some subset of labels, slice the original array
                labels = (min === 0 && max === labels.length - 1) ? labels : labels.slice(min, max + 1);
@@ -57,7 +54,7 @@ export default class CategoryScale extends Scale {
 
        getLabelForValue(value) {
                const me = this;
-               const labels = me._getLabels();
+               const labels = me.getLabels();
 
                if (value >= 0 && value < labels.length) {
                        return labels[value];
@@ -66,12 +63,12 @@ export default class CategoryScale extends Scale {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _configure() {
+       configure() {
                const me = this;
 
-               Scale.prototype._configure.call(me);
+               super.configure();
 
                if (!me.isHorizontal()) {
                        // For backward compatibility, vertical category scale reverse is inverted.
@@ -84,7 +81,7 @@ export default class CategoryScale extends Scale {
                const me = this;
 
                if (typeof value !== 'number') {
-                       value = me._parse(value);
+                       value = me.parse(value);
                }
 
                return me.getPixelForDecimal((value - me._startValue) / me._valueRange);
index abf878dd26dcccdfcb5af370bb9be3a8bcf21c15..c84e89df982dfb8782ceb8ca1b9fb413011b4ea0 100644 (file)
@@ -17,7 +17,7 @@ export default class LinearScale extends LinearScaleBase {
        determineDataLimits() {
                const me = this;
                const options = me.options;
-               const minmax = me._getMinMax(true);
+               const minmax = me.getMinMax(true);
                const min = minmax.min;
                const max = minmax.max;
 
@@ -35,9 +35,9 @@ export default class LinearScale extends LinearScaleBase {
 
        /**
         * Returns the maximum number of ticks based on the scale dimension
-        * @private
+        * @protected
         */
-       _computeTickLimit() {
+       computeTickLimit() {
                const me = this;
 
                if (me.isHorizontal()) {
@@ -49,9 +49,9 @@ export default class LinearScale extends LinearScaleBase {
 
        /**
         * Called after the ticks are built
-        * @private
+        * @protected
         */
-       _handleDirectionalChanges(ticks) {
+       handleDirectionalChanges(ticks) {
                // If we are in a vertical orientation the top value is the highest so reverse the array
                return this.isHorizontal() ? ticks : ticks.reverse();
        }
index 69a2ae1a0717589ccc713b4bd74eb9011248715b..9e65b47917ccc0c2790f08250623036fd6b8b495 100644 (file)
@@ -122,10 +122,7 @@ export default class LinearScaleBase extends Scale {
                this._valueRange = 0;
        }
 
-       /**
-        * @private
-        */
-       _parse(raw, index) { // eslint-disable-line no-unused-vars
+       parse(raw, index) { // eslint-disable-line no-unused-vars
                if (isNullOrUndef(raw)) {
                        return NaN;
                }
@@ -212,7 +209,7 @@ export default class LinearScaleBase extends Scale {
                if (stepSize) {
                        maxTicks = Math.ceil(me.max / stepSize) - Math.floor(me.min / stepSize) + 1;
                } else {
-                       maxTicks = me._computeTickLimit();
+                       maxTicks = me.computeTickLimit();
                        maxTicksLimit = maxTicksLimit || 11;
                }
 
@@ -224,16 +221,16 @@ export default class LinearScaleBase extends Scale {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _computeTickLimit() {
+       computeTickLimit() {
                return Number.POSITIVE_INFINITY;
        }
 
        /**
-        * @private
+        * @protected
         */
-       _handleDirectionalChanges(ticks) {
+       handleDirectionalChanges(ticks) {
                return ticks;
        }
 
@@ -258,7 +255,7 @@ export default class LinearScaleBase extends Scale {
                };
                let ticks = generateTicks(numericGeneratorOptions, me);
 
-               ticks = me._handleDirectionalChanges(ticks);
+               ticks = me.handleDirectionalChanges(ticks);
 
                // At this point, we need to update our max and min given the tick values since we have expanded the
                // range of the scale
@@ -278,15 +275,15 @@ export default class LinearScaleBase extends Scale {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _configure() {
+       configure() {
                const me = this;
                const ticks = me.ticks;
                let start = me.min;
                let end = me.max;
 
-               Scale.prototype._configure.call(me);
+               super.configure();
 
                if (me.options.offset && ticks.length) {
                        const offset = (end - start) / Math.max(ticks.length - 1, 1) / 2;
index 261174d44898e458f6a4c08ca9fb16125b2a2729..3bd38192c4669bec73f95ac6668aeb6920bbcd82 100644 (file)
@@ -74,11 +74,8 @@ export default class LogarithmicScale extends Scale {
                this._valueRange = 0;
        }
 
-       /**
-        * @private
-        */
-       _parse(raw, index) {
-               const value = LinearScaleBase.prototype._parse.apply(this, [raw, index]);
+       parse(raw, index) {
+               const value = LinearScaleBase.prototype.parse.apply(this, [raw, index]);
                if (value === 0) {
                        return undefined;
                }
@@ -87,7 +84,7 @@ export default class LogarithmicScale extends Scale {
 
        determineDataLimits() {
                const me = this;
-               const minmax = me._getMinMax(true);
+               const minmax = me.getMinMax(true);
                const min = minmax.min;
                const max = minmax.max;
 
@@ -169,13 +166,13 @@ export default class LogarithmicScale extends Scale {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _configure() {
+       configure() {
                const me = this;
                const start = me.min;
 
-               Scale.prototype._configure.call(me);
+               super.configure();
 
                me._startValue = log10(start);
                me._valueRange = log10(me.max) - log10(start);
index 0b82e5d93b1fa84986b13680fa024a7375d3f54f..bbba10087faf1739eff7917053c00fd128d2ef2a 100644 (file)
@@ -322,7 +322,7 @@ export default class RadialLinearScale extends LinearScaleBase {
 
        determineDataLimits() {
                const me = this;
-               const minmax = me._getMinMax(false);
+               const minmax = me.getMinMax(false);
                const min = minmax.min;
                const max = minmax.max;
 
@@ -335,9 +335,9 @@ export default class RadialLinearScale extends LinearScaleBase {
 
        /**
         * Returns the maximum number of ticks based on the scale dimension
-        * @private
+        * @protected
         */
-       _computeTickLimit() {
+       computeTickLimit() {
                return Math.ceil(this.drawingArea / getTickBackdropHeight(this.options));
        }
 
@@ -440,9 +440,9 @@ export default class RadialLinearScale extends LinearScaleBase {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _drawGrid() {
+       drawGrid() {
                const me = this;
                const ctx = me.ctx;
                const opts = me.options;
@@ -488,9 +488,9 @@ export default class RadialLinearScale extends LinearScaleBase {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _drawLabels() {
+       drawLabels() {
                const me = this;
                const ctx = me.ctx;
                const opts = me.options;
@@ -539,7 +539,7 @@ export default class RadialLinearScale extends LinearScaleBase {
        }
 
        /**
-        * @private
+        * @protected
         */
-       _drawTitle() {}
+       drawTitle() {}
 }
index 9b25dc5b2301d382a7c7b813f6612d78ebf721e5..42d7a1cb8bde337a744147dfa09eaae49317f3b3 100644 (file)
@@ -107,14 +107,14 @@ function getDataTimestamps(scale) {
                return timestamps;
        }
 
-       const metas = scale._getMatchingVisibleMetas();
+       const metas = scale.getMatchingVisibleMetas();
 
        if (isSeries && metas.length) {
-               return metas[0].controller._getAllParsedValues(scale);
+               return metas[0].controller.getAllParsedValues(scale);
        }
 
        for (i = 0, ilen = metas.length; i < ilen; ++i) {
-               timestamps = timestamps.concat(metas[i].controller._getAllParsedValues(scale));
+               timestamps = timestamps.concat(metas[i].controller.getAllParsedValues(scale));
        }
 
        // We can not assume data is in order or unique - not even for single dataset
@@ -134,7 +134,7 @@ function getLabelTimestamps(scale) {
                return timestamps;
        }
 
-       const labels = scale._getLabels();
+       const labels = scale.getLabels();
        for (i = 0, ilen = labels.length; i < ilen; ++i) {
                timestamps.push(parse(scale, labels[i]));
        }
@@ -329,6 +329,7 @@ function generate(scale) {
        const max = scale.max;
        const options = scale.options;
        const timeOpts = options.time;
+       // @ts-ignore
        const minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, scale._getLabelCapacity(min));
        const stepSize = valueOrDefault(timeOpts.stepSize, 1);
        const weekday = minor === 'week' ? timeOpts.isoWeekday : false;
@@ -606,9 +607,8 @@ export default class TimeScale extends Scale {
         * @param {*} raw
         * @param {number} index
         * @return {number}
-        * @private
         */
-       _parse(raw, index) { // eslint-disable-line no-unused-vars
+       parse(raw, index) { // eslint-disable-line no-unused-vars
                if (raw === undefined) {
                        return NaN;
                }
@@ -620,22 +620,18 @@ export default class TimeScale extends Scale {
         * @param {string} axis
         * @param {number} index
         * @return {number|null}
-        * @private
         */
-       _parseObject(obj, axis, index) {
+       parseObject(obj, axis, index) {
                if (obj && obj.t) {
-                       return this._parse(obj.t, index);
+                       return this.parse(obj.t, index);
                }
                if (obj[axis] !== undefined) {
-                       return this._parse(obj[axis], index);
+                       return this.parse(obj[axis], index);
                }
                return null;
        }
 
-       /**
-        * @private
-        */
-       _invalidateCaches() {
+       invalidateCaches() {
                this._cache = {
                        data: [],
                        labels: [],
@@ -649,7 +645,7 @@ export default class TimeScale extends Scale {
                const adapter = me._adapter;
                const unit = options.time.unit || 'day';
                // eslint-disable-next-line prefer-const
-               let {min, max, minDefined, maxDefined} = me._getUserBounds();
+               let {min, max, minDefined, maxDefined} = me.getUserBounds();
 
                /**
                 * @param {object} bounds
@@ -671,7 +667,7 @@ export default class TimeScale extends Scale {
                        // If `bounds` is `'ticks'` and `ticks.source` is `'labels'`,
                        // data bounds are ignored (and don't need to be determined)
                        if (options.bounds !== 'ticks' || options.ticks.source !== 'labels') {
-                               _applyBounds(me._getMinMax(false));
+                               _applyBounds(me.getMinMax(false));
                        }
                }
 
index abb977f7a157f2d55c2e96592ea103dc502acd6a..2f034243de0b2553b4cc0782959d08d8114ca02a 100644 (file)
@@ -396,6 +396,6 @@ describe('Chart.controllers.radar', function() {
                });
 
                var controller = chart.getDatasetMeta(0).controller;
-               expect(controller._getValueScaleId()).toBe('test');
+               expect(controller.getValueScaleId()).toBe('test');
        });
 });
index 70e1d00dbc4df01ad9e50e55237183e519e25cbe..d2bd407d5d3e181d197a0af475742766218f4236 100644 (file)
@@ -247,41 +247,41 @@ describe('Chart.DatasetController', function() {
                var controller = meta.controller;
                var first, last;
 
-               first = controller._getParsed(0);
-               last = controller._getParsed(5);
+               first = controller.getParsed(0);
+               last = controller.getParsed(5);
                data.push({x: 6, y: 6}, {x: 7, y: 7}, {x: 8, y: 8});
                data.push({x: 9, y: 9});
                expect(meta.data.length).toBe(10);
-               expect(controller._getParsed(0)).toBe(first);
-               expect(controller._getParsed(5)).toBe(last);
+               expect(controller.getParsed(0)).toBe(first);
+               expect(controller.getParsed(5)).toBe(last);
 
-               last = controller._getParsed(9);
+               last = controller.getParsed(9);
                data.pop();
                expect(meta.data.length).toBe(9);
-               expect(controller._getParsed(0)).toBe(first);
-               expect(controller._getParsed(9)).toBe(undefined);
-               expect(controller._getParsed(8)).toEqual({x: 8, y: 8});
+               expect(controller.getParsed(0)).toBe(first);
+               expect(controller.getParsed(9)).toBe(undefined);
+               expect(controller.getParsed(8)).toEqual({x: 8, y: 8});
 
-               last = controller._getParsed(8);
+               last = controller.getParsed(8);
                data.shift();
                data.shift();
                data.shift();
                expect(meta.data.length).toBe(6);
-               expect(controller._getParsed(5)).toBe(last);
+               expect(controller.getParsed(5)).toBe(last);
 
-               first = controller._getParsed(0);
-               last = controller._getParsed(5);
+               first = controller.getParsed(0);
+               last = controller.getParsed(5);
                data.splice(1, 4, {x: 10, y: 10}, {x: 11, y: 11});
                expect(meta.data.length).toBe(4);
-               expect(controller._getParsed(0)).toBe(first);
-               expect(controller._getParsed(3)).toBe(last);
-               expect(controller._getParsed(1)).toEqual({x: 10, y: 10});
+               expect(controller.getParsed(0)).toBe(first);
+               expect(controller.getParsed(3)).toBe(last);
+               expect(controller.getParsed(1)).toEqual({x: 10, y: 10});
 
                data.unshift({x: 12, y: 12}, {x: 13, y: 13}, {x: 14, y: 14}, {x: 15, y: 15});
                data.unshift({x: 16, y: 16}, {x: 17, y: 17});
                expect(meta.data.length).toBe(10);
-               expect(controller._getParsed(6)).toBe(first);
-               expect(controller._getParsed(9)).toBe(last);
+               expect(controller.getParsed(6)).toBe(first);
+               expect(controller.getParsed(9)).toBe(last);
        });
 
        it('should re-synchronize metadata when the data object reference changes', function() {
index 92e4202a724561f4c7fcb30901c27007745196f2..7610ec14a5187bab29460867ffeb38d82cfa6d68 100644 (file)
@@ -657,8 +657,8 @@ describe('Time scale tests', function() {
 
                var xScale = chart.scales.x;
                var controller = chart.getDatasetMeta(0).controller;
-               expect(xScale.getLabelForValue(controller._getParsed(0)[xScale.id])).toBeTruthy();
-               expect(xScale.getLabelForValue(controller._getParsed(0)[xScale.id])).toBe('Jan 1, 2015, 8:00:00 pm');
+               expect(xScale.getLabelForValue(controller.getParsed(0)[xScale.id])).toBeTruthy();
+               expect(xScale.getLabelForValue(controller.getParsed(0)[xScale.id])).toBe('Jan 1, 2015, 8:00:00 pm');
                expect(xScale.getLabelForValue(xScale.getValueForPixel(xScale.getPixelForTick(6)))).toBe('Jan 10, 2015, 12:00:00 pm');
        });
 
@@ -737,7 +737,7 @@ describe('Time scale tests', function() {
 
                var xScale = chart.scales.x;
                var controller = chart.getDatasetMeta(0).controller;
-               var value = controller._getParsed(0)[xScale.id];
+               var value = controller.getParsed(0)[xScale.id];
                expect(xScale.getLabelForValue(value)).toBeTruthy();
                expect(xScale.getLabelForValue(value)).toBe('Jan 1, 2015, 8:00:00 pm');
        });
@@ -766,7 +766,7 @@ describe('Time scale tests', function() {
 
                var xScale = chart.scales.x;
                var controller = chart.getDatasetMeta(0).controller;
-               var label = xScale.getLabelForValue(controller._getParsed(0)[xScale.id]);
+               var label = xScale.getLabelForValue(controller.getParsed(0)[xScale.id]);
                expect(label).toEqual('Jan 8, 2018, 5:14:23 am');
        });