chartkick 5.1.3 → 5.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60765472a4a878439878da816efbb07ef13ef5e8d13fa05d1b5d17cc35a86fc1
4
- data.tar.gz: 895e11561ff7bc42c3171d43f7c70ac680b68e213133210ddbadd35ddb6e847d
3
+ metadata.gz: 98a76e20f3a13e13184687cb845f461cfd5ef0e3bd75273922a5da56b97597ab
4
+ data.tar.gz: 6017e645dff4678208f3c57fc682d8343f19063a494a39f9f45788092e123492
5
5
  SHA512:
6
- metadata.gz: 3b887e7da63f59a7faa7c7746e685dddc936a349042b90873d53cb08db64b284b809e3a1c89943f5ec0068dbf0fc188ca96555a651b1863198673760f3b5808f
7
- data.tar.gz: aba0da7151b351d6f4bf3ed6b7382d0bb0a2998f06230946a44c2f34d918028eecec0aadff454794565f6f125c113acf56022b081c61cbda4d18fe9528fee1bb
6
+ metadata.gz: 1d8567e2dc6bb53efac3426b4fb8c6bef2b870db845e12fadb28aa0a069b64c8c9edae98e06003d00806959fee51f0de600d358b8620a7e9453654f7def44291
7
+ data.tar.gz: 5150b0d42f154e2ff17722e6af8a3b2798ab4c764ce937a14a83a2f13d44a0fc6f812a45caac77a9e753bd28162046b387d9dee317d2ad27383f1d2deb284394
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 5.1.4 (2025-02-19)
2
+
3
+ - Updated Chart.js to 4.4.8
4
+
1
5
  ## 5.1.3 (2025-02-01)
2
6
 
3
7
  - Updated Chart.js to 4.4.7
@@ -1,3 +1,3 @@
1
1
  module Chartkick
2
- VERSION = "5.1.3"
2
+ VERSION = "5.1.4"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * Chart.js v4.4.7
2
+ * Chart.js v4.4.8
3
3
  * https://www.chartjs.org
4
- * (c) 2024 Chart.js Contributors
4
+ * (c) 2025 Chart.js Contributors
5
5
  * Released under the MIT License
6
6
  *
7
7
  * @kurkle/color v0.3.2
@@ -1300,8 +1300,14 @@
1300
1300
  }).pop();
1301
1301
  return result;
1302
1302
  }
1303
+ /**
1304
+ * Verifies that attempting to coerce n to string or number won't throw a TypeError.
1305
+ */
1306
+ function isNonPrimitive(n) {
1307
+ return _typeof$1(n) === 'symbol' || _typeof$1(n) === 'object' && n !== null && !(Symbol.toPrimitive in n || 'toString' in n || 'valueOf' in n);
1308
+ }
1303
1309
  function isNumber(n) {
1304
- return !isNaN(parseFloat(n)) && isFinite(n);
1310
+ return !isNonPrimitive(n) && !isNaN(parseFloat(n)) && isFinite(n);
1305
1311
  }
