From 190a34b9c3a751a232908c2751fc35b65a911187 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 28 Feb 2024 12:45:35 -0800 Subject: [PATCH] Updated Chart.js to 4.4.2 --- CHANGELOG.md | 4 ++++ build/package.json | 2 +- build/rollup.config.js | 6 ++--- vendor/assets/javascripts/Chart.bundle.js | 27 ++++++++++++++--------- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc6b11c..97df068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.0.6 (unreleased) + +- Updated Chart.js to 4.4.2 + ## 5.0.5 (2023-12-07) - Updated Chart.js to 4.4.1 diff --git a/build/package.json b/build/package.json index bca8acf..e706ee8 100644 --- a/build/package.json +++ b/build/package.json @@ -14,7 +14,7 @@ "rollup": "^3.9.1" }, "dependencies": { - "chart.js": "4.4.1", + "chart.js": "4.4.2", "@kurkle/color": "0.3.2", "chartjs-adapter-date-fns": "3.0.0", "date-fns": "2.30.0" diff --git a/build/rollup.config.js b/build/rollup.config.js index 151f3dc..27f5657 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -2,14 +2,14 @@ import babel from "@rollup/plugin-babel"; import resolve from "@rollup/plugin-node-resolve"; // use same banner as projects -// https://unpkg.com/chart.js@4.4.1 +// https://unpkg.com/chart.js@4.4.2 // https://unpkg.com/@kurkle/color@0.3.2 // https://unpkg.com/chartjs-adapter-date-fns@3.0.0 // https://unpkg.com/date-fns@2.30.0 (no banner) const banner = `/*! - * Chart.js v4.4.1 + * Chart.js v4.4.2 * https://www.chartjs.org - * (c) 2023 Chart.js Contributors + * (c) 2024 Chart.js Contributors * Released under the MIT License * * @kurkle/color v0.3.2 diff --git a/vendor/assets/javascripts/Chart.bundle.js b/vendor/assets/javascripts/Chart.bundle.js index fadf856..23b85f1 100644 --- a/vendor/assets/javascripts/Chart.bundle.js +++ b/vendor/assets/javascripts/Chart.bundle.js @@ -1,7 +1,7 @@ /*! - * Chart.js v4.4.1 + * Chart.js v4.4.2 * https://www.chartjs.org - * (c) 2023 Chart.js Contributors + * (c) 2024 Chart.js Contributors * Released under the MIT License * * @kurkle/color v0.3.2 @@ -7825,10 +7825,14 @@ passive: true } : false; function addListener(node, type, listener) { - node.addEventListener(type, listener, eventListenerOptions); + if (node) { + node.addEventListener(type, listener, eventListenerOptions); + } } function removeListener(chart, type, listener) { - chart.canvas.removeEventListener(type, listener, eventListenerOptions); + if (chart && chart.canvas) { + chart.canvas.removeEventListener(type, listener, eventListenerOptions); + } } function fromNativeEvent(event, chart) { var type = EVENT_TYPES[event.type] || event.type; @@ -10465,7 +10469,7 @@ } return false; } - var version = "4.4.1"; + var version = "4.4.2"; var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea']; function positionIsHorizontal(position, axis) { return position === 'top' || position === 'bottom' || KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x'; @@ -14357,20 +14361,23 @@ return false; } var i, len; - var x = 0; + var xSet = new Set(); var y = 0; var count = 0; for (i = 0, len = items.length; i < len; ++i) { var el = items[i].element; if (el && el.hasValue()) { var pos = el.tooltipPosition(); - x += pos.x; + xSet.add(pos.x); y += pos.y; ++count; } } + var xAverage = _toConsumableArray(xSet).reduce(function (a, b) { + return a + b; + }) / xSet.size; return { - x: x / count, + x: xAverage, y: y / count }; }, @@ -16564,7 +16571,7 @@ } if (grid.display) { this.ticks.forEach(function (tick, index) { - if (index !== 0) { + if (index !== 0 || index === 0 && _this41.min < 0) { offset = _this41.getDistanceFromCenterForValue(tick.value); var context = _this41.getContext(index); var optsAtIndex = grid.setContext(context); @@ -16617,7 +16624,7 @@ ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; this.ticks.forEach(function (tick, index) { - if (index === 0 && !opts.reverse) { + if (index === 0 && _this42.min >= 0 && !opts.reverse) { return; } var optsAtIndex = tickOpts.setContext(_this42.getContext(index));