]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Make elements optional (#6829)
authorBen McCann <322311+benmccann@users.noreply.github.com>
Sat, 14 Dec 2019 04:52:18 +0000 (20:52 -0800)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 14 Dec 2019 04:52:18 +0000 (23:52 -0500)
src/core/core.datasetController.js

index 82afe43166343d4ad1e1a85793299389e5bb4b97..1a82ff48461b2f70e133c74f9b94f394f28fa5f6 100644 (file)
@@ -624,7 +624,7 @@ helpers.extend(DatasetController.prototype, {
                const chart = this.chart;
                const meta = this._cachedMeta;
                const metaData = meta.data;
-               const ilen = metaData.length;
+               const ilen = meta._parsed.length;
                const stacked = canStack && meta._stacked;
                const indices = getSortedDatasetIndices(chart, true);
                const otherScale = this._getOtherScale(scale);
@@ -639,7 +639,7 @@ helpers.extend(DatasetController.prototype, {
                        parsed = meta._parsed[i];
                        value = parsed[scale.id];
                        otherValue = parsed[otherScale.id];
-                       if (item.hidden || isNaN(value) ||
+                       if ((item && item.hidden) || isNaN(value) ||
                                otherMin > otherValue || otherMax < otherValue) {
                                continue;
                        }