Skip to content

Commit

Permalink
Updated Chart.js to 4.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Feb 19, 2025
1 parent 97014e1 commit 4025698
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 5.1.4 (unreleased)

- Updated Chart.js to 4.4.8

## 5.1.3 (2025-02-01)

- Updated Chart.js to 4.4.7
Expand Down
2 changes: 1 addition & 1 deletion build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"rollup": "^3.9.1"
},
"dependencies": {
"chart.js": "4.4.7",
"chart.js": "4.4.8",
"@kurkle/color": "0.3.2",
"chartjs-adapter-date-fns": "3.0.0",
"date-fns": "2.30.0"
Expand Down
6 changes: 3 additions & 3 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.7
// https://unpkg.com/chart.js@4.4.8
// 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.7
* Chart.js v4.4.8
* https://www.chartjs.org
* (c) 2024 Chart.js Contributors
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*
* @kurkle/color v0.3.2
Expand Down
64 changes: 47 additions & 17 deletions vendor/assets/javascripts/Chart.bundle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* Chart.js v4.4.7
* Chart.js v4.4.8
* https://www.chartjs.org
* (c) 2024 Chart.js Contributors
* (c) 2025 Chart.js Contributors
* Released under the MIT License
*
* @kurkle/color v0.3.2
Expand Down Expand Up @@ -1300,8 +1300,14 @@
}).pop();
return result;
}
/**
* Verifies that attempting to coerce n to string or number won't throw a TypeError.
*/
function isNonPrimitive(n) {
return _typeof$1(n) === 'symbol' || _typeof$1(n) === 'object' && n !== null && !(Symbol.toPrimitive in n || 'toString' in n || 'valueOf' in n);
}
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
return !isNonPrimitive(n) && !isNaN(parseFloat(n)) && isFinite(n);
}
function almostWhole(x, epsilon) {
var rounded = Math.round(x);
Expand Down Expand Up @@ -1631,26 +1637,42 @@
var count = pointCount;
if (meta._sorted) {
var iScale = meta.iScale,
vScale = meta.vScale,
_parsed = meta._parsed;
var spanGaps = meta.dataset ? meta.dataset.options ? meta.dataset.options.spanGaps : null : null;
var axis = iScale.axis;
var _iScale$getUserBounds = iScale.getUserBounds(),
min = _iScale$getUserBounds.min,
max = _iScale$getUserBounds.max,
minDefined = _iScale$getUserBounds.minDefined,
maxDefined = _iScale$getUserBounds.maxDefined;
if (minDefined) {
start = _limitValue(Math.min(
start = Math.min(
// @ts-expect-error Need to type _parsed
_lookupByKey(_parsed, axis, min).lo,
// @ts-expect-error Need to fix types on _lookupByKey
animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo), 0, pointCount - 1);
animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo);
if (spanGaps) {
var distanceToDefinedLo = _parsed.slice(0, start + 1).reverse().findIndex(function (point) {
return !isNullOrUndef(point[vScale.axis]);
});
start -= Math.max(0, distanceToDefinedLo);
}
start = _limitValue(start, 0, pointCount - 1);
}
if (maxDefined) {
count = _limitValue(Math.max(
var end = Math.max(
// @ts-expect-error Need to type _parsed
_lookupByKey(_parsed, iScale.axis, max, true).hi + 1,
// @ts-expect-error Need to fix types on _lookupByKey
animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1), start, pointCount) - start;
animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1);
if (spanGaps) {
var distanceToDefinedHi = _parsed.slice(end - 1).findIndex(function (point) {
return !isNullOrUndef(point[vScale.axis]);
});
end += Math.max(0, distanceToDefinedHi);
}
count = _limitValue(end, start, pointCount) - start;
} else {
count = pointCount - start;
}
Expand Down Expand Up @@ -3360,14 +3382,8 @@
}

/**
* Note: typedefs are auto-exported, so use a made-up `dom` namespace where
* necessary to avoid duplicates with `export * from './helpers`; see
* https://github.com/microsoft/TypeScript/issues/46011
* @typedef { import('../core/core.controller.js').default } dom.Chart
* @typedef { import('../../types').ChartEvent } ChartEvent
*/ /**
* @private
*/
* @private
*/
function _isDomSupported() {
return typeof window !== 'undefined' && typeof document !== 'undefined';
}
Expand Down Expand Up @@ -7081,10 +7097,24 @@
data = metaset.data,
_sorted = metaset._sorted;
var iScale = controller._cachedMeta.iScale;
var spanGaps = metaset.dataset ? metaset.dataset.options ? metaset.dataset.options.spanGaps : null : null;
if (iScale && axis === iScale.axis && axis !== 'r' && _sorted && data.length) {
var lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;
if (!intersect) {
return lookupMethod(data, axis, value);
var result = lookupMethod(data, axis, value);
if (spanGaps) {
var vScale = controller._cachedMeta.vScale;
var _parsed = metaset._parsed;
var distanceToDefinedLo = _parsed.slice(0, result.lo + 1).reverse().findIndex(function (point) {
return !isNullOrUndef(point[vScale.axis]);
});
result.lo -= Math.max(0, distanceToDefinedLo);
var distanceToDefinedHi = _parsed.slice(result.hi).findIndex(function (point) {
return !isNullOrUndef(point[vScale.axis]);
});
result.hi += Math.max(0, distanceToDefinedHi);
}
return result;
} else if (controller._sharedOptions) {
var el = data[0];
var range = typeof el.getRange === 'function' && el.getRange(axis);
Expand Down Expand Up @@ -10402,7 +10432,7 @@
}
return false;
}
var version = "4.4.7";
var version = "4.4.8";
var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
function positionIsHorizontal(position, axis) {
return position === 'top' || position === 'bottom' || KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x';
Expand Down

0 comments on commit 4025698

Please sign in to comment.