1306
1312
  function almostWhole(x, epsilon) {
1307
1313
  var rounded = Math.round(x);
@@ -1631,7 +1637,9 @@
1631
1637
  var count = pointCount;
1632
1638
  if (meta._sorted) {
1633
1639
  var iScale = meta.iScale,
1640
+ vScale = meta.vScale,
1634
1641
  _parsed = meta._parsed;
1642
+ var spanGaps = meta.dataset ? meta.dataset.options ? meta.dataset.options.spanGaps : null : null;
1635
1643
  var axis = iScale.axis;
1636
1644
  var _iScale$getUserBounds = iScale.getUserBounds(),
1637
1645
  min = _iScale$getUserBounds.min,
@@ -1639,18 +1647,32 @@
1639
1647
  minDefined = _iScale$getUserBounds.minDefined,
1640
1648
  maxDefined = _iScale$getUserBounds.maxDefined;
1641
1649
  if (minDefined) {
1642
- start = _limitValue(Math.min(
1650
+ start = Math.min(
1643
1651
  // @ts-expect-error Need to type _parsed
1644
1652
  _lookupByKey(_parsed, axis, min).lo,
1645
1653
  // @ts-expect-error Need to fix types on _lookupByKey
1646
- animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo), 0, pointCount - 1);
1654
+ animationsDisabled ? pointCount : _lookupByKey(points, axis, iScale.getPixelForValue(min)).lo);
1655
+ if (spanGaps) {
1656
+ var distanceToDefinedLo = _parsed.slice(0, start + 1).reverse().findIndex(function (point) {
1657
+ return !isNullOrUndef(point[vScale.axis]);
1658
+ });
1659
+ start -= Math.max(0, distanceToDefinedLo);
1660
+ }
1661
+ start = _limitValue(start, 0, pointCount - 1);
1647
1662
  }
1648
1663
  if (maxDefined) {
1649
- count = _limitValue(Math.max(
1664
+ var end = Math.max(
1650
1665
  // @ts-expect-error Need to type _parsed
1651
1666
  _lookupByKey(_parsed, iScale.axis, max, true).hi + 1,
1652
1667
  // @ts-expect-error Need to fix types on _lookupByKey
1653
- animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1), start, pointCount) - start;
1668
+ animationsDisabled ? 0 : _lookupByKey(points, axis, iScale.getPixelForValue(max), true).hi + 1);
1669
+ if (spanGaps) {
1670
+ var distanceToDefinedHi = _parsed.slice(end - 1).findIndex(function (point) {
1671
+ return !isNullOrUndef(point[vScale.axis]);
1672
+ });
1673
+ end += Math.max(0, distanceToDefinedHi);
1674
+ }
1675
+ count = _limitValue(end, start, pointCount) - start;
1654
1676
  } else {
1655
1677
  count = pointCount - start;
1656
1678
  }
@@ -3360,14 +3382,8 @@
3360
3382
  }
3361
3383
 
3362
3384
  /**
3363
- * Note: typedefs are auto-exported, so use a made-up `dom` namespace where
3364
- * necessary to avoid duplicates with `export * from './helpers`; see
3365
- * https://github.com/microsoft/TypeScript/issues/46011
3366
- * @typedef { import('../core/core.controller.js').default } dom.Chart
3367
- * @typedef { import('../../types').ChartEvent } ChartEvent
3368
- */ /**
3369
- * @private
3370
- */
3385
+ * @private
3386
+ */
3371
3387
  function _isDomSupported() {
3372
3388
  return typeof window !== 'undefined' && typeof document !== 'undefined';
3373
3389
  }
@@ -7081,10 +7097,24 @@
7081
7097
  data = metaset.data,
7082
7098
  _sorted = metaset._sorted;
7083
7099
  var iScale = controller._cachedMeta.iScale;
7100
+ var spanGaps = metaset.dataset ? metaset.dataset.options ? metaset.dataset.options.spanGaps : null : null;
7084
7101
  if (iScale && axis === iScale.axis && axis !== 'r' && _sorted && data.length) {
7085
7102
  var lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;
7086
7103
  if (!intersect) {
7087
- return lookupMethod(data, axis, value);
7104
+ var result = lookupMethod(data, axis, value);
7105
+ if (spanGaps) {
7106
+ var vScale = controller._cachedMeta.vScale;
7107
+ var _parsed = metaset._parsed;
7108
+ var distanceToDefinedLo = _parsed.slice(0, result.lo + 1).reverse().findIndex(function (point) {
7109
+ return !isNullOrUndef(point[vScale.axis]);
7110
+ });
7111
+ result.lo -= Math.max(0, distanceToDefinedLo);
7112
+ var distanceToDefinedHi = _parsed.slice(result.hi).findIndex(function (point) {
7113
+ return !isNullOrUndef(point[vScale.axis]);
7114
+ });
7115
+ result.hi += Math.max(0, distanceToDefinedHi);
7116
+ }
7117
+ return result;
7088
7118
  } else if (controller._sharedOptions) {
7089
7119
  var el = data[0];
7090
7120
  var range = typeof el.getRange === 'function' && el.getRange(axis);
@@ -10402,7 +10432,7 @@
10402
10432
  }
10403
10433
  return false;
10404
10434
  }
10405
- var version = "4.4.7";
10435
+ var version = "4.4.8";
10406
10436
  var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
10407
10437
  function positionIsHorizontal(position, axis) {
10408
10438
  return position === 'top' || position === 'bottom' || KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x';
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chartkick
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.3
4
+ version: 5.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-01 00:00:00.000000000 Z
10
+ date: 2025-02-19 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  email: andrew@ankane.org
13
13
  executables: []