chartkick 5.1.2 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/LICENSE.txt +1 -1
- data/README.md +19 -48
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +829 -536
- metadata +4 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Chart.js v4.
|
|
2
|
+
* Chart.js v4.6.1
|
|
3
3
|
* https://www.chartjs.org
|
|
4
|
-
* (c)
|
|
4
|
+
* (c) 2026 Chart.js Contributors
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*
|
|
7
7
|
* @kurkle/color v0.3.2
|
|
@@ -222,24 +222,24 @@
|
|
|
222
222
|
for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf$1(t)););
|
|
223
223
|
return t;
|
|
224
224
|
}
|
|
225
|
-
function _superPropGet(t,
|
|
226
|
-
var p = _get(_getPrototypeOf$1(1 & r ? t.prototype : t),
|
|
225
|
+
function _superPropGet(t, o, e, r) {
|
|
226
|
+
var p = _get(_getPrototypeOf$1(1 & r ? t.prototype : t), o, e);
|
|
227
227
|
return 2 & r && "function" == typeof p ? function (t) {
|
|
228
|
-
return p.apply(
|
|
228
|
+
return p.apply(e, t);
|
|
229
229
|
} : p;
|
|
230
230
|
}
|
|
231
231
|
function _toConsumableArray(r) {
|
|
232
232
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray$1(r) || _nonIterableSpread();
|
|
233
233
|
}
|
|
234
|
-
function _toPrimitive(t,
|
|
234
|
+
function _toPrimitive(t, e) {
|
|
235
235
|
if ("object" != typeof t || !t) return t;
|
|
236
|
-
var
|
|
237
|
-
if (void 0 !==
|
|
238
|
-
var i =
|
|
236
|
+
var r;
|
|
237
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
238
|
+
var i = r.call(t, e || "default");
|
|
239
239
|
if ("object" != typeof i) return i;
|
|
240
240
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
241
241
|
}
|
|
242
|
-
return ("string" ===
|
|
242
|
+
return ("string" === e ? String : Number)(t);
|
|
243
243
|
}
|
|
244
244
|
function _toPropertyKey(t) {
|
|
245
245
|
var i = _toPrimitive(t, "string");
|
|
@@ -944,7 +944,7 @@
|
|
|
944
944
|
* @since 2.7.0
|
|
945
945
|
*/
|
|
946
946
|
function isNullOrUndef(value) {
|
|
947
|
-
return value === null ||
|
|
947
|
+
return value === null || value === undefined;
|
|
948
948
|
}
|
|
949
949
|
/**
|
|
950
950
|
* Returns true if `value` is an array (including typed arrays), else returns false.
|
|
@@ -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 =
|
|
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)
|
|
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
|
-
|
|
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)
|
|
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
|
}
|
|
@@ -3147,19 +3169,19 @@
|
|
|
3147
3169
|
try {
|
|
3148
3170
|
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
3149
3171
|
var scope = _step9.value;
|
|
3150
|
-
var
|
|
3172
|
+
var _iterator0 = _createForOfIteratorHelper$1(Object.keys(scope).filter(function (k) {
|
|
3151
3173
|
return !k.startsWith('_');
|
|
3152
3174
|
})),
|
|
3153
|
-
|
|
3175
|
+
_step0;
|
|
3154
3176
|
try {
|
|
3155
|
-
for (
|
|
3156
|
-
var key =
|
|
3177
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
3178
|
+
var key = _step0.value;
|
|
3157
3179
|
set.add(key);
|
|
3158
3180
|
}
|
|
3159
3181
|
} catch (err) {
|
|
3160
|
-
|
|
3182
|
+
_iterator0.e(err);
|
|
3161
3183
|
} finally {
|
|
3162
|
-
|
|
3184
|
+
_iterator0.f();
|
|
3163
3185
|
}
|
|
3164
3186
|
}
|
|
3165
3187
|
} catch (err) {
|
|
@@ -3360,14 +3382,8 @@
|
|
|
3360
3382
|
}
|
|
3361
3383
|
|
|
3362
3384
|
/**
|
|
3363
|
-
*
|
|
3364
|
-
|
|
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
|
}
|
|
@@ -3549,10 +3565,10 @@
|
|
|
3549
3565
|
*/
|
|
3550
3566
|
function retinaScale(chart, forceRatio, forceStyle) {
|
|
3551
3567
|
var pixelRatio = forceRatio || 1;
|
|
3552
|
-
var deviceHeight =
|
|
3553
|
-
var deviceWidth =
|
|
3554
|
-
chart.height =
|
|
3555
|
-
chart.width =
|
|
3568
|
+
var deviceHeight = round1(chart.height * pixelRatio);
|
|
3569
|
+
var deviceWidth = round1(chart.width * pixelRatio);
|
|
3570
|
+
chart.height = round1(chart.height);
|
|
3571
|
+
chart.width = round1(chart.width);
|
|
3556
3572
|
var canvas = chart.canvas;
|
|
3557
3573
|
// If no style has been set on the canvas, the render size is used as display size,
|
|
3558
3574
|
// making the chart visually bigger, so let's enforce it to the "correct" values.
|
|
@@ -3561,10 +3577,12 @@
|
|
|
3561
3577
|
canvas.style.height = "".concat(chart.height, "px");
|
|
3562
3578
|
canvas.style.width = "".concat(chart.width, "px");
|
|
3563
3579
|
}
|
|
3564
|
-
|
|
3580
|
+
var canvasHeight = Math.floor(deviceHeight);
|
|
3581
|
+
var canvasWidth = Math.floor(deviceWidth);
|
|
3582
|
+
if (chart.currentDevicePixelRatio !== pixelRatio || canvas.height !== canvasHeight || canvas.width !== canvasWidth) {
|
|
3565
3583
|
chart.currentDevicePixelRatio = pixelRatio;
|
|
3566
|
-
canvas.height =
|
|
3567
|
-
canvas.width =
|
|
3584
|
+
canvas.height = canvasHeight;
|
|
3585
|
+
canvas.width = canvasWidth;
|
|
3568
3586
|
chart.ctx.setTransform(pixelRatio, 0, 0, pixelRatio, 0, 0);
|
|
3569
3587
|
return true;
|
|
3570
3588
|
}
|
|
@@ -3969,11 +3987,11 @@
|
|
|
3969
3987
|
start = e % count;
|
|
3970
3988
|
}
|
|
3971
3989
|
}
|
|
3972
|
-
var
|
|
3973
|
-
|
|
3990
|
+
var _iterator1 = _createForOfIteratorHelper$1(segments),
|
|
3991
|
+
_step1;
|
|
3974
3992
|
try {
|
|
3975
|
-
for (
|
|
3976
|
-
var segment =
|
|
3993
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
3994
|
+
var segment = _step1.value;
|
|
3977
3995
|
start = spanGaps ? start : segment.start;
|
|
3978
3996
|
var prev = points[start % count];
|
|
3979
3997
|
var style = void 0;
|
|
@@ -3998,9 +4016,9 @@
|
|
|
3998
4016
|
}
|
|
3999
4017
|
}
|
|
4000
4018
|
} catch (err) {
|
|
4001
|
-
|
|
4019
|
+
_iterator1.e(err);
|
|
4002
4020
|
} finally {
|
|
4003
|
-
|
|
4021
|
+
_iterator1.f();
|
|
4004
4022
|
}
|
|
4005
4023
|
return result;
|
|
4006
4024
|
}
|
|
@@ -4031,6 +4049,35 @@
|
|
|
4031
4049
|
};
|
|
4032
4050
|
return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);
|
|
4033
4051
|
}
|
|
4052
|
+
function getSizeForArea(scale, chartArea, field) {
|
|
4053
|
+
return scale.options.clip ? scale[field] : chartArea[field];
|
|
4054
|
+
}
|
|
4055
|
+
function getDatasetArea(meta, chartArea) {
|
|
4056
|
+
var xScale = meta.xScale,
|
|
4057
|
+
yScale = meta.yScale;
|
|
4058
|
+
if (xScale && yScale) {
|
|
4059
|
+
return {
|
|
4060
|
+
left: getSizeForArea(xScale, chartArea, 'left'),
|
|
4061
|
+
right: getSizeForArea(xScale, chartArea, 'right'),
|
|
4062
|
+
top: getSizeForArea(yScale, chartArea, 'top'),
|
|
4063
|
+
bottom: getSizeForArea(yScale, chartArea, 'bottom')
|
|
4064
|
+
};
|
|
4065
|
+
}
|
|
4066
|
+
return chartArea;
|
|
4067
|
+
}
|
|
4068
|
+
function getDatasetClipArea(chart, meta) {
|
|
4069
|
+
var clip = meta._clip;
|
|
4070
|
+
if (clip.disabled) {
|
|
4071
|
+
return false;
|
|
4072
|
+
}
|
|
4073
|
+
var area = getDatasetArea(meta, chart.chartArea);
|
|
4074
|
+
return {
|
|
4075
|
+
left: clip.left === false ? 0 : area.left - (clip.left === true ? 0 : clip.left),
|
|
4076
|
+
right: clip.right === false ? chart.width : area.right + (clip.right === true ? 0 : clip.right),
|
|
4077
|
+
top: clip.top === false ? 0 : area.top - (clip.top === true ? 0 : clip.top),
|
|
4078
|
+
bottom: clip.bottom === false ? chart.height : area.bottom + (clip.bottom === true ? 0 : clip.bottom)
|
|
4079
|
+
};
|
|
4080
|
+
}
|
|
4034
4081
|
|
|
4035
4082
|
var Animator = /*#__PURE__*/function () {
|
|
4036
4083
|
function Animator() {
|
|
@@ -4637,7 +4684,7 @@
|
|
|
4637
4684
|
var parsed = _step2.value;
|
|
4638
4685
|
var stacks = parsed._stacks;
|
|
4639
4686
|
if (!stacks || stacks[axis] === undefined || stacks[axis][datasetIndex] === undefined) {
|
|
4640
|
-
|
|
4687
|
+
continue;
|
|
4641
4688
|
}
|
|
4642
4689
|
delete stacks[axis][datasetIndex];
|
|
4643
4690
|
if (stacks[axis]._visualValues !== undefined && stacks[axis]._visualValues[datasetIndex] !== undefined) {
|
|
@@ -5741,6 +5788,39 @@
|
|
|
5741
5788
|
value: function _getStackCount(index) {
|
|
5742
5789
|
return this._getStacks(undefined, index).length;
|
|
5743
5790
|
}
|
|
5791
|
+
}, {
|
|
5792
|
+
key: "_getAxisCount",
|
|
5793
|
+
value: function _getAxisCount() {
|
|
5794
|
+
return this._getAxis().length;
|
|
5795
|
+
}
|
|
5796
|
+
}, {
|
|
5797
|
+
key: "getFirstScaleIdForIndexAxis",
|
|
5798
|
+
value: function getFirstScaleIdForIndexAxis() {
|
|
5799
|
+
var scales = this.chart.scales;
|
|
5800
|
+
var indexScaleId = this.chart.options.indexAxis;
|
|
5801
|
+
return Object.keys(scales).filter(function (key) {
|
|
5802
|
+
return scales[key].axis === indexScaleId;
|
|
5803
|
+
}).shift();
|
|
5804
|
+
}
|
|
5805
|
+
}, {
|
|
5806
|
+
key: "_getAxis",
|
|
5807
|
+
value: function _getAxis() {
|
|
5808
|
+
var axis = {};
|
|
5809
|
+
var firstScaleAxisId = this.getFirstScaleIdForIndexAxis();
|
|
5810
|
+
var _iterator5 = _createForOfIteratorHelper$1(this.chart.data.datasets),
|
|
5811
|
+
_step5;
|
|
5812
|
+
try {
|
|
5813
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
5814
|
+
var dataset = _step5.value;
|
|
5815
|
+
axis[valueOrDefault(this.chart.options.indexAxis === 'x' ? dataset.xAxisID : dataset.yAxisID, firstScaleAxisId)] = true;
|
|
5816
|
+
}
|
|
5817
|
+
} catch (err) {
|
|
5818
|
+
_iterator5.e(err);
|
|
5819
|
+
} finally {
|
|
5820
|
+
_iterator5.f();
|
|
5821
|
+
}
|
|
5822
|
+
return Object.keys(axis);
|
|
5823
|
+
}
|
|
5744
5824
|
}, {
|
|
5745
5825
|
key: "_getStackIndex",
|
|
5746
5826
|
value: function _getStackIndex(datasetIndex, name, dataIndex) {
|
|
@@ -5845,10 +5925,13 @@
|
|
|
5845
5925
|
var skipNull = options.skipNull;
|
|
5846
5926
|
var maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);
|
|
5847
5927
|
var center, size;
|
|
5928
|
+
var axisCount = this._getAxisCount();
|
|
5848
5929
|
if (ruler.grouped) {
|
|
5849
5930
|
var stackCount = skipNull ? this._getStackCount(index) : ruler.stackCount;
|
|
5850
|
-
var range = options.barThickness === 'flex' ? computeFlexCategoryTraits(index, ruler, options, stackCount) : computeFitCategoryTraits(index, ruler, options, stackCount);
|
|
5851
|
-
var
|
|
5931
|
+
var range = options.barThickness === 'flex' ? computeFlexCategoryTraits(index, ruler, options, stackCount * axisCount) : computeFitCategoryTraits(index, ruler, options, stackCount * axisCount);
|
|
5932
|
+
var axisID = this.chart.options.indexAxis === 'x' ? this.getDataset().xAxisID : this.getDataset().yAxisID;
|
|
5933
|
+
var axisNumber = this._getAxis().indexOf(valueOrDefault(axisID, this.getFirstScaleIdForIndexAxis()));
|
|
5934
|
+
var stackIndex = this._getStackIndex(this.index, this._cachedMeta.stack, skipNull ? index : undefined) + axisNumber;
|
|
5852
5935
|
center = range.start + range.chunk * stackIndex + range.chunk / 2;
|
|
5853
5936
|
size = Math.min(maxBarThickness, range.chunk * range.ratio);
|
|
5854
5937
|
} else {
|
|
@@ -6349,14 +6432,15 @@
|
|
|
6349
6432
|
circumference: 360,
|
|
6350
6433
|
radius: '100%',
|
|
6351
6434
|
spacing: 0,
|
|
6435
|
+
spacingMode: 'angular',
|
|
6352
6436
|
indexAxis: 'r'
|
|
6353
6437
|
});
|
|
6354
6438
|
_defineProperty$1(DoughnutController, "descriptors", {
|
|
6355
6439
|
_scriptable: function _scriptable(name) {
|
|
6356
|
-
return name !== 'spacing';
|
|
6440
|
+
return name !== 'spacing' && name !== 'spacingMode';
|
|
6357
6441
|
},
|
|
6358
6442
|
_indexable: function _indexable(name) {
|
|
6359
|
-
return name !== 'spacing' && !name.startsWith('borderDash') && !name.startsWith('hoverBorderDash');
|
|
6443
|
+
return name !== 'spacing' && name !== 'spacingMode' && !name.startsWith('borderDash') && !name.startsWith('hoverBorderDash');
|
|
6360
6444
|
}
|
|
6361
6445
|
});
|
|
6362
6446
|
_defineProperty$1(DoughnutController, "overrides", {
|
|
@@ -6366,21 +6450,29 @@
|
|
|
6366
6450
|
labels: {
|
|
6367
6451
|
generateLabels: function generateLabels(chart) {
|
|
6368
6452
|
var data = chart.data;
|
|
6453
|
+
var _chart$legend$options2 = chart.legend.options.labels,
|
|
6454
|
+
pointStyle = _chart$legend$options2.pointStyle,
|
|
6455
|
+
textAlign = _chart$legend$options2.textAlign,
|
|
6456
|
+
color = _chart$legend$options2.color,
|
|
6457
|
+
useBorderRadius = _chart$legend$options2.useBorderRadius,
|
|
6458
|
+
borderRadius = _chart$legend$options2.borderRadius;
|
|
6369
6459
|
if (data.labels.length && data.datasets.length) {
|
|
6370
|
-
var _chart$legend$options2 = chart.legend.options.labels,
|
|
6371
|
-
pointStyle = _chart$legend$options2.pointStyle,
|
|
6372
|
-
color = _chart$legend$options2.color;
|
|
6373
6460
|
return data.labels.map(function (label, i) {
|
|
6374
6461
|
var meta = chart.getDatasetMeta(0);
|
|
6375
6462
|
var style = meta.controller.getStyle(i);
|
|
6376
6463
|
return {
|
|
6377
6464
|
text: label,
|
|
6378
6465
|
fillStyle: style.backgroundColor,
|
|
6379
|
-
strokeStyle: style.borderColor,
|
|
6380
6466
|
fontColor: color,
|
|
6467
|
+
hidden: !chart.getDataVisibility(i),
|
|
6468
|
+
lineDash: style.borderDash,
|
|
6469
|
+
lineDashOffset: style.borderDashOffset,
|
|
6470
|
+
lineJoin: style.borderJoinStyle,
|
|
6381
6471
|
lineWidth: style.borderWidth,
|
|
6472
|
+
strokeStyle: style.borderColor,
|
|
6473
|
+
textAlign: textAlign,
|
|
6382
6474
|
pointStyle: pointStyle,
|
|
6383
|
-
|
|
6475
|
+
borderRadius: useBorderRadius && (borderRadius || style.borderRadius),
|
|
6384
6476
|
index: i
|
|
6385
6477
|
};
|
|
6386
6478
|
});
|
|
@@ -6638,6 +6730,12 @@
|
|
|
6638
6730
|
endAngle: endAngle,
|
|
6639
6731
|
options: this.resolveDataElementOptions(i, arc.active ? 'active' : mode)
|
|
6640
6732
|
};
|
|
6733
|
+
if (properties.options.spacing === 0) {
|
|
6734
|
+
properties.options.spacing = this.options.spacing;
|
|
6735
|
+
}
|
|
6736
|
+
if (properties.options.spacingMode === 'angular') {
|
|
6737
|
+
properties.options.spacingMode = this.options.spacingMode;
|
|
6738
|
+
}
|
|
6641
6739
|
this.updateElement(arc, i, properties, mode);
|
|
6642
6740
|
}
|
|
6643
6741
|
}
|
|
@@ -6675,7 +6773,9 @@
|
|
|
6675
6773
|
}
|
|
6676
6774
|
},
|
|
6677
6775
|
indexAxis: 'r',
|
|
6678
|
-
startAngle: 0
|
|
6776
|
+
startAngle: 0,
|
|
6777
|
+
spacing: 0,
|
|
6778
|
+
spacingMode: 'proportional'
|
|
6679
6779
|
});
|
|
6680
6780
|
_defineProperty$1(PolarAreaController, "overrides", {
|
|
6681
6781
|
aspectRatio: 1,
|
|
@@ -7081,10 +7181,24 @@
|
|
|
7081
7181
|
data = metaset.data,
|
|
7082
7182
|
_sorted = metaset._sorted;
|
|
7083
7183
|
var iScale = controller._cachedMeta.iScale;
|
|
7184
|
+
var spanGaps = metaset.dataset ? metaset.dataset.options ? metaset.dataset.options.spanGaps : null : null;
|
|
7084
7185
|
if (iScale && axis === iScale.axis && axis !== 'r' && _sorted && data.length) {
|
|
7085
7186
|
var lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;
|
|
7086
7187
|
if (!intersect) {
|
|
7087
|
-
|
|
7188
|
+
var result = lookupMethod(data, axis, value);
|
|
7189
|
+
if (spanGaps) {
|
|
7190
|
+
var vScale = controller._cachedMeta.vScale;
|
|
7191
|
+
var _parsed = metaset._parsed;
|
|
7192
|
+
var distanceToDefinedLo = _parsed.slice(0, result.lo + 1).reverse().findIndex(function (point) {
|
|
7193
|
+
return !isNullOrUndef(point[vScale.axis]);
|
|
7194
|
+
});
|
|
7195
|
+
result.lo -= Math.max(0, distanceToDefinedLo);
|
|
7196
|
+
var distanceToDefinedHi = _parsed.slice(result.hi).findIndex(function (point) {
|
|
7197
|
+
return !isNullOrUndef(point[vScale.axis]);
|
|
7198
|
+
});
|
|
7199
|
+
result.hi += Math.max(0, distanceToDefinedHi);
|
|
7200
|
+
}
|
|
7201
|
+
return result;
|
|
7088
7202
|
} else if (controller._sharedOptions) {
|
|
7089
7203
|
var el = data[0];
|
|
7090
7204
|
var range = typeof el.getRange === 'function' && el.getRange(axis);
|
|
@@ -7339,11 +7453,11 @@
|
|
|
7339
7453
|
}
|
|
7340
7454
|
function buildStacks(layouts) {
|
|
7341
7455
|
var stacks = {};
|
|
7342
|
-
var
|
|
7343
|
-
|
|
7456
|
+
var _iterator6 = _createForOfIteratorHelper$1(layouts),
|
|
7457
|
+
_step6;
|
|
7344
7458
|
try {
|
|
7345
|
-
for (
|
|
7346
|
-
var wrap =
|
|
7459
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
7460
|
+
var wrap = _step6.value;
|
|
7347
7461
|
var stack = wrap.stack,
|
|
7348
7462
|
pos = wrap.pos,
|
|
7349
7463
|
stackWeight = wrap.stackWeight;
|
|
@@ -7360,9 +7474,9 @@
|
|
|
7360
7474
|
_stack.weight += stackWeight;
|
|
7361
7475
|
}
|
|
7362
7476
|
} catch (err) {
|
|
7363
|
-
|
|
7477
|
+
_iterator6.e(err);
|
|
7364
7478
|
} finally {
|
|
7365
|
-
|
|
7479
|
+
_iterator6.f();
|
|
7366
7480
|
}
|
|
7367
7481
|
return stacks;
|
|
7368
7482
|
}
|
|
@@ -7506,11 +7620,11 @@
|
|
|
7506
7620
|
var userPadding = params.padding;
|
|
7507
7621
|
var x = chartArea.x,
|
|
7508
7622
|
y = chartArea.y;
|
|
7509
|
-
var
|
|
7510
|
-
|
|
7623
|
+
var _iterator7 = _createForOfIteratorHelper$1(boxes),
|
|
7624
|
+
_step7;
|
|
7511
7625
|
try {
|
|
7512
|
-
for (
|
|
7513
|
-
var layout =
|
|
7626
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
7627
|
+
var layout = _step7.value;
|
|
7514
7628
|
var box = layout.box;
|
|
7515
7629
|
var stack = stacks[layout.stack] || {
|
|
7516
7630
|
count: 1,
|
|
@@ -7549,9 +7663,9 @@
|
|
|
7549
7663
|
}
|
|
7550
7664
|
}
|
|
7551
7665
|
} catch (err) {
|
|
7552
|
-
|
|
7666
|
+
_iterator7.e(err);
|
|
7553
7667
|
} finally {
|
|
7554
|
-
|
|
7668
|
+
_iterator7.f();
|
|
7555
7669
|
}
|
|
7556
7670
|
chartArea.x = x;
|
|
7557
7671
|
chartArea.y = y;
|
|
@@ -7790,37 +7904,37 @@
|
|
|
7790
7904
|
};
|
|
7791
7905
|
}
|
|
7792
7906
|
function nodeListContains(nodeList, canvas) {
|
|
7793
|
-
var
|
|
7794
|
-
|
|
7907
|
+
var _iterator8 = _createForOfIteratorHelper$1(nodeList),
|
|
7908
|
+
_step8;
|
|
7795
7909
|
try {
|
|
7796
|
-
for (
|
|
7797
|
-
var node =
|
|
7910
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
7911
|
+
var node = _step8.value;
|
|
7798
7912
|
if (node === canvas || node.contains(canvas)) {
|
|
7799
7913
|
return true;
|
|
7800
7914
|
}
|
|
7801
7915
|
}
|
|
7802
7916
|
} catch (err) {
|
|
7803
|
-
|
|
7917
|
+
_iterator8.e(err);
|
|
7804
7918
|
} finally {
|
|
7805
|
-
|
|
7919
|
+
_iterator8.f();
|
|
7806
7920
|
}
|
|
7807
7921
|
}
|
|
7808
7922
|
function createAttachObserver(chart, type, listener) {
|
|
7809
7923
|
var canvas = chart.canvas;
|
|
7810
7924
|
var observer = new MutationObserver(function (entries) {
|
|
7811
7925
|
var trigger = false;
|
|
7812
|
-
var
|
|
7813
|
-
|
|
7926
|
+
var _iterator9 = _createForOfIteratorHelper$1(entries),
|
|
7927
|
+
_step9;
|
|
7814
7928
|
try {
|
|
7815
|
-
for (
|
|
7816
|
-
var entry =
|
|
7929
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
7930
|
+
var entry = _step9.value;
|
|
7817
7931
|
trigger = trigger || nodeListContains(entry.addedNodes, canvas);
|
|
7818
7932
|
trigger = trigger && !nodeListContains(entry.removedNodes, canvas);
|
|
7819
7933
|
}
|
|
7820
7934
|
} catch (err) {
|
|
7821
|
-
|
|
7935
|
+
_iterator9.e(err);
|
|
7822
7936
|
} finally {
|
|
7823
|
-
|
|
7937
|
+
_iterator9.f();
|
|
7824
7938
|
}
|
|
7825
7939
|
if (trigger) {
|
|
7826
7940
|
listener();
|
|
@@ -7836,18 +7950,18 @@
|
|
|
7836
7950
|
var canvas = chart.canvas;
|
|
7837
7951
|
var observer = new MutationObserver(function (entries) {
|
|
7838
7952
|
var trigger = false;
|
|
7839
|
-
var
|
|
7840
|
-
|
|
7953
|
+
var _iterator0 = _createForOfIteratorHelper$1(entries),
|
|
7954
|
+
_step0;
|
|
7841
7955
|
try {
|
|
7842
|
-
for (
|
|
7843
|
-
var entry =
|
|
7956
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
7957
|
+
var entry = _step0.value;
|
|
7844
7958
|
trigger = trigger || nodeListContains(entry.removedNodes, canvas);
|
|
7845
7959
|
trigger = trigger && !nodeListContains(entry.addedNodes, canvas);
|
|
7846
7960
|
}
|
|
7847
7961
|
} catch (err) {
|
|
7848
|
-
|
|
7962
|
+
_iterator0.e(err);
|
|
7849
7963
|
} finally {
|
|
7850
|
-
|
|
7964
|
+
_iterator0.f();
|
|
7851
7965
|
}
|
|
7852
7966
|
if (trigger) {
|
|
7853
7967
|
listener();
|
|
@@ -9454,9 +9568,9 @@
|
|
|
9454
9568
|
value: function drawBorder() {
|
|
9455
9569
|
var chart = this.chart,
|
|
9456
9570
|
ctx = this.ctx,
|
|
9457
|
-
_this$
|
|
9458
|
-
border = _this$
|
|
9459
|
-
grid = _this$
|
|
9571
|
+
_this$options0 = this.options,
|
|
9572
|
+
border = _this$options0.border,
|
|
9573
|
+
grid = _this$options0.grid;
|
|
9460
9574
|
var borderOpts = border.setContext(this.getContext());
|
|
9461
9575
|
var axisWidth = border.display ? borderOpts.width : 0;
|
|
9462
9576
|
if (!axisWidth) {
|
|
@@ -9496,11 +9610,11 @@
|
|
|
9496
9610
|
clipArea(ctx, area);
|
|
9497
9611
|
}
|
|
9498
9612
|
var items = this.getLabelItems(chartArea);
|
|
9499
|
-
var
|
|
9500
|
-
|
|
9613
|
+
var _iterator1 = _createForOfIteratorHelper$1(items),
|
|
9614
|
+
_step1;
|
|
9501
9615
|
try {
|
|
9502
|
-
for (
|
|
9503
|
-
var item =
|
|
9616
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
9617
|
+
var item = _step1.value;
|
|
9504
9618
|
var renderTextOptions = item.options;
|
|
9505
9619
|
var tickFont = item.font;
|
|
9506
9620
|
var label = item.label;
|
|
@@ -9508,9 +9622,9 @@
|
|
|
9508
9622
|
renderText(ctx, label, 0, y, tickFont, renderTextOptions);
|
|
9509
9623
|
}
|
|
9510
9624
|
} catch (err) {
|
|
9511
|
-
|
|
9625
|
+
_iterator1.e(err);
|
|
9512
9626
|
} finally {
|
|
9513
|
-
|
|
9627
|
+
_iterator1.f();
|
|
9514
9628
|
}
|
|
9515
9629
|
if (area) {
|
|
9516
9630
|
unclipArea(ctx);
|
|
@@ -9520,10 +9634,10 @@
|
|
|
9520
9634
|
key: "drawTitle",
|
|
9521
9635
|
value: function drawTitle() {
|
|
9522
9636
|
var ctx = this.ctx,
|
|
9523
|
-
_this$
|
|
9524
|
-
position = _this$
|
|
9525
|
-
title = _this$
|
|
9526
|
-
reverse = _this$
|
|
9637
|
+
_this$options1 = this.options,
|
|
9638
|
+
position = _this$options1.position,
|
|
9639
|
+
title = _this$options1.title,
|
|
9640
|
+
reverse = _this$options1.reverse;
|
|
9527
9641
|
if (!title.display) {
|
|
9528
9642
|
return;
|
|
9529
9643
|
}
|
|
@@ -9550,7 +9664,9 @@
|
|
|
9550
9664
|
rotation: rotation,
|
|
9551
9665
|
textAlign: titleAlign(align, position, reverse),
|
|
9552
9666
|
textBaseline: 'middle',
|
|
9553
|
-
translation: [titleX, titleY]
|
|
9667
|
+
translation: [titleX, titleY],
|
|
9668
|
+
strokeColor: title.strokeColor,
|
|
9669
|
+
strokeWidth: title.strokeWidth
|
|
9554
9670
|
});
|
|
9555
9671
|
}
|
|
9556
9672
|
}, {
|
|
@@ -9568,7 +9684,7 @@
|
|
|
9568
9684
|
}, {
|
|
9569
9685
|
key: "_layers",
|
|
9570
9686
|
value: function _layers() {
|
|
9571
|
-
var
|
|
9687
|
+
var _this0 = this;
|
|
9572
9688
|
var opts = this.options;
|
|
9573
9689
|
var tz = opts.ticks && opts.ticks.z || 0;
|
|
9574
9690
|
var gz = valueOrDefault(opts.grid && opts.grid.z, -1);
|
|
@@ -9577,26 +9693,26 @@
|
|
|
9577
9693
|
return [{
|
|
9578
9694
|
z: tz,
|
|
9579
9695
|
draw: function draw(chartArea) {
|
|
9580
|
-
|
|
9696
|
+
_this0.draw(chartArea);
|
|
9581
9697
|
}
|
|
9582
9698
|
}];
|
|
9583
9699
|
}
|
|
9584
9700
|
return [{
|
|
9585
9701
|
z: gz,
|
|
9586
9702
|
draw: function draw(chartArea) {
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9703
|
+
_this0.drawBackground();
|
|
9704
|
+
_this0.drawGrid(chartArea);
|
|
9705
|
+
_this0.drawTitle();
|
|
9590
9706
|
}
|
|
9591
9707
|
}, {
|
|
9592
9708
|
z: bz,
|
|
9593
9709
|
draw: function draw() {
|
|
9594
|
-
|
|
9710
|
+
_this0.drawBorder();
|
|
9595
9711
|
}
|
|
9596
9712
|
}, {
|
|
9597
9713
|
z: tz,
|
|
9598
9714
|
draw: function draw(chartArea) {
|
|
9599
|
-
|
|
9715
|
+
_this0.drawLabels(chartArea);
|
|
9600
9716
|
}
|
|
9601
9717
|
}];
|
|
9602
9718
|
}
|
|
@@ -9817,23 +9933,23 @@
|
|
|
9817
9933
|
}, {
|
|
9818
9934
|
key: "removeScales",
|
|
9819
9935
|
value: function removeScales() {
|
|
9820
|
-
for (var
|
|
9821
|
-
args[
|
|
9936
|
+
for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
|
9937
|
+
args[_key0] = arguments[_key0];
|
|
9822
9938
|
}
|
|
9823
9939
|
this._each('unregister', args, this.scales);
|
|
9824
9940
|
}
|
|
9825
9941
|
}, {
|
|
9826
9942
|
key: "_each",
|
|
9827
9943
|
value: function _each(method, args, typedRegistry) {
|
|
9828
|
-
var
|
|
9944
|
+
var _this1 = this;
|
|
9829
9945
|
_toConsumableArray(args).forEach(function (arg) {
|
|
9830
|
-
var reg = typedRegistry ||
|
|
9831
|
-
if (typedRegistry || reg.isForType(arg) || reg ===
|
|
9832
|
-
|
|
9946
|
+
var reg = typedRegistry || _this1._getRegistryForType(arg);
|
|
9947
|
+
if (typedRegistry || reg.isForType(arg) || reg === _this1.plugins && arg.id) {
|
|
9948
|
+
_this1._exec(method, reg, arg);
|
|
9833
9949
|
} else {
|
|
9834
9950
|
each(arg, function (item) {
|
|
9835
|
-
var itemReg = typedRegistry ||
|
|
9836
|
-
|
|
9951
|
+
var itemReg = typedRegistry || _this1._getRegistryForType(item);
|
|
9952
|
+
_this1._exec(method, itemReg, item);
|
|
9837
9953
|
});
|
|
9838
9954
|
}
|
|
9839
9955
|
});
|
|
@@ -9872,7 +9988,7 @@
|
|
|
9872
9988
|
var PluginService = /*#__PURE__*/function () {
|
|
9873
9989
|
function PluginService() {
|
|
9874
9990
|
_classCallCheck$1(this, PluginService);
|
|
9875
|
-
this._init =
|
|
9991
|
+
this._init = undefined;
|
|
9876
9992
|
}
|
|
9877
9993
|
return _createClass$1(PluginService, [{
|
|
9878
9994
|
key: "notify",
|
|
@@ -9881,11 +9997,15 @@
|
|
|
9881
9997
|
this._init = this._createDescriptors(chart, true);
|
|
9882
9998
|
this._notify(this._init, chart, 'install');
|
|
9883
9999
|
}
|
|
10000
|
+
if (this._init === undefined) {
|
|
10001
|
+
return;
|
|
10002
|
+
}
|
|
9884
10003
|
var descriptors = filter ? this._descriptors(chart).filter(filter) : this._descriptors(chart);
|
|
9885
10004
|
var result = this._notify(descriptors, chart, hook, args);
|
|
9886
10005
|
if (hook === 'afterDestroy') {
|
|
9887
10006
|
this._notify(descriptors, chart, 'stop');
|
|
9888
10007
|
this._notify(this._init, chart, 'uninstall');
|
|
10008
|
+
this._init = undefined;
|
|
9889
10009
|
}
|
|
9890
10010
|
return result;
|
|
9891
10011
|
}
|
|
@@ -9893,11 +10013,11 @@
|
|
|
9893
10013
|
key: "_notify",
|
|
9894
10014
|
value: function _notify(descriptors, chart, hook, args) {
|
|
9895
10015
|
args = args || {};
|
|
9896
|
-
var
|
|
9897
|
-
|
|
10016
|
+
var _iterator10 = _createForOfIteratorHelper$1(descriptors),
|
|
10017
|
+
_step10;
|
|
9898
10018
|
try {
|
|
9899
|
-
for (
|
|
9900
|
-
var descriptor =
|
|
10019
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
10020
|
+
var descriptor = _step10.value;
|
|
9901
10021
|
var plugin = descriptor.plugin;
|
|
9902
10022
|
var method = plugin[hook];
|
|
9903
10023
|
var params = [chart, args, descriptor.options];
|
|
@@ -9906,9 +10026,9 @@
|
|
|
9906
10026
|
}
|
|
9907
10027
|
}
|
|
9908
10028
|
} catch (err) {
|
|
9909
|
-
|
|
10029
|
+
_iterator10.e(err);
|
|
9910
10030
|
} finally {
|
|
9911
|
-
|
|
10031
|
+
_iterator10.f();
|
|
9912
10032
|
}
|
|
9913
10033
|
return true;
|
|
9914
10034
|
}
|
|
@@ -9989,11 +10109,11 @@
|
|
|
9989
10109
|
localIds = _ref2.localIds;
|
|
9990
10110
|
var result = [];
|
|
9991
10111
|
var context = chart.getContext();
|
|
9992
|
-
var
|
|
9993
|
-
|
|
10112
|
+
var _iterator11 = _createForOfIteratorHelper$1(plugins),
|
|
10113
|
+
_step11;
|
|
9994
10114
|
try {
|
|
9995
|
-
for (
|
|
9996
|
-
var plugin =
|
|
10115
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
10116
|
+
var plugin = _step11.value;
|
|
9997
10117
|
var id = plugin.id;
|
|
9998
10118
|
var opts = getOpts(options[id], all);
|
|
9999
10119
|
if (opts === null) {
|
|
@@ -10008,9 +10128,9 @@
|
|
|
10008
10128
|
});
|
|
10009
10129
|
}
|
|
10010
10130
|
} catch (err) {
|
|
10011
|
-
|
|
10131
|
+
_iterator11.e(err);
|
|
10012
10132
|
} finally {
|
|
10013
|
-
|
|
10133
|
+
_iterator11.f();
|
|
10014
10134
|
}
|
|
10015
10135
|
return result;
|
|
10016
10136
|
}
|
|
@@ -10062,8 +10182,8 @@
|
|
|
10062
10182
|
if (idMatchesAxis(id)) {
|
|
10063
10183
|
return id;
|
|
10064
10184
|
}
|
|
10065
|
-
for (var
|
|
10066
|
-
scaleOptions[
|
|
10185
|
+
for (var _len1 = arguments.length, scaleOptions = new Array(_len1 > 1 ? _len1 - 1 : 0), _key1 = 1; _key1 < _len1; _key1++) {
|
|
10186
|
+
scaleOptions[_key1 - 1] = arguments[_key1];
|
|
10067
10187
|
}
|
|
10068
10188
|
for (var _i3 = 0, _scaleOptions = scaleOptions; _i3 < _scaleOptions.length; _i3++) {
|
|
10069
10189
|
var opts = _scaleOptions[_i3];
|
|
@@ -10329,17 +10449,17 @@
|
|
|
10329
10449
|
var subResolver = this.createResolver(scopes, context, subPrefixes);
|
|
10330
10450
|
options = _attachContext(resolver, context, subResolver);
|
|
10331
10451
|
}
|
|
10332
|
-
var
|
|
10333
|
-
|
|
10452
|
+
var _iterator12 = _createForOfIteratorHelper$1(names),
|
|
10453
|
+
_step12;
|
|
10334
10454
|
try {
|
|
10335
|
-
for (
|
|
10336
|
-
var prop =
|
|
10455
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
10456
|
+
var prop = _step12.value;
|
|
10337
10457
|
result[prop] = options[prop];
|
|
10338
10458
|
}
|
|
10339
10459
|
} catch (err) {
|
|
10340
|
-
|
|
10460
|
+
_iterator12.e(err);
|
|
10341
10461
|
} finally {
|
|
10342
|
-
|
|
10462
|
+
_iterator12.f();
|
|
10343
10463
|
}
|
|
10344
10464
|
return result;
|
|
10345
10465
|
}
|
|
@@ -10383,11 +10503,11 @@
|
|
|
10383
10503
|
var _descriptors2 = _descriptors(proxy),
|
|
10384
10504
|
isScriptable = _descriptors2.isScriptable,
|
|
10385
10505
|
isIndexable = _descriptors2.isIndexable;
|
|
10386
|
-
var
|
|
10387
|
-
|
|
10506
|
+
var _iterator13 = _createForOfIteratorHelper$1(names),
|
|
10507
|
+
_step13;
|
|
10388
10508
|
try {
|
|
10389
|
-
for (
|
|
10390
|
-
var prop =
|
|
10509
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
10510
|
+
var prop = _step13.value;
|
|
10391
10511
|
var scriptable = isScriptable(prop);
|
|
10392
10512
|
var indexable = isIndexable(prop);
|
|
10393
10513
|
var value = (indexable || scriptable) && proxy[prop];
|
|
@@ -10396,13 +10516,13 @@
|
|
|
10396
10516
|
}
|
|
10397
10517
|
}
|
|
10398
10518
|
} catch (err) {
|
|
10399
|
-
|
|
10519
|
+
_iterator13.e(err);
|
|
10400
10520
|
} finally {
|
|
10401
|
-
|
|
10521
|
+
_iterator13.f();
|
|
10402
10522
|
}
|
|
10403
10523
|
return false;
|
|
10404
10524
|
}
|
|
10405
|
-
var version = "4.
|
|
10525
|
+
var version = "4.6.1";
|
|
10406
10526
|
var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
|
|
10407
10527
|
function positionIsHorizontal(position, axis) {
|
|
10408
10528
|
return position === 'top' || position === 'bottom' || KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x';
|
|
@@ -10464,25 +10584,9 @@
|
|
|
10464
10584
|
}
|
|
10465
10585
|
return e;
|
|
10466
10586
|
}
|
|
10467
|
-
function getSizeForArea(scale, chartArea, field) {
|
|
10468
|
-
return scale.options.clip ? scale[field] : chartArea[field];
|
|
10469
|
-
}
|
|
10470
|
-
function getDatasetArea(meta, chartArea) {
|
|
10471
|
-
var xScale = meta.xScale,
|
|
10472
|
-
yScale = meta.yScale;
|
|
10473
|
-
if (xScale && yScale) {
|
|
10474
|
-
return {
|
|
10475
|
-
left: getSizeForArea(xScale, chartArea, 'left'),
|
|
10476
|
-
right: getSizeForArea(xScale, chartArea, 'right'),
|
|
10477
|
-
top: getSizeForArea(yScale, chartArea, 'top'),
|
|
10478
|
-
bottom: getSizeForArea(yScale, chartArea, 'bottom')
|
|
10479
|
-
};
|
|
10480
|
-
}
|
|
10481
|
-
return chartArea;
|
|
10482
|
-
}
|
|
10483
10587
|
var Chart = /*#__PURE__*/function () {
|
|
10484
10588
|
function Chart(item, userConfig) {
|
|
10485
|
-
var
|
|
10589
|
+
var _this10 = this;
|
|
10486
10590
|
_classCallCheck$1(this, Chart);
|
|
10487
10591
|
var config = this.config = new Config(userConfig);
|
|
10488
10592
|
var initialCanvas = getCanvas(item);
|
|
@@ -10523,7 +10627,7 @@
|
|
|
10523
10627
|
this._animationsDisabled = undefined;
|
|
10524
10628
|
this.$context = undefined;
|
|
10525
10629
|
this._doResize = debounce(function (mode) {
|
|
10526
|
-
return
|
|
10630
|
+
return _this10.update(mode);
|
|
10527
10631
|
}, options.resizeDelay || 0);
|
|
10528
10632
|
this._dataChanges = [];
|
|
10529
10633
|
instances[this.id] = this;
|
|
@@ -10541,9 +10645,9 @@
|
|
|
10541
10645
|
return _createClass$1(Chart, [{
|
|
10542
10646
|
key: "aspectRatio",
|
|
10543
10647
|
get: function get() {
|
|
10544
|
-
var _this$
|
|
10545
|
-
aspectRatio = _this$
|
|
10546
|
-
maintainAspectRatio = _this$
|
|
10648
|
+
var _this$options10 = this.options,
|
|
10649
|
+
aspectRatio = _this$options10.aspectRatio,
|
|
10650
|
+
maintainAspectRatio = _this$options10.maintainAspectRatio,
|
|
10547
10651
|
width = this.width,
|
|
10548
10652
|
height = this.height,
|
|
10549
10653
|
_aspectRatio = this._aspectRatio;
|
|
@@ -10650,7 +10754,7 @@
|
|
|
10650
10754
|
}, {
|
|
10651
10755
|
key: "buildOrUpdateScales",
|
|
10652
10756
|
value: function buildOrUpdateScales() {
|
|
10653
|
-
var
|
|
10757
|
+
var _this11 = this;
|
|
10654
10758
|
var options = this.options;
|
|
10655
10759
|
var scaleOpts = options.scales;
|
|
10656
10760
|
var scales = this.scales;
|
|
@@ -10689,8 +10793,8 @@
|
|
|
10689
10793
|
scale = new scaleClass({
|
|
10690
10794
|
id: id,
|
|
10691
10795
|
type: scaleType,
|
|
10692
|
-
ctx:
|
|
10693
|
-
chart:
|
|
10796
|
+
ctx: _this11.ctx,
|
|
10797
|
+
chart: _this11
|
|
10694
10798
|
});
|
|
10695
10799
|
scales[scale.id] = scale;
|
|
10696
10800
|
}
|
|
@@ -10702,8 +10806,8 @@
|
|
|
10702
10806
|
}
|
|
10703
10807
|
});
|
|
10704
10808
|
each(scales, function (scale) {
|
|
10705
|
-
layouts.configure(
|
|
10706
|
-
layouts.addBox(
|
|
10809
|
+
layouts.configure(_this11, scale, scale.options);
|
|
10810
|
+
layouts.addBox(_this11, scale);
|
|
10707
10811
|
});
|
|
10708
10812
|
}
|
|
10709
10813
|
}, {
|
|
@@ -10726,7 +10830,7 @@
|
|
|
10726
10830
|
}, {
|
|
10727
10831
|
key: "_removeUnreferencedMetasets",
|
|
10728
10832
|
value: function _removeUnreferencedMetasets() {
|
|
10729
|
-
var
|
|
10833
|
+
var _this12 = this;
|
|
10730
10834
|
var metasets = this._metasets,
|
|
10731
10835
|
datasets = this.data.datasets;
|
|
10732
10836
|
if (metasets.length > datasets.length) {
|
|
@@ -10736,7 +10840,7 @@
|
|
|
10736
10840
|
if (datasets.filter(function (x) {
|
|
10737
10841
|
return x === meta._dataset;
|
|
10738
10842
|
}).length === 0) {
|
|
10739
|
-
|
|
10843
|
+
_this12._destroyDatasetMeta(index);
|
|
10740
10844
|
}
|
|
10741
10845
|
});
|
|
10742
10846
|
}
|
|
@@ -10783,9 +10887,9 @@
|
|
|
10783
10887
|
}, {
|
|
10784
10888
|
key: "_resetElements",
|
|
10785
10889
|
value: function _resetElements() {
|
|
10786
|
-
var
|
|
10890
|
+
var _this13 = this;
|
|
10787
10891
|
each(this.data.datasets, function (dataset, datasetIndex) {
|
|
10788
|
-
|
|
10892
|
+
_this13.getDatasetMeta(datasetIndex).controller.reset();
|
|
10789
10893
|
}, this);
|
|
10790
10894
|
}
|
|
10791
10895
|
}, {
|
|
@@ -10845,9 +10949,9 @@
|
|
|
10845
10949
|
}, {
|
|
10846
10950
|
key: "_updateScales",
|
|
10847
10951
|
value: function _updateScales() {
|
|
10848
|
-
var
|
|
10952
|
+
var _this14 = this;
|
|
10849
10953
|
each(this.scales, function (scale) {
|
|
10850
|
-
layouts.removeBox(
|
|
10954
|
+
layouts.removeBox(_this14, scale);
|
|
10851
10955
|
});
|
|
10852
10956
|
this.ensureScalesHaveIDs();
|
|
10853
10957
|
this.buildOrUpdateScales();
|
|
@@ -10868,21 +10972,21 @@
|
|
|
10868
10972
|
value: function _updateHiddenIndices() {
|
|
10869
10973
|
var _hiddenIndices = this._hiddenIndices;
|
|
10870
10974
|
var changes = this._getUniformDataChanges() || [];
|
|
10871
|
-
var
|
|
10872
|
-
|
|
10975
|
+
var _iterator14 = _createForOfIteratorHelper$1(changes),
|
|
10976
|
+
_step14;
|
|
10873
10977
|
try {
|
|
10874
|
-
for (
|
|
10875
|
-
var
|
|
10876
|
-
method =
|
|
10877
|
-
start =
|
|
10878
|
-
count =
|
|
10978
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
10979
|
+
var _step14$value = _step14.value,
|
|
10980
|
+
method = _step14$value.method,
|
|
10981
|
+
start = _step14$value.start,
|
|
10982
|
+
count = _step14$value.count;
|
|
10879
10983
|
var move = method === '_removeElements' ? -count : count;
|
|
10880
10984
|
moveNumericKeys(_hiddenIndices, start, move);
|
|
10881
10985
|
}
|
|
10882
10986
|
} catch (err) {
|
|
10883
|
-
|
|
10987
|
+
_iterator14.e(err);
|
|
10884
10988
|
} finally {
|
|
10885
|
-
|
|
10989
|
+
_iterator14.f();
|
|
10886
10990
|
}
|
|
10887
10991
|
}
|
|
10888
10992
|
}, {
|
|
@@ -10920,7 +11024,7 @@
|
|
|
10920
11024
|
}, {
|
|
10921
11025
|
key: "_updateLayout",
|
|
10922
11026
|
value: function _updateLayout(minPadding) {
|
|
10923
|
-
var
|
|
11027
|
+
var _this15 = this;
|
|
10924
11028
|
if (this.notifyPlugins('beforeLayout', {
|
|
10925
11029
|
cancelable: true
|
|
10926
11030
|
}) === false) {
|
|
@@ -10931,14 +11035,14 @@
|
|
|
10931
11035
|
var noArea = area.width <= 0 || area.height <= 0;
|
|
10932
11036
|
this._layers = [];
|
|
10933
11037
|
each(this.boxes, function (box) {
|
|
10934
|
-
var
|
|
11038
|
+
var _this15$_layers;
|
|
10935
11039
|
if (noArea && box.position === 'chartArea') {
|
|
10936
11040
|
return;
|
|
10937
11041
|
}
|
|
10938
11042
|
if (box.configure) {
|
|
10939
11043
|
box.configure();
|
|
10940
11044
|
}
|
|
10941
|
-
(
|
|
11045
|
+
(_this15$_layers = _this15._layers).push.apply(_this15$_layers, _toConsumableArray(box._layers()));
|
|
10942
11046
|
}, this);
|
|
10943
11047
|
this._layers.forEach(function (item, index) {
|
|
10944
11048
|
item._idx = index;
|
|
@@ -11069,27 +11173,20 @@
|
|
|
11069
11173
|
key: "_drawDataset",
|
|
11070
11174
|
value: function _drawDataset(meta) {
|
|
11071
11175
|
var ctx = this.ctx;
|
|
11072
|
-
var clip = meta._clip;
|
|
11073
|
-
var useClip = !clip.disabled;
|
|
11074
|
-
var area = getDatasetArea(meta, this.chartArea);
|
|
11075
11176
|
var args = {
|
|
11076
11177
|
meta: meta,
|
|
11077
11178
|
index: meta.index,
|
|
11078
11179
|
cancelable: true
|
|
11079
11180
|
};
|
|
11181
|
+
var clip = getDatasetClipArea(this, meta);
|
|
11080
11182
|
if (this.notifyPlugins('beforeDatasetDraw', args) === false) {
|
|
11081
11183
|
return;
|
|
11082
11184
|
}
|
|
11083
|
-
if (
|
|
11084
|
-
clipArea(ctx,
|
|
11085
|
-
left: clip.left === false ? 0 : area.left - clip.left,
|
|
11086
|
-
right: clip.right === false ? this.width : area.right + clip.right,
|
|
11087
|
-
top: clip.top === false ? 0 : area.top - clip.top,
|
|
11088
|
-
bottom: clip.bottom === false ? this.height : area.bottom + clip.bottom
|
|
11089
|
-
});
|
|
11185
|
+
if (clip) {
|
|
11186
|
+
clipArea(ctx, clip);
|
|
11090
11187
|
}
|
|
11091
11188
|
meta.controller.draw();
|
|
11092
|
-
if (
|
|
11189
|
+
if (clip) {
|
|
11093
11190
|
unclipArea(ctx);
|
|
11094
11191
|
}
|
|
11095
11192
|
args.cancelable = false;
|
|
@@ -11260,17 +11357,17 @@
|
|
|
11260
11357
|
}, {
|
|
11261
11358
|
key: "bindUserEvents",
|
|
11262
11359
|
value: function bindUserEvents() {
|
|
11263
|
-
var
|
|
11360
|
+
var _this16 = this;
|
|
11264
11361
|
var listeners = this._listeners;
|
|
11265
11362
|
var platform = this.platform;
|
|
11266
11363
|
var _add = function _add(type, listener) {
|
|
11267
|
-
platform.addEventListener(
|
|
11364
|
+
platform.addEventListener(_this16, type, listener);
|
|
11268
11365
|
listeners[type] = listener;
|
|
11269
11366
|
};
|
|
11270
11367
|
var listener = function listener(e, x, y) {
|
|
11271
11368
|
e.offsetX = x;
|
|
11272
11369
|
e.offsetY = y;
|
|
11273
|
-
|
|
11370
|
+
_this16._eventHandler(e);
|
|
11274
11371
|
};
|
|
11275
11372
|
each(this.options.events, function (type) {
|
|
11276
11373
|
return _add(type, listener);
|
|
@@ -11279,40 +11376,40 @@
|
|
|
11279
11376
|
}, {
|
|
11280
11377
|
key: "bindResponsiveEvents",
|
|
11281
11378
|
value: function bindResponsiveEvents() {
|
|
11282
|
-
var
|
|
11379
|
+
var _this17 = this;
|
|
11283
11380
|
if (!this._responsiveListeners) {
|
|
11284
11381
|
this._responsiveListeners = {};
|
|
11285
11382
|
}
|
|
11286
11383
|
var listeners = this._responsiveListeners;
|
|
11287
11384
|
var platform = this.platform;
|
|
11288
11385
|
var _add = function _add(type, listener) {
|
|
11289
|
-
platform.addEventListener(
|
|
11386
|
+
platform.addEventListener(_this17, type, listener);
|
|
11290
11387
|
listeners[type] = listener;
|
|
11291
11388
|
};
|
|
11292
11389
|
var _remove = function _remove(type, listener) {
|
|
11293
11390
|
if (listeners[type]) {
|
|
11294
|
-
platform.removeEventListener(
|
|
11391
|
+
platform.removeEventListener(_this17, type, listener);
|
|
11295
11392
|
delete listeners[type];
|
|
11296
11393
|
}
|
|
11297
11394
|
};
|
|
11298
11395
|
var listener = function listener(width, height) {
|
|
11299
|
-
if (
|
|
11300
|
-
|
|
11396
|
+
if (_this17.canvas) {
|
|
11397
|
+
_this17.resize(width, height);
|
|
11301
11398
|
}
|
|
11302
11399
|
};
|
|
11303
11400
|
var detached;
|
|
11304
11401
|
var _attached = function attached() {
|
|
11305
11402
|
_remove('attach', _attached);
|
|
11306
|
-
|
|
11307
|
-
|
|
11403
|
+
_this17.attached = true;
|
|
11404
|
+
_this17.resize();
|
|
11308
11405
|
_add('resize', listener);
|
|
11309
11406
|
_add('detach', detached);
|
|
11310
11407
|
};
|
|
11311
11408
|
detached = function detached() {
|
|
11312
|
-
|
|
11409
|
+
_this17.attached = false;
|
|
11313
11410
|
_remove('resize', listener);
|
|
11314
|
-
|
|
11315
|
-
|
|
11411
|
+
_this17._stop();
|
|
11412
|
+
_this17._resize(0, 0);
|
|
11316
11413
|
_add('attach', _attached);
|
|
11317
11414
|
};
|
|
11318
11415
|
if (platform.isAttached(this.canvas)) {
|
|
@@ -11324,13 +11421,13 @@
|
|
|
11324
11421
|
}, {
|
|
11325
11422
|
key: "unbindEvents",
|
|
11326
11423
|
value: function unbindEvents() {
|
|
11327
|
-
var
|
|
11424
|
+
var _this18 = this;
|
|
11328
11425
|
each(this._listeners, function (listener, type) {
|
|
11329
|
-
|
|
11426
|
+
_this18.platform.removeEventListener(_this18, type, listener);
|
|
11330
11427
|
});
|
|
11331
11428
|
this._listeners = {};
|
|
11332
11429
|
each(this._responsiveListeners, function (listener, type) {
|
|
11333
|
-
|
|
11430
|
+
_this18.platform.removeEventListener(_this18, type, listener);
|
|
11334
11431
|
});
|
|
11335
11432
|
this._responsiveListeners = undefined;
|
|
11336
11433
|
}
|
|
@@ -11359,12 +11456,12 @@
|
|
|
11359
11456
|
}, {
|
|
11360
11457
|
key: "setActiveElements",
|
|
11361
11458
|
value: function setActiveElements(activeElements) {
|
|
11362
|
-
var
|
|
11459
|
+
var _this19 = this;
|
|
11363
11460
|
var lastActive = this._active || [];
|
|
11364
11461
|
var active = activeElements.map(function (_ref4) {
|
|
11365
11462
|
var datasetIndex = _ref4.datasetIndex,
|
|
11366
11463
|
index = _ref4.index;
|
|
11367
|
-
var meta =
|
|
11464
|
+
var meta = _this19.getDatasetMeta(datasetIndex);
|
|
11368
11465
|
if (!meta) {
|
|
11369
11466
|
throw new Error('No dataset found at index ' + datasetIndex);
|
|
11370
11467
|
}
|
|
@@ -11416,7 +11513,7 @@
|
|
|
11416
11513
|
}, {
|
|
11417
11514
|
key: "_eventHandler",
|
|
11418
11515
|
value: function _eventHandler(e, replay) {
|
|
11419
|
-
var
|
|
11516
|
+
var _this20 = this;
|
|
11420
11517
|
var args = {
|
|
11421
11518
|
event: e,
|
|
11422
11519
|
replay: replay,
|
|
@@ -11424,7 +11521,7 @@
|
|
|
11424
11521
|
inChartArea: this.isPointInArea(e)
|
|
11425
11522
|
};
|
|
11426
11523
|
var eventFilter = function eventFilter(plugin) {
|
|
11427
|
-
return (plugin.options.events ||
|
|
11524
|
+
return (plugin.options.events || _this20.options.events).includes(e["native"].type);
|
|
11428
11525
|
};
|
|
11429
11526
|
if (this.notifyPlugins('beforeEvent', args, eventFilter) === false) {
|
|
11430
11527
|
return;
|
|
@@ -11499,6 +11596,40 @@
|
|
|
11499
11596
|
return chart._plugins.invalidate();
|
|
11500
11597
|
});
|
|
11501
11598
|
}
|
|
11599
|
+
function clipSelf(ctx, element, endAngle) {
|
|
11600
|
+
var startAngle = element.startAngle,
|
|
11601
|
+
x = element.x,
|
|
11602
|
+
y = element.y,
|
|
11603
|
+
outerRadius = element.outerRadius,
|
|
11604
|
+
innerRadius = element.innerRadius,
|
|
11605
|
+
options = element.options;
|
|
11606
|
+
var borderWidth = options.borderWidth,
|
|
11607
|
+
borderJoinStyle = options.borderJoinStyle;
|
|
11608
|
+
var outerAngleClip = Math.min(borderWidth / outerRadius, _normalizeAngle(startAngle - endAngle));
|
|
11609
|
+
ctx.beginPath();
|
|
11610
|
+
ctx.arc(x, y, outerRadius - borderWidth / 2, startAngle + outerAngleClip / 2, endAngle - outerAngleClip / 2);
|
|
11611
|
+
if (innerRadius > 0) {
|
|
11612
|
+
var innerAngleClip = Math.min(borderWidth / innerRadius, _normalizeAngle(startAngle - endAngle));
|
|
11613
|
+
ctx.arc(x, y, innerRadius + borderWidth / 2, endAngle - innerAngleClip / 2, startAngle + innerAngleClip / 2, true);
|
|
11614
|
+
} else {
|
|
11615
|
+
var clipWidth = Math.min(borderWidth / 2, outerRadius * _normalizeAngle(startAngle - endAngle));
|
|
11616
|
+
if (borderJoinStyle === 'round') {
|
|
11617
|
+
ctx.arc(x, y, clipWidth, endAngle - PI / 2, startAngle + PI / 2, true);
|
|
11618
|
+
} else if (borderJoinStyle === 'bevel') {
|
|
11619
|
+
var r = 2 * clipWidth * clipWidth;
|
|
11620
|
+
var endX = -r * Math.cos(endAngle + PI / 2) + x;
|
|
11621
|
+
var endY = -r * Math.sin(endAngle + PI / 2) + y;
|
|
11622
|
+
var startX = r * Math.cos(startAngle + PI / 2) + x;
|
|
11623
|
+
var startY = r * Math.sin(startAngle + PI / 2) + y;
|
|
11624
|
+
ctx.lineTo(endX, endY);
|
|
11625
|
+
ctx.lineTo(startX, startY);
|
|
11626
|
+
}
|
|
11627
|
+
}
|
|
11628
|
+
ctx.closePath();
|
|
11629
|
+
ctx.moveTo(0, 0);
|
|
11630
|
+
ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
11631
|
+
ctx.clip('evenodd');
|
|
11632
|
+
}
|
|
11502
11633
|
function clipArc(ctx, element, endAngle) {
|
|
11503
11634
|
var startAngle = element.startAngle,
|
|
11504
11635
|
pixelMargin = element.pixelMargin,
|
|
@@ -11557,6 +11688,23 @@
|
|
|
11557
11688
|
y: y + r * Math.sin(theta)
|
|
11558
11689
|
};
|
|
11559
11690
|
}
|
|
11691
|
+
function pathFullCircle(ctx, element, offset, spacing) {
|
|
11692
|
+
var x = element.x,
|
|
11693
|
+
y = element.y,
|
|
11694
|
+
start = element.startAngle,
|
|
11695
|
+
pixelMargin = element.pixelMargin,
|
|
11696
|
+
innerR = element.innerRadius;
|
|
11697
|
+
var outerRadius = Math.max(element.outerRadius + spacing + offset - pixelMargin, 0);
|
|
11698
|
+
var innerRadius = innerR > 0 ? innerR + spacing + offset + pixelMargin : 0;
|
|
11699
|
+
ctx.beginPath();
|
|
11700
|
+
ctx.arc(x, y, outerRadius, start, start + TAU);
|
|
11701
|
+
if (innerRadius > 0) {
|
|
11702
|
+
// Start the inner contour as a separate subpath to avoid a seam connector.
|
|
11703
|
+
ctx.moveTo(x + Math.cos(start) * innerRadius, y + Math.sin(start) * innerRadius);
|
|
11704
|
+
ctx.arc(x, y, innerRadius, start + TAU, start, true);
|
|
11705
|
+
}
|
|
11706
|
+
ctx.closePath();
|
|
11707
|
+
}
|
|
11560
11708
|
/**
|
|
11561
11709
|
* Path the arc, respecting border radius by separating into left and right halves.
|
|
11562
11710
|
*
|
|
@@ -11577,37 +11725,73 @@
|
|
|
11577
11725
|
start = element.startAngle,
|
|
11578
11726
|
pixelMargin = element.pixelMargin,
|
|
11579
11727
|
innerR = element.innerRadius;
|
|
11728
|
+
var _element$options$spac = element.options.spacingMode,
|
|
11729
|
+
spacingMode = _element$options$spac === void 0 ? 'angular' : _element$options$spac;
|
|
11730
|
+
var alpha = end - start;
|
|
11731
|
+
if (circular && element.options.selfJoin && Math.abs(alpha) >= TAU - 1e-4) {
|
|
11732
|
+
pathFullCircle(ctx, element, offset, spacing);
|
|
11733
|
+
return;
|
|
11734
|
+
}
|
|
11580
11735
|
var outerRadius = Math.max(element.outerRadius + spacing + offset - pixelMargin, 0);
|
|
11581
11736
|
var innerRadius = innerR > 0 ? innerR + spacing + offset + pixelMargin : 0;
|
|
11582
|
-
var
|
|
11583
|
-
var
|
|
11737
|
+
var outerSpacingOffset = 0;
|
|
11738
|
+
var innerSpacingOffset = 0;
|
|
11739
|
+
var beta = outerRadius > 0 ? Math.max(0.001, alpha * outerRadius - offset / PI) / outerRadius : 0.001;
|
|
11740
|
+
var angleOffset = (alpha - beta) / 2;
|
|
11584
11741
|
if (spacing) {
|
|
11585
11742
|
// When spacing is present, it is the same for all items
|
|
11586
11743
|
// So we adjust the start and end angle of the arc such that
|
|
11587
11744
|
// the distance is the same as it would be without the spacing
|
|
11588
11745
|
var noSpacingInnerRadius = innerR > 0 ? innerR - spacing : 0;
|
|
11589
11746
|
var noSpacingOuterRadius = outerRadius > 0 ? outerRadius - spacing : 0;
|
|
11590
|
-
var
|
|
11591
|
-
var
|
|
11592
|
-
|
|
11747
|
+
var avgNoSpacingRadius = (noSpacingInnerRadius + noSpacingOuterRadius) / 2;
|
|
11748
|
+
var proportionalOffset = function () {
|
|
11749
|
+
var adjustedAngle = avgNoSpacingRadius !== 0 ? alpha * avgNoSpacingRadius / (avgNoSpacingRadius + spacing) : alpha;
|
|
11750
|
+
return (alpha - adjustedAngle) / 2;
|
|
11751
|
+
}();
|
|
11752
|
+
var angularOffset = avgNoSpacingRadius > 0 ? Math.asin(Math.min(1, spacing / avgNoSpacingRadius)) : 0;
|
|
11753
|
+
// Keep spacing trims below half the available span after base offset trimming.
|
|
11754
|
+
var maxOffset = Math.max(0, beta / 2 - 0.001);
|
|
11755
|
+
var maxOffsetSin = Math.sin(maxOffset);
|
|
11756
|
+
if (spacingMode === 'parallel') {
|
|
11757
|
+
if (innerRadius === 0 && maxOffsetSin > 0) {
|
|
11758
|
+
// A root radius of zero cannot realize a non-zero parallel separator width.
|
|
11759
|
+
// Raise the root just enough for the available angular span.
|
|
11760
|
+
var minInnerRadius = spacing / maxOffsetSin;
|
|
11761
|
+
var maxInnerRadius = Math.max(0, outerRadius - 0.001);
|
|
11762
|
+
innerRadius = Math.min(minInnerRadius, maxInnerRadius);
|
|
11763
|
+
}
|
|
11764
|
+
// Use one bounded spacing value for both radii so large spacing keeps stable geometry.
|
|
11765
|
+
var maxParallelSpacing = Math.min(outerRadius > 0 ? outerRadius * maxOffsetSin : Number.POSITIVE_INFINITY, innerRadius > 0 ? innerRadius * maxOffsetSin : Number.POSITIVE_INFINITY);
|
|
11766
|
+
var parallelSpacing = Math.min(spacing, maxParallelSpacing);
|
|
11767
|
+
outerSpacingOffset = outerRadius > 0 ? Math.asin(Math.min(1, parallelSpacing / outerRadius)) : Math.min(maxOffset, angularOffset);
|
|
11768
|
+
innerSpacingOffset = innerRadius > 0 ? Math.asin(Math.min(1, parallelSpacing / innerRadius)) : outerSpacingOffset;
|
|
11769
|
+
} else if (spacingMode === 'proportional') {
|
|
11770
|
+
outerSpacingOffset = Math.min(maxOffset, proportionalOffset);
|
|
11771
|
+
innerSpacingOffset = Math.min(maxOffset, proportionalOffset);
|
|
11772
|
+
} else {
|
|
11773
|
+
outerSpacingOffset = Math.min(maxOffset, angularOffset);
|
|
11774
|
+
innerSpacingOffset = Math.min(maxOffset, angularOffset);
|
|
11775
|
+
}
|
|
11593
11776
|
}
|
|
11594
|
-
var
|
|
11595
|
-
var
|
|
11596
|
-
var
|
|
11597
|
-
var
|
|
11598
|
-
var
|
|
11777
|
+
var outerStartAngle = start + angleOffset + outerSpacingOffset;
|
|
11778
|
+
var outerEndAngle = end - angleOffset - outerSpacingOffset;
|
|
11779
|
+
var innerStartAngle = start + angleOffset + innerSpacingOffset;
|
|
11780
|
+
var innerEndAngle = end - angleOffset - innerSpacingOffset;
|
|
11781
|
+
var angleDelta = Math.min(outerEndAngle - outerStartAngle, innerEndAngle - innerStartAngle);
|
|
11782
|
+
var _parseBorderRadius$ = parseBorderRadius$1(element, innerRadius, outerRadius, angleDelta),
|
|
11599
11783
|
outerStart = _parseBorderRadius$.outerStart,
|
|
11600
11784
|
outerEnd = _parseBorderRadius$.outerEnd,
|
|
11601
11785
|
innerStart = _parseBorderRadius$.innerStart,
|
|
11602
11786
|
innerEnd = _parseBorderRadius$.innerEnd;
|
|
11603
11787
|
var outerStartAdjustedRadius = outerRadius - outerStart;
|
|
11604
11788
|
var outerEndAdjustedRadius = outerRadius - outerEnd;
|
|
11605
|
-
var outerStartAdjustedAngle =
|
|
11606
|
-
var outerEndAdjustedAngle =
|
|
11789
|
+
var outerStartAdjustedAngle = outerStartAngle + outerStart / outerStartAdjustedRadius;
|
|
11790
|
+
var outerEndAdjustedAngle = outerEndAngle - outerEnd / outerEndAdjustedRadius;
|
|
11607
11791
|
var innerStartAdjustedRadius = innerRadius + innerStart;
|
|
11608
11792
|
var innerEndAdjustedRadius = innerRadius + innerEnd;
|
|
11609
|
-
var innerStartAdjustedAngle =
|
|
11610
|
-
var innerEndAdjustedAngle =
|
|
11793
|
+
var innerStartAdjustedAngle = innerStartAngle + innerStart / innerStartAdjustedRadius;
|
|
11794
|
+
var innerEndAdjustedAngle = innerEndAngle - innerEnd / innerEndAdjustedRadius;
|
|
11611
11795
|
ctx.beginPath();
|
|
11612
11796
|
if (circular) {
|
|
11613
11797
|
// The first arc segments from point 1 to point a to point 2
|
|
@@ -11617,32 +11801,32 @@
|
|
|
11617
11801
|
// The corner segment from point 2 to point 3
|
|
11618
11802
|
if (outerEnd > 0) {
|
|
11619
11803
|
var pCenter = rThetaToXY(outerEndAdjustedRadius, outerEndAdjustedAngle, x, y);
|
|
11620
|
-
ctx.arc(pCenter.x, pCenter.y, outerEnd, outerEndAdjustedAngle,
|
|
11804
|
+
ctx.arc(pCenter.x, pCenter.y, outerEnd, outerEndAdjustedAngle, outerEndAngle + HALF_PI);
|
|
11621
11805
|
}
|
|
11622
11806
|
// The line from point 3 to point 4
|
|
11623
|
-
var p4 = rThetaToXY(innerEndAdjustedRadius,
|
|
11807
|
+
var p4 = rThetaToXY(innerEndAdjustedRadius, innerEndAngle, x, y);
|
|
11624
11808
|
ctx.lineTo(p4.x, p4.y);
|
|
11625
11809
|
// The corner segment from point 4 to point 5
|
|
11626
11810
|
if (innerEnd > 0) {
|
|
11627
11811
|
var _pCenter = rThetaToXY(innerEndAdjustedRadius, innerEndAdjustedAngle, x, y);
|
|
11628
|
-
ctx.arc(_pCenter.x, _pCenter.y, innerEnd,
|
|
11812
|
+
ctx.arc(_pCenter.x, _pCenter.y, innerEnd, innerEndAngle + HALF_PI, innerEndAdjustedAngle + Math.PI);
|
|
11629
11813
|
}
|
|
11630
11814
|
// The inner arc from point 5 to point b to point 6
|
|
11631
|
-
var innerMidAdjustedAngle = (
|
|
11632
|
-
ctx.arc(x, y, innerRadius,
|
|
11633
|
-
ctx.arc(x, y, innerRadius, innerMidAdjustedAngle,
|
|
11815
|
+
var innerMidAdjustedAngle = (innerEndAngle - innerEnd / innerRadius + (innerStartAngle + innerStart / innerRadius)) / 2;
|
|
11816
|
+
ctx.arc(x, y, innerRadius, innerEndAngle - innerEnd / innerRadius, innerMidAdjustedAngle, true);
|
|
11817
|
+
ctx.arc(x, y, innerRadius, innerMidAdjustedAngle, innerStartAngle + innerStart / innerRadius, true);
|
|
11634
11818
|
// The corner segment from point 6 to point 7
|
|
11635
11819
|
if (innerStart > 0) {
|
|
11636
11820
|
var _pCenter2 = rThetaToXY(innerStartAdjustedRadius, innerStartAdjustedAngle, x, y);
|
|
11637
|
-
ctx.arc(_pCenter2.x, _pCenter2.y, innerStart, innerStartAdjustedAngle + Math.PI,
|
|
11821
|
+
ctx.arc(_pCenter2.x, _pCenter2.y, innerStart, innerStartAdjustedAngle + Math.PI, innerStartAngle - HALF_PI);
|
|
11638
11822
|
}
|
|
11639
11823
|
// The line from point 7 to point 8
|
|
11640
|
-
var p8 = rThetaToXY(outerStartAdjustedRadius,
|
|
11824
|
+
var p8 = rThetaToXY(outerStartAdjustedRadius, outerStartAngle, x, y);
|
|
11641
11825
|
ctx.lineTo(p8.x, p8.y);
|
|
11642
11826
|
// The corner segment from point 8 to point 1
|
|
11643
11827
|
if (outerStart > 0) {
|
|
11644
11828
|
var _pCenter3 = rThetaToXY(outerStartAdjustedRadius, outerStartAdjustedAngle, x, y);
|
|
11645
|
-
ctx.arc(_pCenter3.x, _pCenter3.y, outerStart,
|
|
11829
|
+
ctx.arc(_pCenter3.x, _pCenter3.y, outerStart, outerStartAngle - HALF_PI, outerStartAdjustedAngle);
|
|
11646
11830
|
}
|
|
11647
11831
|
} else {
|
|
11648
11832
|
ctx.moveTo(x, y);
|
|
@@ -11681,7 +11865,8 @@
|
|
|
11681
11865
|
var borderWidth = options.borderWidth,
|
|
11682
11866
|
borderJoinStyle = options.borderJoinStyle,
|
|
11683
11867
|
borderDash = options.borderDash,
|
|
11684
|
-
borderDashOffset = options.borderDashOffset
|
|
11868
|
+
borderDashOffset = options.borderDashOffset,
|
|
11869
|
+
borderRadius = options.borderRadius;
|
|
11685
11870
|
var inner = options.borderAlign === 'inner';
|
|
11686
11871
|
if (!borderWidth) {
|
|
11687
11872
|
return;
|
|
@@ -11696,6 +11881,7 @@
|
|
|
11696
11881
|
ctx.lineJoin = borderJoinStyle || 'bevel';
|
|
11697
11882
|
}
|
|
11698
11883
|
var endAngle = element.endAngle;
|
|
11884
|
+
var isFullCircle = Math.abs(endAngle - startAngle) >= TAU - 1e-4;
|
|
11699
11885
|
if (fullCircles) {
|
|
11700
11886
|
pathArc(ctx, element, offset, spacing, endAngle, circular);
|
|
11701
11887
|
for (var i = 0; i < fullCircles; ++i) {
|
|
@@ -11708,6 +11894,10 @@
|
|
|
11708
11894
|
if (inner) {
|
|
11709
11895
|
clipArc(ctx, element, endAngle);
|
|
11710
11896
|
}
|
|
11897
|
+
var skipSelfClip = isFullCircle && element.innerRadius > 0;
|
|
11898
|
+
if (!skipSelfClip && options.selfJoin && endAngle - startAngle >= PI && borderRadius === 0 && borderJoinStyle !== 'miter') {
|
|
11899
|
+
clipSelf(ctx, element, endAngle);
|
|
11900
|
+
}
|
|
11711
11901
|
if (!fullCircles) {
|
|
11712
11902
|
pathArc(ctx, element, offset, spacing, endAngle, circular);
|
|
11713
11903
|
ctx.stroke();
|
|
@@ -11715,28 +11905,30 @@
|
|
|
11715
11905
|
}
|
|
11716
11906
|
var ArcElement = /*#__PURE__*/function (_Element3) {
|
|
11717
11907
|
function ArcElement(cfg) {
|
|
11718
|
-
var
|
|
11908
|
+
var _this21;
|
|
11719
11909
|
_classCallCheck$1(this, ArcElement);
|
|
11720
|
-
|
|
11721
|
-
_defineProperty$1(
|
|
11722
|
-
_defineProperty$1(
|
|
11723
|
-
_defineProperty$1(
|
|
11724
|
-
_defineProperty$1(
|
|
11725
|
-
_defineProperty$1(
|
|
11726
|
-
_defineProperty$1(
|
|
11727
|
-
_defineProperty$1(
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11910
|
+
_this21 = _callSuper(this, ArcElement);
|
|
11911
|
+
_defineProperty$1(_this21, "circumference", void 0);
|
|
11912
|
+
_defineProperty$1(_this21, "endAngle", void 0);
|
|
11913
|
+
_defineProperty$1(_this21, "fullCircles", void 0);
|
|
11914
|
+
_defineProperty$1(_this21, "innerRadius", void 0);
|
|
11915
|
+
_defineProperty$1(_this21, "outerRadius", void 0);
|
|
11916
|
+
_defineProperty$1(_this21, "pixelMargin", void 0);
|
|
11917
|
+
_defineProperty$1(_this21, "startAngle", void 0);
|
|
11918
|
+
_defineProperty$1(_this21, "circular", void 0);
|
|
11919
|
+
_this21.options = undefined;
|
|
11920
|
+
_this21.circumference = undefined;
|
|
11921
|
+
_this21.startAngle = undefined;
|
|
11922
|
+
_this21.endAngle = undefined;
|
|
11923
|
+
_this21.innerRadius = undefined;
|
|
11924
|
+
_this21.outerRadius = undefined;
|
|
11925
|
+
_this21.pixelMargin = 0;
|
|
11926
|
+
_this21.fullCircles = 0;
|
|
11927
|
+
_this21.circular = false;
|
|
11736
11928
|
if (cfg) {
|
|
11737
|
-
Object.assign(
|
|
11929
|
+
Object.assign(_this21, cfg);
|
|
11738
11930
|
}
|
|
11739
|
-
return
|
|
11931
|
+
return _this21;
|
|
11740
11932
|
}
|
|
11741
11933
|
_inherits$1(ArcElement, _Element3);
|
|
11742
11934
|
return _createClass$1(ArcElement, [{
|
|
@@ -11772,9 +11964,9 @@
|
|
|
11772
11964
|
endAngle = _this$getProps3.endAngle,
|
|
11773
11965
|
innerRadius = _this$getProps3.innerRadius,
|
|
11774
11966
|
outerRadius = _this$getProps3.outerRadius;
|
|
11775
|
-
var _this$
|
|
11776
|
-
offset = _this$
|
|
11777
|
-
spacing = _this$
|
|
11967
|
+
var _this$options11 = this.options,
|
|
11968
|
+
offset = _this$options11.offset,
|
|
11969
|
+
spacing = _this$options11.spacing;
|
|
11778
11970
|
var halfAngle = (startAngle + endAngle) / 2;
|
|
11779
11971
|
var halfRadius = (innerRadius + outerRadius + spacing + offset) / 2;
|
|
11780
11972
|
return {
|
|
@@ -11824,8 +12016,10 @@
|
|
|
11824
12016
|
borderWidth: 2,
|
|
11825
12017
|
offset: 0,
|
|
11826
12018
|
spacing: 0,
|
|
12019
|
+
spacingMode: 'angular',
|
|
11827
12020
|
angle: undefined,
|
|
11828
|
-
circular: true
|
|
12021
|
+
circular: true,
|
|
12022
|
+
selfJoin: false
|
|
11829
12023
|
});
|
|
11830
12024
|
_defineProperty$1(ArcElement, "defaultRoutes", {
|
|
11831
12025
|
backgroundColor: 'backgroundColor'
|
|
@@ -11991,11 +12185,11 @@
|
|
|
11991
12185
|
var segments = line.segments,
|
|
11992
12186
|
options = line.options;
|
|
11993
12187
|
var segmentMethod = _getSegmentMethod(line);
|
|
11994
|
-
var
|
|
11995
|
-
|
|
12188
|
+
var _iterator15 = _createForOfIteratorHelper$1(segments),
|
|
12189
|
+
_step15;
|
|
11996
12190
|
try {
|
|
11997
|
-
for (
|
|
11998
|
-
var segment =
|
|
12191
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
12192
|
+
var segment = _step15.value;
|
|
11999
12193
|
setStyle(ctx, options, segment.style);
|
|
12000
12194
|
ctx.beginPath();
|
|
12001
12195
|
if (segmentMethod(ctx, line, segment, {
|
|
@@ -12007,9 +12201,9 @@
|
|
|
12007
12201
|
ctx.stroke();
|
|
12008
12202
|
}
|
|
12009
12203
|
} catch (err) {
|
|
12010
|
-
|
|
12204
|
+
_iterator15.e(err);
|
|
12011
12205
|
} finally {
|
|
12012
|
-
|
|
12206
|
+
_iterator15.f();
|
|
12013
12207
|
}
|
|
12014
12208
|
}
|
|
12015
12209
|
var usePath2D = typeof Path2D === 'function';
|
|
@@ -12022,24 +12216,24 @@
|
|
|
12022
12216
|
}
|
|
12023
12217
|
var LineElement = /*#__PURE__*/function (_Element4) {
|
|
12024
12218
|
function LineElement(cfg) {
|
|
12025
|
-
var
|
|
12219
|
+
var _this22;
|
|
12026
12220
|
_classCallCheck$1(this, LineElement);
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12221
|
+
_this22 = _callSuper(this, LineElement);
|
|
12222
|
+
_this22.animated = true;
|
|
12223
|
+
_this22.options = undefined;
|
|
12224
|
+
_this22._chart = undefined;
|
|
12225
|
+
_this22._loop = undefined;
|
|
12226
|
+
_this22._fullLoop = undefined;
|
|
12227
|
+
_this22._path = undefined;
|
|
12228
|
+
_this22._points = undefined;
|
|
12229
|
+
_this22._segments = undefined;
|
|
12230
|
+
_this22._decimated = false;
|
|
12231
|
+
_this22._pointsUpdated = false;
|
|
12232
|
+
_this22._datasetIndex = undefined;
|
|
12039
12233
|
if (cfg) {
|
|
12040
|
-
Object.assign(
|
|
12234
|
+
Object.assign(_this22, cfg);
|
|
12041
12235
|
}
|
|
12042
|
-
return
|
|
12236
|
+
return _this22;
|
|
12043
12237
|
}
|
|
12044
12238
|
_inherits$1(LineElement, _Element4);
|
|
12045
12239
|
return _createClass$1(LineElement, [{
|
|
@@ -12131,20 +12325,20 @@
|
|
|
12131
12325
|
var loop = this._loop;
|
|
12132
12326
|
start = start || 0;
|
|
12133
12327
|
count = count || this.points.length - start;
|
|
12134
|
-
var
|
|
12135
|
-
|
|
12328
|
+
var _iterator16 = _createForOfIteratorHelper$1(segments),
|
|
12329
|
+
_step16;
|
|
12136
12330
|
try {
|
|
12137
|
-
for (
|
|
12138
|
-
var segment =
|
|
12331
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
12332
|
+
var segment = _step16.value;
|
|
12139
12333
|
loop &= segmentMethod(ctx, this, segment, {
|
|
12140
12334
|
start: start,
|
|
12141
12335
|
end: start + count - 1
|
|
12142
12336
|
});
|
|
12143
12337
|
}
|
|
12144
12338
|
} catch (err) {
|
|
12145
|
-
|
|
12339
|
+
_iterator16.e(err);
|
|
12146
12340
|
} finally {
|
|
12147
|
-
|
|
12341
|
+
_iterator16.f();
|
|
12148
12342
|
}
|
|
12149
12343
|
return !!loop;
|
|
12150
12344
|
}
|
|
@@ -12197,20 +12391,20 @@
|
|
|
12197
12391
|
}
|
|
12198
12392
|
var PointElement = /*#__PURE__*/function (_Element5) {
|
|
12199
12393
|
function PointElement(cfg) {
|
|
12200
|
-
var
|
|
12394
|
+
var _this23;
|
|
12201
12395
|
_classCallCheck$1(this, PointElement);
|
|
12202
|
-
|
|
12203
|
-
_defineProperty$1(
|
|
12204
|
-
_defineProperty$1(
|
|
12205
|
-
_defineProperty$1(
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12396
|
+
_this23 = _callSuper(this, PointElement);
|
|
12397
|
+
_defineProperty$1(_this23, "parsed", void 0);
|
|
12398
|
+
_defineProperty$1(_this23, "skip", void 0);
|
|
12399
|
+
_defineProperty$1(_this23, "stop", void 0);
|
|
12400
|
+
_this23.options = undefined;
|
|
12401
|
+
_this23.parsed = undefined;
|
|
12402
|
+
_this23.skip = undefined;
|
|
12403
|
+
_this23.stop = undefined;
|
|
12210
12404
|
if (cfg) {
|
|
12211
|
-
Object.assign(
|
|
12405
|
+
Object.assign(_this23, cfg);
|
|
12212
12406
|
}
|
|
12213
|
-
return
|
|
12407
|
+
return _this23;
|
|
12214
12408
|
}
|
|
12215
12409
|
_inherits$1(PointElement, _Element5);
|
|
12216
12410
|
return _createClass$1(PointElement, [{
|
|
@@ -12407,28 +12601,28 @@
|
|
|
12407
12601
|
}
|
|
12408
12602
|
var BarElement = /*#__PURE__*/function (_Element6) {
|
|
12409
12603
|
function BarElement(cfg) {
|
|
12410
|
-
var
|
|
12604
|
+
var _this24;
|
|
12411
12605
|
_classCallCheck$1(this, BarElement);
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12606
|
+
_this24 = _callSuper(this, BarElement);
|
|
12607
|
+
_this24.options = undefined;
|
|
12608
|
+
_this24.horizontal = undefined;
|
|
12609
|
+
_this24.base = undefined;
|
|
12610
|
+
_this24.width = undefined;
|
|
12611
|
+
_this24.height = undefined;
|
|
12612
|
+
_this24.inflateAmount = undefined;
|
|
12419
12613
|
if (cfg) {
|
|
12420
|
-
Object.assign(
|
|
12614
|
+
Object.assign(_this24, cfg);
|
|
12421
12615
|
}
|
|
12422
|
-
return
|
|
12616
|
+
return _this24;
|
|
12423
12617
|
}
|
|
12424
12618
|
_inherits$1(BarElement, _Element6);
|
|
12425
12619
|
return _createClass$1(BarElement, [{
|
|
12426
12620
|
key: "draw",
|
|
12427
12621
|
value: function draw(ctx) {
|
|
12428
12622
|
var inflateAmount = this.inflateAmount,
|
|
12429
|
-
_this$
|
|
12430
|
-
borderColor = _this$
|
|
12431
|
-
backgroundColor = _this$
|
|
12623
|
+
_this$options12 = this.options,
|
|
12624
|
+
borderColor = _this$options12.borderColor,
|
|
12625
|
+
backgroundColor = _this$options12.backgroundColor;
|
|
12432
12626
|
var _boundingRects = boundingRects(this),
|
|
12433
12627
|
inner = _boundingRects.inner,
|
|
12434
12628
|
outer = _boundingRects.outer;
|
|
@@ -12793,11 +12987,11 @@
|
|
|
12793
12987
|
var points = line.points;
|
|
12794
12988
|
var tpoints = target.points;
|
|
12795
12989
|
var parts = [];
|
|
12796
|
-
var
|
|
12797
|
-
|
|
12990
|
+
var _iterator17 = _createForOfIteratorHelper$1(segments),
|
|
12991
|
+
_step17;
|
|
12798
12992
|
try {
|
|
12799
|
-
for (
|
|
12800
|
-
var segment =
|
|
12993
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
12994
|
+
var segment = _step17.value;
|
|
12801
12995
|
var start = segment.start,
|
|
12802
12996
|
end = segment.end;
|
|
12803
12997
|
end = _findSegmentEnd(start, end, points);
|
|
@@ -12812,18 +13006,18 @@
|
|
|
12812
13006
|
continue;
|
|
12813
13007
|
}
|
|
12814
13008
|
var targetSegments = _boundSegments(target, bounds);
|
|
12815
|
-
var
|
|
12816
|
-
|
|
13009
|
+
var _iterator18 = _createForOfIteratorHelper$1(targetSegments),
|
|
13010
|
+
_step18;
|
|
12817
13011
|
try {
|
|
12818
|
-
for (
|
|
12819
|
-
var tgt =
|
|
13012
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
13013
|
+
var tgt = _step18.value;
|
|
12820
13014
|
var subBounds = _getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);
|
|
12821
13015
|
var fillSources = _boundSegment(segment, points, subBounds);
|
|
12822
|
-
var
|
|
12823
|
-
|
|
13016
|
+
var _iterator19 = _createForOfIteratorHelper$1(fillSources),
|
|
13017
|
+
_step19;
|
|
12824
13018
|
try {
|
|
12825
|
-
for (
|
|
12826
|
-
var fillSource =
|
|
13019
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
13020
|
+
var fillSource = _step19.value;
|
|
12827
13021
|
parts.push({
|
|
12828
13022
|
source: fillSource,
|
|
12829
13023
|
target: tgt,
|
|
@@ -12832,21 +13026,21 @@
|
|
|
12832
13026
|
});
|
|
12833
13027
|
}
|
|
12834
13028
|
} catch (err) {
|
|
12835
|
-
|
|
13029
|
+
_iterator19.e(err);
|
|
12836
13030
|
} finally {
|
|
12837
|
-
|
|
13031
|
+
_iterator19.f();
|
|
12838
13032
|
}
|
|
12839
13033
|
}
|
|
12840
13034
|
} catch (err) {
|
|
12841
|
-
|
|
13035
|
+
_iterator18.e(err);
|
|
12842
13036
|
} finally {
|
|
12843
|
-
|
|
13037
|
+
_iterator18.f();
|
|
12844
13038
|
}
|
|
12845
13039
|
}
|
|
12846
13040
|
} catch (err) {
|
|
12847
|
-
|
|
13041
|
+
_iterator17.e(err);
|
|
12848
13042
|
} finally {
|
|
12849
|
-
|
|
13043
|
+
_iterator17.f();
|
|
12850
13044
|
}
|
|
12851
13045
|
return parts;
|
|
12852
13046
|
}
|
|
@@ -13211,7 +13405,9 @@
|
|
|
13211
13405
|
}
|
|
13212
13406
|
function _drawfill(ctx, source, area) {
|
|
13213
13407
|
var target = _getTarget(source);
|
|
13214
|
-
var
|
|
13408
|
+
var chart = source.chart,
|
|
13409
|
+
index = source.index,
|
|
13410
|
+
line = source.line,
|
|
13215
13411
|
scale = source.scale,
|
|
13216
13412
|
axis = source.axis;
|
|
13217
13413
|
var lineOpts = line.options;
|
|
@@ -13222,8 +13418,10 @@
|
|
|
13222
13418
|
above = _ref9$above === void 0 ? color : _ref9$above,
|
|
13223
13419
|
_ref9$below = _ref9.below,
|
|
13224
13420
|
below = _ref9$below === void 0 ? color : _ref9$below;
|
|
13421
|
+
var meta = chart.getDatasetMeta(index);
|
|
13422
|
+
var clip = getDatasetClipArea(chart, meta);
|
|
13225
13423
|
if (target && line.points.length) {
|
|
13226
|
-
clipArea(ctx, area);
|
|
13424
|
+
clipArea(ctx, clipToIndexBounds(area, meta.iScale));
|
|
13227
13425
|
doFill(ctx, {
|
|
13228
13426
|
line: line,
|
|
13229
13427
|
target: target,
|
|
@@ -13231,43 +13429,120 @@
|
|
|
13231
13429
|
below: below,
|
|
13232
13430
|
area: area,
|
|
13233
13431
|
scale: scale,
|
|
13234
|
-
axis: axis
|
|
13432
|
+
axis: axis,
|
|
13433
|
+
clip: clip
|
|
13235
13434
|
});
|
|
13236
13435
|
unclipArea(ctx);
|
|
13237
13436
|
}
|
|
13238
13437
|
}
|
|
13438
|
+
function clipToIndexBounds(area, iScale) {
|
|
13439
|
+
if (!iScale || iScale.getPointPositionForValue) {
|
|
13440
|
+
return area;
|
|
13441
|
+
}
|
|
13442
|
+
var p1 = iScale.getPixelForValue(iScale.min);
|
|
13443
|
+
var p2 = iScale.getPixelForValue(iScale.max);
|
|
13444
|
+
var lo = Math.min(p1, p2);
|
|
13445
|
+
var hi = Math.max(p1, p2);
|
|
13446
|
+
return iScale.isHorizontal() ? _objectSpread2(_objectSpread2({}, area), {}, {
|
|
13447
|
+
left: Math.max(area.left, lo),
|
|
13448
|
+
right: Math.min(area.right, hi)
|
|
13449
|
+
}) : _objectSpread2(_objectSpread2({}, area), {}, {
|
|
13450
|
+
top: Math.max(area.top, lo),
|
|
13451
|
+
bottom: Math.min(area.bottom, hi)
|
|
13452
|
+
});
|
|
13453
|
+
}
|
|
13239
13454
|
function doFill(ctx, cfg) {
|
|
13240
13455
|
var line = cfg.line,
|
|
13241
13456
|
target = cfg.target,
|
|
13242
13457
|
above = cfg.above,
|
|
13243
13458
|
below = cfg.below,
|
|
13244
13459
|
area = cfg.area,
|
|
13245
|
-
scale = cfg.scale
|
|
13460
|
+
scale = cfg.scale,
|
|
13461
|
+
clip = cfg.clip;
|
|
13246
13462
|
var property = line._loop ? 'angle' : cfg.axis;
|
|
13247
13463
|
ctx.save();
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13464
|
+
var fillColor = below;
|
|
13465
|
+
if (below !== above) {
|
|
13466
|
+
if (property === 'x') {
|
|
13467
|
+
clipVertical(ctx, target, area.top);
|
|
13468
|
+
fill(ctx, {
|
|
13469
|
+
line: line,
|
|
13470
|
+
target: target,
|
|
13471
|
+
color: above,
|
|
13472
|
+
scale: scale,
|
|
13473
|
+
property: property,
|
|
13474
|
+
clip: clip
|
|
13475
|
+
});
|
|
13476
|
+
ctx.restore();
|
|
13477
|
+
ctx.save();
|
|
13478
|
+
clipVertical(ctx, target, area.bottom);
|
|
13479
|
+
} else if (property === 'y') {
|
|
13480
|
+
clipHorizontal(ctx, target, area.left);
|
|
13481
|
+
fill(ctx, {
|
|
13482
|
+
line: line,
|
|
13483
|
+
target: target,
|
|
13484
|
+
color: below,
|
|
13485
|
+
scale: scale,
|
|
13486
|
+
property: property,
|
|
13487
|
+
clip: clip
|
|
13488
|
+
});
|
|
13489
|
+
ctx.restore();
|
|
13490
|
+
ctx.save();
|
|
13491
|
+
clipHorizontal(ctx, target, area.right);
|
|
13492
|
+
fillColor = above;
|
|
13493
|
+
}
|
|
13260
13494
|
}
|
|
13261
13495
|
fill(ctx, {
|
|
13262
13496
|
line: line,
|
|
13263
13497
|
target: target,
|
|
13264
|
-
color:
|
|
13498
|
+
color: fillColor,
|
|
13265
13499
|
scale: scale,
|
|
13266
|
-
property: property
|
|
13500
|
+
property: property,
|
|
13501
|
+
clip: clip
|
|
13267
13502
|
});
|
|
13268
13503
|
ctx.restore();
|
|
13269
13504
|
}
|
|
13270
13505
|
function clipVertical(ctx, target, clipY) {
|
|
13506
|
+
var segments = target.segments,
|
|
13507
|
+
points = target.points;
|
|
13508
|
+
var first = true;
|
|
13509
|
+
var lineLoop = false;
|
|
13510
|
+
ctx.beginPath();
|
|
13511
|
+
var _iterator20 = _createForOfIteratorHelper$1(segments),
|
|
13512
|
+
_step20;
|
|
13513
|
+
try {
|
|
13514
|
+
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
|
13515
|
+
var segment = _step20.value;
|
|
13516
|
+
var start = segment.start,
|
|
13517
|
+
end = segment.end;
|
|
13518
|
+
var firstPoint = points[start];
|
|
13519
|
+
var lastPoint = points[_findSegmentEnd(start, end, points)];
|
|
13520
|
+
if (first) {
|
|
13521
|
+
ctx.moveTo(firstPoint.x, firstPoint.y);
|
|
13522
|
+
first = false;
|
|
13523
|
+
} else {
|
|
13524
|
+
ctx.lineTo(firstPoint.x, clipY);
|
|
13525
|
+
ctx.lineTo(firstPoint.x, firstPoint.y);
|
|
13526
|
+
}
|
|
13527
|
+
lineLoop = !!target.pathSegment(ctx, segment, {
|
|
13528
|
+
move: lineLoop
|
|
13529
|
+
});
|
|
13530
|
+
if (lineLoop) {
|
|
13531
|
+
ctx.closePath();
|
|
13532
|
+
} else {
|
|
13533
|
+
ctx.lineTo(lastPoint.x, clipY);
|
|
13534
|
+
}
|
|
13535
|
+
}
|
|
13536
|
+
} catch (err) {
|
|
13537
|
+
_iterator20.e(err);
|
|
13538
|
+
} finally {
|
|
13539
|
+
_iterator20.f();
|
|
13540
|
+
}
|
|
13541
|
+
ctx.lineTo(target.first().x, clipY);
|
|
13542
|
+
ctx.closePath();
|
|
13543
|
+
ctx.clip();
|
|
13544
|
+
}
|
|
13545
|
+
function clipHorizontal(ctx, target, clipX) {
|
|
13271
13546
|
var segments = target.segments,
|
|
13272
13547
|
points = target.points;
|
|
13273
13548
|
var first = true;
|
|
@@ -13286,7 +13561,7 @@
|
|
|
13286
13561
|
ctx.moveTo(firstPoint.x, firstPoint.y);
|
|
13287
13562
|
first = false;
|
|
13288
13563
|
} else {
|
|
13289
|
-
ctx.lineTo(firstPoint.
|
|
13564
|
+
ctx.lineTo(clipX, firstPoint.y);
|
|
13290
13565
|
ctx.lineTo(firstPoint.x, firstPoint.y);
|
|
13291
13566
|
}
|
|
13292
13567
|
lineLoop = !!target.pathSegment(ctx, segment, {
|
|
@@ -13295,7 +13570,7 @@
|
|
|
13295
13570
|
if (lineLoop) {
|
|
13296
13571
|
ctx.closePath();
|
|
13297
13572
|
} else {
|
|
13298
|
-
ctx.lineTo(lastPoint.
|
|
13573
|
+
ctx.lineTo(clipX, lastPoint.y);
|
|
13299
13574
|
}
|
|
13300
13575
|
}
|
|
13301
13576
|
} catch (err) {
|
|
@@ -13303,7 +13578,7 @@
|
|
|
13303
13578
|
} finally {
|
|
13304
13579
|
_iterator21.f();
|
|
13305
13580
|
}
|
|
13306
|
-
ctx.lineTo(target.first().
|
|
13581
|
+
ctx.lineTo(clipX, target.first().y);
|
|
13307
13582
|
ctx.closePath();
|
|
13308
13583
|
ctx.clip();
|
|
13309
13584
|
}
|
|
@@ -13312,7 +13587,8 @@
|
|
|
13312
13587
|
target = cfg.target,
|
|
13313
13588
|
property = cfg.property,
|
|
13314
13589
|
color = cfg.color,
|
|
13315
|
-
scale = cfg.scale
|
|
13590
|
+
scale = cfg.scale,
|
|
13591
|
+
clip = cfg.clip;
|
|
13316
13592
|
var segments = _segments(line, target, property);
|
|
13317
13593
|
var _iterator22 = _createForOfIteratorHelper$1(segments),
|
|
13318
13594
|
_step22;
|
|
@@ -13330,7 +13606,7 @@
|
|
|
13330
13606
|
var notShape = target !== true;
|
|
13331
13607
|
ctx.save();
|
|
13332
13608
|
ctx.fillStyle = backgroundColor;
|
|
13333
|
-
clipBounds(ctx, scale, notShape && _getBounds(property, start, end));
|
|
13609
|
+
clipBounds(ctx, scale, clip, notShape && _getBounds(property, start, end));
|
|
13334
13610
|
ctx.beginPath();
|
|
13335
13611
|
var lineLoop = !!line.pathSegment(ctx, src);
|
|
13336
13612
|
var loop = void 0;
|
|
@@ -13359,17 +13635,33 @@
|
|
|
13359
13635
|
_iterator22.f();
|
|
13360
13636
|
}
|
|
13361
13637
|
}
|
|
13362
|
-
function clipBounds(ctx, scale, bounds) {
|
|
13363
|
-
var
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13638
|
+
function clipBounds(ctx, scale, clip, bounds) {
|
|
13639
|
+
var chartArea = scale.chart.chartArea;
|
|
13640
|
+
var _ref0 = bounds || {},
|
|
13641
|
+
property = _ref0.property,
|
|
13642
|
+
start = _ref0.start,
|
|
13643
|
+
end = _ref0.end;
|
|
13644
|
+
if (property === 'x' || property === 'y') {
|
|
13645
|
+
var left, top, right, bottom;
|
|
13646
|
+
if (property === 'x') {
|
|
13647
|
+
left = start;
|
|
13648
|
+
top = chartArea.top;
|
|
13649
|
+
right = end;
|
|
13650
|
+
bottom = chartArea.bottom;
|
|
13651
|
+
} else {
|
|
13652
|
+
left = chartArea.left;
|
|
13653
|
+
top = start;
|
|
13654
|
+
right = chartArea.right;
|
|
13655
|
+
bottom = end;
|
|
13656
|
+
}
|
|
13371
13657
|
ctx.beginPath();
|
|
13372
|
-
|
|
13658
|
+
if (clip) {
|
|
13659
|
+
left = Math.max(left, clip.left);
|
|
13660
|
+
right = Math.min(right, clip.right);
|
|
13661
|
+
top = Math.max(top, clip.top);
|
|
13662
|
+
bottom = Math.min(bottom, clip.bottom);
|
|
13663
|
+
}
|
|
13664
|
+
ctx.rect(left, top, right - left, bottom - top);
|
|
13373
13665
|
ctx.clip();
|
|
13374
13666
|
}
|
|
13375
13667
|
}
|
|
@@ -13470,32 +13762,32 @@
|
|
|
13470
13762
|
};
|
|
13471
13763
|
var Legend = /*#__PURE__*/function (_Element7) {
|
|
13472
13764
|
function Legend(config) {
|
|
13473
|
-
var
|
|
13765
|
+
var _this25;
|
|
13474
13766
|
_classCallCheck$1(this, Legend);
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
return
|
|
13767
|
+
_this25 = _callSuper(this, Legend);
|
|
13768
|
+
_this25._added = false;
|
|
13769
|
+
_this25.legendHitBoxes = [];
|
|
13770
|
+
_this25._hoveredItem = null;
|
|
13771
|
+
_this25.doughnutMode = false;
|
|
13772
|
+
_this25.chart = config.chart;
|
|
13773
|
+
_this25.options = config.options;
|
|
13774
|
+
_this25.ctx = config.ctx;
|
|
13775
|
+
_this25.legendItems = undefined;
|
|
13776
|
+
_this25.columnSizes = undefined;
|
|
13777
|
+
_this25.lineWidths = undefined;
|
|
13778
|
+
_this25.maxHeight = undefined;
|
|
13779
|
+
_this25.maxWidth = undefined;
|
|
13780
|
+
_this25.top = undefined;
|
|
13781
|
+
_this25.bottom = undefined;
|
|
13782
|
+
_this25.left = undefined;
|
|
13783
|
+
_this25.right = undefined;
|
|
13784
|
+
_this25.height = undefined;
|
|
13785
|
+
_this25.width = undefined;
|
|
13786
|
+
_this25._margins = undefined;
|
|
13787
|
+
_this25.position = undefined;
|
|
13788
|
+
_this25.weight = undefined;
|
|
13789
|
+
_this25.fullSize = undefined;
|
|
13790
|
+
return _this25;
|
|
13499
13791
|
}
|
|
13500
13792
|
_inherits$1(Legend, _Element7);
|
|
13501
13793
|
return _createClass$1(Legend, [{
|
|
@@ -13524,17 +13816,17 @@
|
|
|
13524
13816
|
}, {
|
|
13525
13817
|
key: "buildLabels",
|
|
13526
13818
|
value: function buildLabels() {
|
|
13527
|
-
var
|
|
13819
|
+
var _this26 = this;
|
|
13528
13820
|
var labelOpts = this.options.labels || {};
|
|
13529
13821
|
var legendItems = callback(labelOpts.generateLabels, [this.chart], this) || [];
|
|
13530
13822
|
if (labelOpts.filter) {
|
|
13531
13823
|
legendItems = legendItems.filter(function (item) {
|
|
13532
|
-
return labelOpts.filter(item,
|
|
13824
|
+
return labelOpts.filter(item, _this26.chart.data);
|
|
13533
13825
|
});
|
|
13534
13826
|
}
|
|
13535
13827
|
if (labelOpts.sort) {
|
|
13536
13828
|
legendItems = legendItems.sort(function (a, b) {
|
|
13537
|
-
return labelOpts.sort(a, b,
|
|
13829
|
+
return labelOpts.sort(a, b, _this26.chart.data);
|
|
13538
13830
|
});
|
|
13539
13831
|
}
|
|
13540
13832
|
if (this.options.reverse) {
|
|
@@ -13656,10 +13948,10 @@
|
|
|
13656
13948
|
}
|
|
13657
13949
|
var titleHeight = this._computeTitleHeight();
|
|
13658
13950
|
var hitboxes = this.legendHitBoxes,
|
|
13659
|
-
_this$
|
|
13660
|
-
align = _this$
|
|
13661
|
-
padding = _this$
|
|
13662
|
-
rtl = _this$
|
|
13951
|
+
_this$options13 = this.options,
|
|
13952
|
+
align = _this$options13.align,
|
|
13953
|
+
padding = _this$options13.labels.padding,
|
|
13954
|
+
rtl = _this$options13.rtl;
|
|
13663
13955
|
var rtlHelper = getRtlAdapter(rtl, this.left, this.width);
|
|
13664
13956
|
if (this.isHorizontal()) {
|
|
13665
13957
|
var row = 0;
|
|
@@ -13724,7 +14016,7 @@
|
|
|
13724
14016
|
}, {
|
|
13725
14017
|
key: "_draw",
|
|
13726
14018
|
value: function _draw() {
|
|
13727
|
-
var
|
|
14019
|
+
var _this27 = this;
|
|
13728
14020
|
var opts = this.options,
|
|
13729
14021
|
columnSizes = this.columnSizes,
|
|
13730
14022
|
lineWidths = this.lineWidths,
|
|
@@ -13826,21 +14118,21 @@
|
|
|
13826
14118
|
var width = boxWidth + halfFontSize + textWidth;
|
|
13827
14119
|
var x = cursor.x;
|
|
13828
14120
|
var y = cursor.y;
|
|
13829
|
-
rtlHelper.setWidth(
|
|
14121
|
+
rtlHelper.setWidth(_this27.width);
|
|
13830
14122
|
if (isHorizontal) {
|
|
13831
|
-
if (i > 0 && x + width + padding >
|
|
14123
|
+
if (i > 0 && x + width + padding > _this27.right) {
|
|
13832
14124
|
y = cursor.y += lineHeight;
|
|
13833
14125
|
cursor.line++;
|
|
13834
|
-
x = cursor.x = _alignStartEnd(align,
|
|
14126
|
+
x = cursor.x = _alignStartEnd(align, _this27.left + padding, _this27.right - lineWidths[cursor.line]);
|
|
13835
14127
|
}
|
|
13836
|
-
} else if (i > 0 && y + lineHeight >
|
|
14128
|
+
} else if (i > 0 && y + lineHeight > _this27.bottom) {
|
|
13837
14129
|
x = cursor.x = x + columnSizes[cursor.line].width + padding;
|
|
13838
14130
|
cursor.line++;
|
|
13839
|
-
y = cursor.y = _alignStartEnd(align,
|
|
14131
|
+
y = cursor.y = _alignStartEnd(align, _this27.top + titleHeight + padding, _this27.bottom - columnSizes[cursor.line].height);
|
|
13840
14132
|
}
|
|
13841
14133
|
var realX = rtlHelper.x(x);
|
|
13842
14134
|
drawLegendBox(realX, y, legendItem);
|
|
13843
|
-
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width :
|
|
14135
|
+
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : _this27.right, opts.rtl);
|
|
13844
14136
|
fillText(rtlHelper.x(x), y, legendItem);
|
|
13845
14137
|
if (isHorizontal) {
|
|
13846
14138
|
cursor.x += width + padding;
|
|
@@ -14084,23 +14376,23 @@
|
|
|
14084
14376
|
};
|
|
14085
14377
|
var Title = /*#__PURE__*/function (_Element8) {
|
|
14086
14378
|
function Title(config) {
|
|
14087
|
-
var
|
|
14379
|
+
var _this28;
|
|
14088
14380
|
_classCallCheck$1(this, Title);
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
return
|
|
14381
|
+
_this28 = _callSuper(this, Title);
|
|
14382
|
+
_this28.chart = config.chart;
|
|
14383
|
+
_this28.options = config.options;
|
|
14384
|
+
_this28.ctx = config.ctx;
|
|
14385
|
+
_this28._padding = undefined;
|
|
14386
|
+
_this28.top = undefined;
|
|
14387
|
+
_this28.bottom = undefined;
|
|
14388
|
+
_this28.left = undefined;
|
|
14389
|
+
_this28.right = undefined;
|
|
14390
|
+
_this28.width = undefined;
|
|
14391
|
+
_this28.height = undefined;
|
|
14392
|
+
_this28.position = undefined;
|
|
14393
|
+
_this28.weight = undefined;
|
|
14394
|
+
_this28.fullSize = undefined;
|
|
14395
|
+
return _this28;
|
|
14104
14396
|
}
|
|
14105
14397
|
_inherits$1(Title, _Element8);
|
|
14106
14398
|
return _createClass$1(Title, [{
|
|
@@ -14619,37 +14911,37 @@
|
|
|
14619
14911
|
}
|
|
14620
14912
|
var Tooltip = /*#__PURE__*/function (_Element9) {
|
|
14621
14913
|
function Tooltip(config) {
|
|
14622
|
-
var
|
|
14914
|
+
var _this29;
|
|
14623
14915
|
_classCallCheck$1(this, Tooltip);
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14634
|
-
|
|
14635
|
-
|
|
14636
|
-
|
|
14637
|
-
|
|
14638
|
-
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
|
|
14642
|
-
|
|
14643
|
-
|
|
14644
|
-
|
|
14645
|
-
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
return
|
|
14916
|
+
_this29 = _callSuper(this, Tooltip);
|
|
14917
|
+
_this29.opacity = 0;
|
|
14918
|
+
_this29._active = [];
|
|
14919
|
+
_this29._eventPosition = undefined;
|
|
14920
|
+
_this29._size = undefined;
|
|
14921
|
+
_this29._cachedAnimations = undefined;
|
|
14922
|
+
_this29._tooltipItems = [];
|
|
14923
|
+
_this29.$animations = undefined;
|
|
14924
|
+
_this29.$context = undefined;
|
|
14925
|
+
_this29.chart = config.chart;
|
|
14926
|
+
_this29.options = config.options;
|
|
14927
|
+
_this29.dataPoints = undefined;
|
|
14928
|
+
_this29.title = undefined;
|
|
14929
|
+
_this29.beforeBody = undefined;
|
|
14930
|
+
_this29.body = undefined;
|
|
14931
|
+
_this29.afterBody = undefined;
|
|
14932
|
+
_this29.footer = undefined;
|
|
14933
|
+
_this29.xAlign = undefined;
|
|
14934
|
+
_this29.yAlign = undefined;
|
|
14935
|
+
_this29.x = undefined;
|
|
14936
|
+
_this29.y = undefined;
|
|
14937
|
+
_this29.height = undefined;
|
|
14938
|
+
_this29.width = undefined;
|
|
14939
|
+
_this29.caretX = undefined;
|
|
14940
|
+
_this29.caretY = undefined;
|
|
14941
|
+
_this29.labelColors = undefined;
|
|
14942
|
+
_this29.labelPointStyles = undefined;
|
|
14943
|
+
_this29.labelTextColors = undefined;
|
|
14944
|
+
return _this29;
|
|
14653
14945
|
}
|
|
14654
14946
|
_inherits$1(Tooltip, _Element9);
|
|
14655
14947
|
return _createClass$1(Tooltip, [{
|
|
@@ -14701,7 +14993,7 @@
|
|
|
14701
14993
|
}, {
|
|
14702
14994
|
key: "getBody",
|
|
14703
14995
|
value: function getBody(tooltipItems, options) {
|
|
14704
|
-
var
|
|
14996
|
+
var _this30 = this;
|
|
14705
14997
|
var callbacks = options.callbacks;
|
|
14706
14998
|
var bodyItems = [];
|
|
14707
14999
|
each(tooltipItems, function (context) {
|
|
@@ -14711,9 +15003,9 @@
|
|
|
14711
15003
|
after: []
|
|
14712
15004
|
};
|
|
14713
15005
|
var scoped = overrideCallbacks(callbacks, context);
|
|
14714
|
-
pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, 'beforeLabel',
|
|
14715
|
-
pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, 'label',
|
|
14716
|
-
pushOrConcat(bodyItem.after, splitNewlines(invokeCallbackWithFallback(scoped, 'afterLabel',
|
|
15006
|
+
pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, 'beforeLabel', _this30, context)));
|
|
15007
|
+
pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, 'label', _this30, context));
|
|
15008
|
+
pushOrConcat(bodyItem.after, splitNewlines(invokeCallbackWithFallback(scoped, 'afterLabel', _this30, context)));
|
|
14717
15009
|
bodyItems.push(bodyItem);
|
|
14718
15010
|
});
|
|
14719
15011
|
return bodyItems;
|
|
@@ -14739,7 +15031,7 @@
|
|
|
14739
15031
|
}, {
|
|
14740
15032
|
key: "_createItems",
|
|
14741
15033
|
value: function _createItems(options) {
|
|
14742
|
-
var
|
|
15034
|
+
var _this31 = this;
|
|
14743
15035
|
var active = this._active;
|
|
14744
15036
|
var data = this.chart.data;
|
|
14745
15037
|
var labelColors = [];
|
|
@@ -14762,9 +15054,9 @@
|
|
|
14762
15054
|
}
|
|
14763
15055
|
each(tooltipItems, function (context) {
|
|
14764
15056
|
var scoped = overrideCallbacks(options.callbacks, context);
|
|
14765
|
-
labelColors.push(invokeCallbackWithFallback(scoped, 'labelColor',
|
|
14766
|
-
labelPointStyles.push(invokeCallbackWithFallback(scoped, 'labelPointStyle',
|
|
14767
|
-
labelTextColors.push(invokeCallbackWithFallback(scoped, 'labelTextColor',
|
|
15057
|
+
labelColors.push(invokeCallbackWithFallback(scoped, 'labelColor', _this31, context));
|
|
15058
|
+
labelPointStyles.push(invokeCallbackWithFallback(scoped, 'labelPointStyle', _this31, context));
|
|
15059
|
+
labelTextColors.push(invokeCallbackWithFallback(scoped, 'labelTextColor', _this31, context));
|
|
14768
15060
|
});
|
|
14769
15061
|
this.labelColors = labelColors;
|
|
14770
15062
|
this.labelPointStyles = labelPointStyles;
|
|
@@ -15171,12 +15463,12 @@
|
|
|
15171
15463
|
}, {
|
|
15172
15464
|
key: "setActiveElements",
|
|
15173
15465
|
value: function setActiveElements(activeElements, eventPosition) {
|
|
15174
|
-
var
|
|
15466
|
+
var _this32 = this;
|
|
15175
15467
|
var lastActive = this._active;
|
|
15176
|
-
var active = activeElements.map(function (
|
|
15177
|
-
var datasetIndex =
|
|
15178
|
-
index =
|
|
15179
|
-
var meta =
|
|
15468
|
+
var active = activeElements.map(function (_ref1) {
|
|
15469
|
+
var datasetIndex = _ref1.datasetIndex,
|
|
15470
|
+
index = _ref1.index;
|
|
15471
|
+
var meta = _this32.chart.getDatasetMeta(datasetIndex);
|
|
15180
15472
|
if (!meta) {
|
|
15181
15473
|
throw new Error('Cannot find a dataset at index ' + datasetIndex);
|
|
15182
15474
|
}
|
|
@@ -15223,14 +15515,14 @@
|
|
|
15223
15515
|
}, {
|
|
15224
15516
|
key: "_getActiveElements",
|
|
15225
15517
|
value: function _getActiveElements(e, lastActive, replay, inChartArea) {
|
|
15226
|
-
var
|
|
15518
|
+
var _this33 = this;
|
|
15227
15519
|
var options = this.options;
|
|
15228
15520
|
if (e.type === 'mouseout') {
|
|
15229
15521
|
return [];
|
|
15230
15522
|
}
|
|
15231
15523
|
if (!inChartArea) {
|
|
15232
15524
|
return lastActive.filter(function (i) {
|
|
15233
|
-
return
|
|
15525
|
+
return _this33.chart.data.datasets[i.datasetIndex] && _this33.chart.getDatasetMeta(i.datasetIndex).controller.getParsed(i.index) !== undefined;
|
|
15234
15526
|
});
|
|
15235
15527
|
}
|
|
15236
15528
|
var active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay);
|
|
@@ -15415,13 +15707,13 @@
|
|
|
15415
15707
|
}
|
|
15416
15708
|
var CategoryScale = /*#__PURE__*/function (_Scale) {
|
|
15417
15709
|
function CategoryScale(cfg) {
|
|
15418
|
-
var
|
|
15710
|
+
var _this34;
|
|
15419
15711
|
_classCallCheck$1(this, CategoryScale);
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
return
|
|
15712
|
+
_this34 = _callSuper(this, CategoryScale, [cfg]);
|
|
15713
|
+
_this34._startValue = undefined;
|
|
15714
|
+
_this34._valueRange = 0;
|
|
15715
|
+
_this34._addedLabels = [];
|
|
15716
|
+
return _this34;
|
|
15425
15717
|
}
|
|
15426
15718
|
_inherits$1(CategoryScale, _Scale);
|
|
15427
15719
|
return _createClass$1(CategoryScale, [{
|
|
@@ -15652,9 +15944,9 @@
|
|
|
15652
15944
|
}
|
|
15653
15945
|
return ticks;
|
|
15654
15946
|
}
|
|
15655
|
-
function relativeLabelSize(value, minSpacing,
|
|
15656
|
-
var horizontal =
|
|
15657
|
-
minRotation =
|
|
15947
|
+
function relativeLabelSize(value, minSpacing, _ref10) {
|
|
15948
|
+
var horizontal = _ref10.horizontal,
|
|
15949
|
+
minRotation = _ref10.minRotation;
|
|
15658
15950
|
var rad = toRadians(minRotation);
|
|
15659
15951
|
var ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 0.001;
|
|
15660
15952
|
var length = 0.75 * minSpacing * ('' + value).length;
|
|
@@ -15662,15 +15954,15 @@
|
|
|
15662
15954
|
}
|
|
15663
15955
|
var LinearScaleBase = /*#__PURE__*/function (_Scale2) {
|
|
15664
15956
|
function LinearScaleBase(cfg) {
|
|
15665
|
-
var
|
|
15957
|
+
var _this35;
|
|
15666
15958
|
_classCallCheck$1(this, LinearScaleBase);
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
return
|
|
15959
|
+
_this35 = _callSuper(this, LinearScaleBase, [cfg]);
|
|
15960
|
+
_this35.start = undefined;
|
|
15961
|
+
_this35.end = undefined;
|
|
15962
|
+
_this35._startValue = undefined;
|
|
15963
|
+
_this35._endValue = undefined;
|
|
15964
|
+
_this35._valueRange = 0;
|
|
15965
|
+
return _this35;
|
|
15674
15966
|
}
|
|
15675
15967
|
_inherits$1(LinearScaleBase, _Scale2);
|
|
15676
15968
|
return _createClass$1(LinearScaleBase, [{
|
|
@@ -15874,9 +16166,9 @@
|
|
|
15874
16166
|
}
|
|
15875
16167
|
return Math.min(rangeExp, log10Floor(min));
|
|
15876
16168
|
}
|
|
15877
|
-
function generateTicks(generationOptions,
|
|
15878
|
-
var min =
|
|
15879
|
-
max =
|
|
16169
|
+
function generateTicks(generationOptions, _ref11) {
|
|
16170
|
+
var min = _ref11.min,
|
|
16171
|
+
max = _ref11.max;
|
|
15880
16172
|
min = finiteOrDefault(generationOptions.min, min);
|
|
15881
16173
|
var ticks = [];
|
|
15882
16174
|
var minExp = log10Floor(min);
|
|
@@ -15916,14 +16208,14 @@
|
|
|
15916
16208
|
}
|
|
15917
16209
|
var LogarithmicScale = /*#__PURE__*/function (_Scale3) {
|
|
15918
16210
|
function LogarithmicScale(cfg) {
|
|
15919
|
-
var
|
|
16211
|
+
var _this36;
|
|
15920
16212
|
_classCallCheck$1(this, LogarithmicScale);
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
return
|
|
16213
|
+
_this36 = _callSuper(this, LogarithmicScale, [cfg]);
|
|
16214
|
+
_this36.start = undefined;
|
|
16215
|
+
_this36.end = undefined;
|
|
16216
|
+
_this36._startValue = undefined;
|
|
16217
|
+
_this36._valueRange = 0;
|
|
16218
|
+
return _this36;
|
|
15927
16219
|
}
|
|
15928
16220
|
_inherits$1(LogarithmicScale, _Scale3);
|
|
15929
16221
|
return _createClass$1(LogarithmicScale, [{
|
|
@@ -16316,15 +16608,15 @@
|
|
|
16316
16608
|
}
|
|
16317
16609
|
var RadialLinearScale = /*#__PURE__*/function (_LinearScaleBase2) {
|
|
16318
16610
|
function RadialLinearScale(cfg) {
|
|
16319
|
-
var
|
|
16611
|
+
var _this37;
|
|
16320
16612
|
_classCallCheck$1(this, RadialLinearScale);
|
|
16321
|
-
|
|
16322
|
-
|
|
16323
|
-
|
|
16324
|
-
|
|
16325
|
-
|
|
16326
|
-
|
|
16327
|
-
return
|
|
16613
|
+
_this37 = _callSuper(this, RadialLinearScale, [cfg]);
|
|
16614
|
+
_this37.xCenter = undefined;
|
|
16615
|
+
_this37.yCenter = undefined;
|
|
16616
|
+
_this37.drawingArea = undefined;
|
|
16617
|
+
_this37._pointLabels = [];
|
|
16618
|
+
_this37._pointLabelItems = [];
|
|
16619
|
+
return _this37;
|
|
16328
16620
|
}
|
|
16329
16621
|
_inherits$1(RadialLinearScale, _LinearScaleBase2);
|
|
16330
16622
|
return _createClass$1(RadialLinearScale, [{
|
|
@@ -16355,13 +16647,13 @@
|
|
|
16355
16647
|
}, {
|
|
16356
16648
|
key: "generateTickLabels",
|
|
16357
16649
|
value: function generateTickLabels(ticks) {
|
|
16358
|
-
var
|
|
16650
|
+
var _this38 = this;
|
|
16359
16651
|
LinearScaleBase.prototype.generateTickLabels.call(this, ticks);
|
|
16360
16652
|
this._pointLabels = this.getLabels().map(function (value, index) {
|
|
16361
|
-
var label = callback(
|
|
16653
|
+
var label = callback(_this38.options.pointLabels.callback, [value, index], _this38);
|
|
16362
16654
|
return label || label === 0 ? label : '';
|
|
16363
16655
|
}).filter(function (v, i) {
|
|
16364
|
-
return
|
|
16656
|
+
return _this38.chart.getDataVisibility(i);
|
|
16365
16657
|
});
|
|
16366
16658
|
}
|
|
16367
16659
|
}, {
|
|
@@ -16457,9 +16749,9 @@
|
|
|
16457
16749
|
}, {
|
|
16458
16750
|
key: "drawBackground",
|
|
16459
16751
|
value: function drawBackground() {
|
|
16460
|
-
var _this$
|
|
16461
|
-
backgroundColor = _this$
|
|
16462
|
-
circular = _this$
|
|
16752
|
+
var _this$options14 = this.options,
|
|
16753
|
+
backgroundColor = _this$options14.backgroundColor,
|
|
16754
|
+
circular = _this$options14.grid.circular;
|
|
16463
16755
|
if (backgroundColor) {
|
|
16464
16756
|
var ctx = this.ctx;
|
|
16465
16757
|
ctx.save();
|
|
@@ -16474,7 +16766,7 @@
|
|
|
16474
16766
|
}, {
|
|
16475
16767
|
key: "drawGrid",
|
|
16476
16768
|
value: function drawGrid() {
|
|
16477
|
-
var
|
|
16769
|
+
var _this39 = this;
|
|
16478
16770
|
var ctx = this.ctx;
|
|
16479
16771
|
var opts = this.options;
|
|
16480
16772
|
var angleLines = opts.angleLines,
|
|
@@ -16487,12 +16779,12 @@
|
|
|
16487
16779
|
}
|
|
16488
16780
|
if (grid.display) {
|
|
16489
16781
|
this.ticks.forEach(function (tick, index) {
|
|
16490
|
-
if (index !== 0 || index === 0 &&
|
|
16491
|
-
offset =
|
|
16492
|
-
var context =
|
|
16782
|
+
if (index !== 0 || index === 0 && _this39.min < 0) {
|
|
16783
|
+
offset = _this39.getDistanceFromCenterForValue(tick.value);
|
|
16784
|
+
var context = _this39.getContext(index);
|
|
16493
16785
|
var optsAtIndex = grid.setContext(context);
|
|
16494
16786
|
var optsAtIndexBorder = border.setContext(context);
|
|
16495
|
-
drawRadiusLine(
|
|
16787
|
+
drawRadiusLine(_this39, optsAtIndex, offset, labelCount, optsAtIndexBorder);
|
|
16496
16788
|
}
|
|
16497
16789
|
});
|
|
16498
16790
|
}
|
|
@@ -16525,7 +16817,7 @@
|
|
|
16525
16817
|
}, {
|
|
16526
16818
|
key: "drawLabels",
|
|
16527
16819
|
value: function drawLabels() {
|
|
16528
|
-
var
|
|
16820
|
+
var _this40 = this;
|
|
16529
16821
|
var ctx = this.ctx;
|
|
16530
16822
|
var opts = this.options;
|
|
16531
16823
|
var tickOpts = opts.ticks;
|
|
@@ -16540,12 +16832,12 @@
|
|
|
16540
16832
|
ctx.textAlign = 'center';
|
|
16541
16833
|
ctx.textBaseline = 'middle';
|
|
16542
16834
|
this.ticks.forEach(function (tick, index) {
|
|
16543
|
-
if (index === 0 &&
|
|
16835
|
+
if (index === 0 && _this40.min >= 0 && !opts.reverse) {
|
|
16544
16836
|
return;
|
|
16545
16837
|
}
|
|
16546
|
-
var optsAtIndex = tickOpts.setContext(
|
|
16838
|
+
var optsAtIndex = tickOpts.setContext(_this40.getContext(index));
|
|
16547
16839
|
var tickFont = toFont(optsAtIndex.font);
|
|
16548
|
-
offset =
|
|
16840
|
+
offset = _this40.getDistanceFromCenterForValue(_this40.ticks[index].value);
|
|
16549
16841
|
if (optsAtIndex.showLabelBackdrop) {
|
|
16550
16842
|
ctx.font = tickFont.string;
|
|
16551
16843
|
width = ctx.measureText(tick.label).width;
|
|
@@ -16751,20 +17043,20 @@
|
|
|
16751
17043
|
}
|
|
16752
17044
|
var TimeScale = /*#__PURE__*/function (_Scale4) {
|
|
16753
17045
|
function TimeScale(props) {
|
|
16754
|
-
var
|
|
17046
|
+
var _this41;
|
|
16755
17047
|
_classCallCheck$1(this, TimeScale);
|
|
16756
|
-
|
|
16757
|
-
|
|
17048
|
+
_this41 = _callSuper(this, TimeScale, [props]);
|
|
17049
|
+
_this41._cache = {
|
|
16758
17050
|
data: [],
|
|
16759
17051
|
labels: [],
|
|
16760
17052
|
all: []
|
|
16761
17053
|
};
|
|
16762
|
-
|
|
16763
|
-
|
|
16764
|
-
|
|
16765
|
-
|
|
16766
|
-
|
|
16767
|
-
return
|
|
17054
|
+
_this41._unit = 'day';
|
|
17055
|
+
_this41._majorUnit = undefined;
|
|
17056
|
+
_this41._offsets = {};
|
|
17057
|
+
_this41._normalized = false;
|
|
17058
|
+
_this41._parseOpts = undefined;
|
|
17059
|
+
return _this41;
|
|
16768
17060
|
}
|
|
16769
17061
|
_inherits$1(TimeScale, _Scale4);
|
|
16770
17062
|
return _createClass$1(TimeScale, [{
|
|
@@ -17121,13 +17413,13 @@
|
|
|
17121
17413
|
}
|
|
17122
17414
|
var TimeSeriesScale = /*#__PURE__*/function (_TimeScale2) {
|
|
17123
17415
|
function TimeSeriesScale(props) {
|
|
17124
|
-
var
|
|
17416
|
+
var _this42;
|
|
17125
17417
|
_classCallCheck$1(this, TimeSeriesScale);
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
return
|
|
17418
|
+
_this42 = _callSuper(this, TimeSeriesScale, [props]);
|
|
17419
|
+
_this42._table = [];
|
|
17420
|
+
_this42._minPos = undefined;
|
|
17421
|
+
_this42._tableRange = undefined;
|
|
17422
|
+
return _this42;
|
|
17131
17423
|
}
|
|
17132
17424
|
_inherits$1(TimeSeriesScale, _TimeScale2);
|
|
17133
17425
|
return _createClass$1(TimeSeriesScale, [{
|
|
@@ -17314,6 +17606,7 @@
|
|
|
17314
17606
|
fontString: fontString,
|
|
17315
17607
|
formatNumber: formatNumber,
|
|
17316
17608
|
getAngleFromPoint: getAngleFromPoint,
|
|
17609
|
+
getDatasetClipArea: getDatasetClipArea,
|
|
17317
17610
|
getHoverColor: getHoverColor,
|
|
17318
17611
|
getMaximumSize: getMaximumSize,
|
|
17319
17612
|
getRelativePosition: getRelativePosition,
|
|
@@ -20931,15 +21224,15 @@
|
|
|
20931
21224
|
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
20932
21225
|
}
|
|
20933
21226
|
|
|
20934
|
-
function toPrimitive(t,
|
|
21227
|
+
function toPrimitive(t, e) {
|
|
20935
21228
|
if ("object" != _typeof(t) || !t) return t;
|
|
20936
|
-
var
|
|
20937
|
-
if (void 0 !==
|
|
20938
|
-
var i =
|
|
21229
|
+
var r;
|
|
21230
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
21231
|
+
var i = r.call(t, e || "default");
|
|
20939
21232
|
if ("object" != _typeof(i)) return i;
|
|
20940
21233
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
20941
21234
|
}
|
|
20942
|
-
return ("string" ===
|
|
21235
|
+
return ("string" === e ? String : Number)(t);
|
|
20943
21236
|
}
|
|
20944
21237
|
|
|
20945
21238
|
function toPropertyKey(t) {
|