chartkick 5.1.2 → 5.2.1
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 +21 -0
- data/README.md +19 -48
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +700 -494
- metadata +4 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Chart.js v4.
|
|
2
|
+
* Chart.js v4.5.1
|
|
3
3
|
* https://www.chartjs.org
|
|
4
|
-
* (c)
|
|
4
|
+
* (c) 2025 Chart.js Contributors
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*
|
|
7
7
|
* @kurkle/color v0.3.2
|
|
@@ -222,10 +222,10 @@
|
|
|
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) {
|
|
@@ -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.
|
|
@@ -3969,11 +3985,11 @@
|
|
|
3969
3985
|
start = e % count;
|
|
3970
3986
|
}
|
|
3971
3987
|
}
|
|
3972
|
-
var
|
|
3973
|
-
|
|
3988
|
+
var _iterator1 = _createForOfIteratorHelper$1(segments),
|
|
3989
|
+
_step1;
|
|
3974
3990
|
try {
|
|
3975
|
-
for (
|
|
3976
|
-
var segment =
|
|
3991
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
3992
|
+
var segment = _step1.value;
|
|
3977
3993
|
start = spanGaps ? start : segment.start;
|
|
3978
3994
|
var prev = points[start % count];
|
|
3979
3995
|
var style = void 0;
|
|
@@ -3998,9 +4014,9 @@
|
|
|
3998
4014
|
}
|
|
3999
4015
|
}
|
|
4000
4016
|
} catch (err) {
|
|
4001
|
-
|
|
4017
|
+
_iterator1.e(err);
|
|
4002
4018
|
} finally {
|
|
4003
|
-
|
|
4019
|
+
_iterator1.f();
|
|
4004
4020
|
}
|
|
4005
4021
|
return result;
|
|
4006
4022
|
}
|
|
@@ -4031,6 +4047,35 @@
|
|
|
4031
4047
|
};
|
|
4032
4048
|
return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);
|
|
4033
4049
|
}
|
|
4050
|
+
function getSizeForArea(scale, chartArea, field) {
|
|
4051
|
+
return scale.options.clip ? scale[field] : chartArea[field];
|
|
4052
|
+
}
|
|
4053
|
+
function getDatasetArea(meta, chartArea) {
|
|
4054
|
+
var xScale = meta.xScale,
|
|
4055
|
+
yScale = meta.yScale;
|
|
4056
|
+
if (xScale && yScale) {
|
|
4057
|
+
return {
|
|
4058
|
+
left: getSizeForArea(xScale, chartArea, 'left'),
|
|
4059
|
+
right: getSizeForArea(xScale, chartArea, 'right'),
|
|
4060
|
+
top: getSizeForArea(yScale, chartArea, 'top'),
|
|
4061
|
+
bottom: getSizeForArea(yScale, chartArea, 'bottom')
|
|
4062
|
+
};
|
|
4063
|
+
}
|
|
4064
|
+
return chartArea;
|
|
4065
|
+
}
|
|
4066
|
+
function getDatasetClipArea(chart, meta) {
|
|
4067
|
+
var clip = meta._clip;
|
|
4068
|
+
if (clip.disabled) {
|
|
4069
|
+
return false;
|
|
4070
|
+
}
|
|
4071
|
+
var area = getDatasetArea(meta, chart.chartArea);
|
|
4072
|
+
return {
|
|
4073
|
+
left: clip.left === false ? 0 : area.left - (clip.left === true ? 0 : clip.left),
|
|
4074
|
+
right: clip.right === false ? chart.width : area.right + (clip.right === true ? 0 : clip.right),
|
|
4075
|
+
top: clip.top === false ? 0 : area.top - (clip.top === true ? 0 : clip.top),
|
|
4076
|
+
bottom: clip.bottom === false ? chart.height : area.bottom + (clip.bottom === true ? 0 : clip.bottom)
|
|
4077
|
+
};
|
|
4078
|
+
}
|
|
4034
4079
|
|
|
4035
4080
|
var Animator = /*#__PURE__*/function () {
|
|
4036
4081
|
function Animator() {
|
|
@@ -5741,6 +5786,39 @@
|
|
|
5741
5786
|
value: function _getStackCount(index) {
|
|
5742
5787
|
return this._getStacks(undefined, index).length;
|
|
5743
5788
|
}
|
|
5789
|
+
}, {
|
|
5790
|
+
key: "_getAxisCount",
|
|
5791
|
+
value: function _getAxisCount() {
|
|
5792
|
+
return this._getAxis().length;
|
|
5793
|
+
}
|
|
5794
|
+
}, {
|
|
5795
|
+
key: "getFirstScaleIdForIndexAxis",
|
|
5796
|
+
value: function getFirstScaleIdForIndexAxis() {
|
|
5797
|
+
var scales = this.chart.scales;
|
|
5798
|
+
var indexScaleId = this.chart.options.indexAxis;
|
|
5799
|
+
return Object.keys(scales).filter(function (key) {
|
|
5800
|
+
return scales[key].axis === indexScaleId;
|
|
5801
|
+
}).shift();
|
|
5802
|
+
}
|
|
5803
|
+
}, {
|
|
5804
|
+
key: "_getAxis",
|
|
5805
|
+
value: function _getAxis() {
|
|
5806
|
+
var axis = {};
|
|
5807
|
+
var firstScaleAxisId = this.getFirstScaleIdForIndexAxis();
|
|
5808
|
+
var _iterator5 = _createForOfIteratorHelper$1(this.chart.data.datasets),
|
|
5809
|
+
_step5;
|
|
5810
|
+
try {
|
|
5811
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
5812
|
+
var dataset = _step5.value;
|
|
5813
|
+
axis[valueOrDefault(this.chart.options.indexAxis === 'x' ? dataset.xAxisID : dataset.yAxisID, firstScaleAxisId)] = true;
|
|
5814
|
+
}
|
|
5815
|
+
} catch (err) {
|
|
5816
|
+
_iterator5.e(err);
|
|
5817
|
+
} finally {
|
|
5818
|
+
_iterator5.f();
|
|
5819
|
+
}
|
|
5820
|
+
return Object.keys(axis);
|
|
5821
|
+
}
|
|
5744
5822
|
}, {
|
|
5745
5823
|
key: "_getStackIndex",
|
|
5746
5824
|
value: function _getStackIndex(datasetIndex, name, dataIndex) {
|
|
@@ -5845,10 +5923,13 @@
|
|
|
5845
5923
|
var skipNull = options.skipNull;
|
|
5846
5924
|
var maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);
|
|
5847
5925
|
var center, size;
|
|
5926
|
+
var axisCount = this._getAxisCount();
|
|
5848
5927
|
if (ruler.grouped) {
|
|
5849
5928
|
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
|
|
5929
|
+
var range = options.barThickness === 'flex' ? computeFlexCategoryTraits(index, ruler, options, stackCount * axisCount) : computeFitCategoryTraits(index, ruler, options, stackCount * axisCount);
|
|
5930
|
+
var axisID = this.chart.options.indexAxis === 'x' ? this.getDataset().xAxisID : this.getDataset().yAxisID;
|
|
5931
|
+
var axisNumber = this._getAxis().indexOf(valueOrDefault(axisID, this.getFirstScaleIdForIndexAxis()));
|
|
5932
|
+
var stackIndex = this._getStackIndex(this.index, this._cachedMeta.stack, skipNull ? index : undefined) + axisNumber;
|
|
5852
5933
|
center = range.start + range.chunk * stackIndex + range.chunk / 2;
|
|
5853
5934
|
size = Math.min(maxBarThickness, range.chunk * range.ratio);
|
|
5854
5935
|
} else {
|
|
@@ -6366,21 +6447,29 @@
|
|
|
6366
6447
|
labels: {
|
|
6367
6448
|
generateLabels: function generateLabels(chart) {
|
|
6368
6449
|
var data = chart.data;
|
|
6450
|
+
var _chart$legend$options2 = chart.legend.options.labels,
|
|
6451
|
+
pointStyle = _chart$legend$options2.pointStyle,
|
|
6452
|
+
textAlign = _chart$legend$options2.textAlign,
|
|
6453
|
+
color = _chart$legend$options2.color,
|
|
6454
|
+
useBorderRadius = _chart$legend$options2.useBorderRadius,
|
|
6455
|
+
borderRadius = _chart$legend$options2.borderRadius;
|
|
6369
6456
|
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
6457
|
return data.labels.map(function (label, i) {
|
|
6374
6458
|
var meta = chart.getDatasetMeta(0);
|
|
6375
6459
|
var style = meta.controller.getStyle(i);
|
|
6376
6460
|
return {
|
|
6377
6461
|
text: label,
|
|
6378
6462
|
fillStyle: style.backgroundColor,
|
|
6379
|
-
strokeStyle: style.borderColor,
|
|
6380
6463
|
fontColor: color,
|
|
6464
|
+
hidden: !chart.getDataVisibility(i),
|
|
6465
|
+
lineDash: style.borderDash,
|
|
6466
|
+
lineDashOffset: style.borderDashOffset,
|
|
6467
|
+
lineJoin: style.borderJoinStyle,
|
|
6381
6468
|
lineWidth: style.borderWidth,
|
|
6469
|
+
strokeStyle: style.borderColor,
|
|
6470
|
+
textAlign: textAlign,
|
|
6382
6471
|
pointStyle: pointStyle,
|
|
6383
|
-
|
|
6472
|
+
borderRadius: useBorderRadius && (borderRadius || style.borderRadius),
|
|
6384
6473
|
index: i
|
|
6385
6474
|
};
|
|
6386
6475
|
});
|
|
@@ -7081,10 +7170,24 @@
|
|
|
7081
7170
|
data = metaset.data,
|
|
7082
7171
|
_sorted = metaset._sorted;
|
|
7083
7172
|
var iScale = controller._cachedMeta.iScale;
|
|
7173
|
+
var spanGaps = metaset.dataset ? metaset.dataset.options ? metaset.dataset.options.spanGaps : null : null;
|
|
7084
7174
|
if (iScale && axis === iScale.axis && axis !== 'r' && _sorted && data.length) {
|
|
7085
7175
|
var lookupMethod = iScale._reversePixels ? _rlookupByKey : _lookupByKey;
|
|
7086
7176
|
if (!intersect) {
|
|
7087
|
-
|
|
7177
|
+
var result = lookupMethod(data, axis, value);
|
|
7178
|
+
if (spanGaps) {
|
|
7179
|
+
var vScale = controller._cachedMeta.vScale;
|
|
7180
|
+
var _parsed = metaset._parsed;
|
|
7181
|
+
var distanceToDefinedLo = _parsed.slice(0, result.lo + 1).reverse().findIndex(function (point) {
|
|
7182
|
+
return !isNullOrUndef(point[vScale.axis]);
|
|
7183
|
+
});
|
|
7184
|
+
result.lo -= Math.max(0, distanceToDefinedLo);
|
|
7185
|
+
var distanceToDefinedHi = _parsed.slice(result.hi).findIndex(function (point) {
|
|
7186
|
+
return !isNullOrUndef(point[vScale.axis]);
|
|
7187
|
+
});
|
|
7188
|
+
result.hi += Math.max(0, distanceToDefinedHi);
|
|
7189
|
+
}
|
|
7190
|
+
return result;
|
|
7088
7191
|
} else if (controller._sharedOptions) {
|
|
7089
7192
|
var el = data[0];
|
|
7090
7193
|
var range = typeof el.getRange === 'function' && el.getRange(axis);
|
|
@@ -7339,11 +7442,11 @@
|
|
|
7339
7442
|
}
|
|
7340
7443
|
function buildStacks(layouts) {
|
|
7341
7444
|
var stacks = {};
|
|
7342
|
-
var
|
|
7343
|
-
|
|
7445
|
+
var _iterator6 = _createForOfIteratorHelper$1(layouts),
|
|
7446
|
+
_step6;
|
|
7344
7447
|
try {
|
|
7345
|
-
for (
|
|
7346
|
-
var wrap =
|
|
7448
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
7449
|
+
var wrap = _step6.value;
|
|
7347
7450
|
var stack = wrap.stack,
|
|
7348
7451
|
pos = wrap.pos,
|
|
7349
7452
|
stackWeight = wrap.stackWeight;
|
|
@@ -7360,9 +7463,9 @@
|
|
|
7360
7463
|
_stack.weight += stackWeight;
|
|
7361
7464
|
}
|
|
7362
7465
|
} catch (err) {
|
|
7363
|
-
|
|
7466
|
+
_iterator6.e(err);
|
|
7364
7467
|
} finally {
|
|
7365
|
-
|
|
7468
|
+
_iterator6.f();
|
|
7366
7469
|
}
|
|
7367
7470
|
return stacks;
|
|
7368
7471
|
}
|
|
@@ -7506,11 +7609,11 @@
|
|
|
7506
7609
|
var userPadding = params.padding;
|
|
7507
7610
|
var x = chartArea.x,
|
|
7508
7611
|
y = chartArea.y;
|
|
7509
|
-
var
|
|
7510
|
-
|
|
7612
|
+
var _iterator7 = _createForOfIteratorHelper$1(boxes),
|
|
7613
|
+
_step7;
|
|
7511
7614
|
try {
|
|
7512
|
-
for (
|
|
7513
|
-
var layout =
|
|
7615
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
7616
|
+
var layout = _step7.value;
|
|
7514
7617
|
var box = layout.box;
|
|
7515
7618
|
var stack = stacks[layout.stack] || {
|
|
7516
7619
|
count: 1,
|
|
@@ -7549,9 +7652,9 @@
|
|
|
7549
7652
|
}
|
|
7550
7653
|
}
|
|
7551
7654
|
} catch (err) {
|
|
7552
|
-
|
|
7655
|
+
_iterator7.e(err);
|
|
7553
7656
|
} finally {
|
|
7554
|
-
|
|
7657
|
+
_iterator7.f();
|
|
7555
7658
|
}
|
|
7556
7659
|
chartArea.x = x;
|
|
7557
7660
|
chartArea.y = y;
|
|
@@ -7790,37 +7893,37 @@
|
|
|
7790
7893
|
};
|
|
7791
7894
|
}
|
|
7792
7895
|
function nodeListContains(nodeList, canvas) {
|
|
7793
|
-
var
|
|
7794
|
-
|
|
7896
|
+
var _iterator8 = _createForOfIteratorHelper$1(nodeList),
|
|
7897
|
+
_step8;
|
|
7795
7898
|
try {
|
|
7796
|
-
for (
|
|
7797
|
-
var node =
|
|
7899
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
7900
|
+
var node = _step8.value;
|
|
7798
7901
|
if (node === canvas || node.contains(canvas)) {
|
|
7799
7902
|
return true;
|
|
7800
7903
|
}
|
|
7801
7904
|
}
|
|
7802
7905
|
} catch (err) {
|
|
7803
|
-
|
|
7906
|
+
_iterator8.e(err);
|
|
7804
7907
|
} finally {
|
|
7805
|
-
|
|
7908
|
+
_iterator8.f();
|
|
7806
7909
|
}
|
|
7807
7910
|
}
|
|
7808
7911
|
function createAttachObserver(chart, type, listener) {
|
|
7809
7912
|
var canvas = chart.canvas;
|
|
7810
7913
|
var observer = new MutationObserver(function (entries) {
|
|
7811
7914
|
var trigger = false;
|
|
7812
|
-
var
|
|
7813
|
-
|
|
7915
|
+
var _iterator9 = _createForOfIteratorHelper$1(entries),
|
|
7916
|
+
_step9;
|
|
7814
7917
|
try {
|
|
7815
|
-
for (
|
|
7816
|
-
var entry =
|
|
7918
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
7919
|
+
var entry = _step9.value;
|
|
7817
7920
|
trigger = trigger || nodeListContains(entry.addedNodes, canvas);
|
|
7818
7921
|
trigger = trigger && !nodeListContains(entry.removedNodes, canvas);
|
|
7819
7922
|
}
|
|
7820
7923
|
} catch (err) {
|
|
7821
|
-
|
|
7924
|
+
_iterator9.e(err);
|
|
7822
7925
|
} finally {
|
|
7823
|
-
|
|
7926
|
+
_iterator9.f();
|
|
7824
7927
|
}
|
|
7825
7928
|
if (trigger) {
|
|
7826
7929
|
listener();
|
|
@@ -7836,18 +7939,18 @@
|
|
|
7836
7939
|
var canvas = chart.canvas;
|
|
7837
7940
|
var observer = new MutationObserver(function (entries) {
|
|
7838
7941
|
var trigger = false;
|
|
7839
|
-
var
|
|
7840
|
-
|
|
7942
|
+
var _iterator0 = _createForOfIteratorHelper$1(entries),
|
|
7943
|
+
_step0;
|
|
7841
7944
|
try {
|
|
7842
|
-
for (
|
|
7843
|
-
var entry =
|
|
7945
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
7946
|
+
var entry = _step0.value;
|
|
7844
7947
|
trigger = trigger || nodeListContains(entry.removedNodes, canvas);
|
|
7845
7948
|
trigger = trigger && !nodeListContains(entry.addedNodes, canvas);
|
|
7846
7949
|
}
|
|
7847
7950
|
} catch (err) {
|
|
7848
|
-
|
|
7951
|
+
_iterator0.e(err);
|
|
7849
7952
|
} finally {
|
|
7850
|
-
|
|
7953
|
+
_iterator0.f();
|
|
7851
7954
|
}
|
|
7852
7955
|
if (trigger) {
|
|
7853
7956
|
listener();
|
|
@@ -9454,9 +9557,9 @@
|
|
|
9454
9557
|
value: function drawBorder() {
|
|
9455
9558
|
var chart = this.chart,
|
|
9456
9559
|
ctx = this.ctx,
|
|
9457
|
-
_this$
|
|
9458
|
-
border = _this$
|
|
9459
|
-
grid = _this$
|
|
9560
|
+
_this$options0 = this.options,
|
|
9561
|
+
border = _this$options0.border,
|
|
9562
|
+
grid = _this$options0.grid;
|
|
9460
9563
|
var borderOpts = border.setContext(this.getContext());
|
|
9461
9564
|
var axisWidth = border.display ? borderOpts.width : 0;
|
|
9462
9565
|
if (!axisWidth) {
|
|
@@ -9496,11 +9599,11 @@
|
|
|
9496
9599
|
clipArea(ctx, area);
|
|
9497
9600
|
}
|
|
9498
9601
|
var items = this.getLabelItems(chartArea);
|
|
9499
|
-
var
|
|
9500
|
-
|
|
9602
|
+
var _iterator1 = _createForOfIteratorHelper$1(items),
|
|
9603
|
+
_step1;
|
|
9501
9604
|
try {
|
|
9502
|
-
for (
|
|
9503
|
-
var item =
|
|
9605
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
9606
|
+
var item = _step1.value;
|
|
9504
9607
|
var renderTextOptions = item.options;
|
|
9505
9608
|
var tickFont = item.font;
|
|
9506
9609
|
var label = item.label;
|
|
@@ -9508,9 +9611,9 @@
|
|
|
9508
9611
|
renderText(ctx, label, 0, y, tickFont, renderTextOptions);
|
|
9509
9612
|
}
|
|
9510
9613
|
} catch (err) {
|
|
9511
|
-
|
|
9614
|
+
_iterator1.e(err);
|
|
9512
9615
|
} finally {
|
|
9513
|
-
|
|
9616
|
+
_iterator1.f();
|
|
9514
9617
|
}
|
|
9515
9618
|
if (area) {
|
|
9516
9619
|
unclipArea(ctx);
|
|
@@ -9520,10 +9623,10 @@
|
|
|
9520
9623
|
key: "drawTitle",
|
|
9521
9624
|
value: function drawTitle() {
|
|
9522
9625
|
var ctx = this.ctx,
|
|
9523
|
-
_this$
|
|
9524
|
-
position = _this$
|
|
9525
|
-
title = _this$
|
|
9526
|
-
reverse = _this$
|
|
9626
|
+
_this$options1 = this.options,
|
|
9627
|
+
position = _this$options1.position,
|
|
9628
|
+
title = _this$options1.title,
|
|
9629
|
+
reverse = _this$options1.reverse;
|
|
9527
9630
|
if (!title.display) {
|
|
9528
9631
|
return;
|
|
9529
9632
|
}
|
|
@@ -9568,7 +9671,7 @@
|
|
|
9568
9671
|
}, {
|
|
9569
9672
|
key: "_layers",
|
|
9570
9673
|
value: function _layers() {
|
|
9571
|
-
var
|
|
9674
|
+
var _this0 = this;
|
|
9572
9675
|
var opts = this.options;
|
|
9573
9676
|
var tz = opts.ticks && opts.ticks.z || 0;
|
|
9574
9677
|
var gz = valueOrDefault(opts.grid && opts.grid.z, -1);
|
|
@@ -9577,26 +9680,26 @@
|
|
|
9577
9680
|
return [{
|
|
9578
9681
|
z: tz,
|
|
9579
9682
|
draw: function draw(chartArea) {
|
|
9580
|
-
|
|
9683
|
+
_this0.draw(chartArea);
|
|
9581
9684
|
}
|
|
9582
9685
|
}];
|
|
9583
9686
|
}
|
|
9584
9687
|
return [{
|
|
9585
9688
|
z: gz,
|
|
9586
9689
|
draw: function draw(chartArea) {
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9690
|
+
_this0.drawBackground();
|
|
9691
|
+
_this0.drawGrid(chartArea);
|
|
9692
|
+
_this0.drawTitle();
|
|
9590
9693
|
}
|
|
9591
9694
|
}, {
|
|
9592
9695
|
z: bz,
|
|
9593
9696
|
draw: function draw() {
|
|
9594
|
-
|
|
9697
|
+
_this0.drawBorder();
|
|
9595
9698
|
}
|
|
9596
9699
|
}, {
|
|
9597
9700
|
z: tz,
|
|
9598
9701
|
draw: function draw(chartArea) {
|
|
9599
|
-
|
|
9702
|
+
_this0.drawLabels(chartArea);
|
|
9600
9703
|
}
|
|
9601
9704
|
}];
|
|
9602
9705
|
}
|
|
@@ -9817,23 +9920,23 @@
|
|
|
9817
9920
|
}, {
|
|
9818
9921
|
key: "removeScales",
|
|
9819
9922
|
value: function removeScales() {
|
|
9820
|
-
for (var
|
|
9821
|
-
args[
|
|
9923
|
+
for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
|
9924
|
+
args[_key0] = arguments[_key0];
|
|
9822
9925
|
}
|
|
9823
9926
|
this._each('unregister', args, this.scales);
|
|
9824
9927
|
}
|
|
9825
9928
|
}, {
|
|
9826
9929
|
key: "_each",
|
|
9827
9930
|
value: function _each(method, args, typedRegistry) {
|
|
9828
|
-
var
|
|
9931
|
+
var _this1 = this;
|
|
9829
9932
|
_toConsumableArray(args).forEach(function (arg) {
|
|
9830
|
-
var reg = typedRegistry ||
|
|
9831
|
-
if (typedRegistry || reg.isForType(arg) || reg ===
|
|
9832
|
-
|
|
9933
|
+
var reg = typedRegistry || _this1._getRegistryForType(arg);
|
|
9934
|
+
if (typedRegistry || reg.isForType(arg) || reg === _this1.plugins && arg.id) {
|
|
9935
|
+
_this1._exec(method, reg, arg);
|
|
9833
9936
|
} else {
|
|
9834
9937
|
each(arg, function (item) {
|
|
9835
|
-
var itemReg = typedRegistry ||
|
|
9836
|
-
|
|
9938
|
+
var itemReg = typedRegistry || _this1._getRegistryForType(item);
|
|
9939
|
+
_this1._exec(method, itemReg, item);
|
|
9837
9940
|
});
|
|
9838
9941
|
}
|
|
9839
9942
|
});
|
|
@@ -9872,7 +9975,7 @@
|
|
|
9872
9975
|
var PluginService = /*#__PURE__*/function () {
|
|
9873
9976
|
function PluginService() {
|
|
9874
9977
|
_classCallCheck$1(this, PluginService);
|
|
9875
|
-
this._init =
|
|
9978
|
+
this._init = undefined;
|
|
9876
9979
|
}
|
|
9877
9980
|
return _createClass$1(PluginService, [{
|
|
9878
9981
|
key: "notify",
|
|
@@ -9881,11 +9984,15 @@
|
|
|
9881
9984
|
this._init = this._createDescriptors(chart, true);
|
|
9882
9985
|
this._notify(this._init, chart, 'install');
|
|
9883
9986
|
}
|
|
9987
|
+
if (this._init === undefined) {
|
|
9988
|
+
return;
|
|
9989
|
+
}
|
|
9884
9990
|
var descriptors = filter ? this._descriptors(chart).filter(filter) : this._descriptors(chart);
|
|
9885
9991
|
var result = this._notify(descriptors, chart, hook, args);
|
|
9886
9992
|
if (hook === 'afterDestroy') {
|
|
9887
9993
|
this._notify(descriptors, chart, 'stop');
|
|
9888
9994
|
this._notify(this._init, chart, 'uninstall');
|
|
9995
|
+
this._init = undefined;
|
|
9889
9996
|
}
|
|
9890
9997
|
return result;
|
|
9891
9998
|
}
|
|
@@ -9893,11 +10000,11 @@
|
|
|
9893
10000
|
key: "_notify",
|
|
9894
10001
|
value: function _notify(descriptors, chart, hook, args) {
|
|
9895
10002
|
args = args || {};
|
|
9896
|
-
var
|
|
9897
|
-
|
|
10003
|
+
var _iterator10 = _createForOfIteratorHelper$1(descriptors),
|
|
10004
|
+
_step10;
|
|
9898
10005
|
try {
|
|
9899
|
-
for (
|
|
9900
|
-
var descriptor =
|
|
10006
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
10007
|
+
var descriptor = _step10.value;
|
|
9901
10008
|
var plugin = descriptor.plugin;
|
|
9902
10009
|
var method = plugin[hook];
|
|
9903
10010
|
var params = [chart, args, descriptor.options];
|
|
@@ -9906,9 +10013,9 @@
|
|
|
9906
10013
|
}
|
|
9907
10014
|
}
|
|
9908
10015
|
} catch (err) {
|
|
9909
|
-
|
|
10016
|
+
_iterator10.e(err);
|
|
9910
10017
|
} finally {
|
|
9911
|
-
|
|
10018
|
+
_iterator10.f();
|
|
9912
10019
|
}
|
|
9913
10020
|
return true;
|
|
9914
10021
|
}
|
|
@@ -9989,11 +10096,11 @@
|
|
|
9989
10096
|
localIds = _ref2.localIds;
|
|
9990
10097
|
var result = [];
|
|
9991
10098
|
var context = chart.getContext();
|
|
9992
|
-
var
|
|
9993
|
-
|
|
10099
|
+
var _iterator11 = _createForOfIteratorHelper$1(plugins),
|
|
10100
|
+
_step11;
|
|
9994
10101
|
try {
|
|
9995
|
-
for (
|
|
9996
|
-
var plugin =
|
|
10102
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
10103
|
+
var plugin = _step11.value;
|
|
9997
10104
|
var id = plugin.id;
|
|
9998
10105
|
var opts = getOpts(options[id], all);
|
|
9999
10106
|
if (opts === null) {
|
|
@@ -10008,9 +10115,9 @@
|
|
|
10008
10115
|
});
|
|
10009
10116
|
}
|
|
10010
10117
|
} catch (err) {
|
|
10011
|
-
|
|
10118
|
+
_iterator11.e(err);
|
|
10012
10119
|
} finally {
|
|
10013
|
-
|
|
10120
|
+
_iterator11.f();
|
|
10014
10121
|
}
|
|
10015
10122
|
return result;
|
|
10016
10123
|
}
|
|
@@ -10062,8 +10169,8 @@
|
|
|
10062
10169
|
if (idMatchesAxis(id)) {
|
|
10063
10170
|
return id;
|
|
10064
10171
|
}
|
|
10065
|
-
for (var
|
|
10066
|
-
scaleOptions[
|
|
10172
|
+
for (var _len1 = arguments.length, scaleOptions = new Array(_len1 > 1 ? _len1 - 1 : 0), _key1 = 1; _key1 < _len1; _key1++) {
|
|
10173
|
+
scaleOptions[_key1 - 1] = arguments[_key1];
|
|
10067
10174
|
}
|
|
10068
10175
|
for (var _i3 = 0, _scaleOptions = scaleOptions; _i3 < _scaleOptions.length; _i3++) {
|
|
10069
10176
|
var opts = _scaleOptions[_i3];
|
|
@@ -10329,17 +10436,17 @@
|
|
|
10329
10436
|
var subResolver = this.createResolver(scopes, context, subPrefixes);
|
|
10330
10437
|
options = _attachContext(resolver, context, subResolver);
|
|
10331
10438
|
}
|
|
10332
|
-
var
|
|
10333
|
-
|
|
10439
|
+
var _iterator12 = _createForOfIteratorHelper$1(names),
|
|
10440
|
+
_step12;
|
|
10334
10441
|
try {
|
|
10335
|
-
for (
|
|
10336
|
-
var prop =
|
|
10442
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
10443
|
+
var prop = _step12.value;
|
|
10337
10444
|
result[prop] = options[prop];
|
|
10338
10445
|
}
|
|
10339
10446
|
} catch (err) {
|
|
10340
|
-
|
|
10447
|
+
_iterator12.e(err);
|
|
10341
10448
|
} finally {
|
|
10342
|
-
|
|
10449
|
+
_iterator12.f();
|
|
10343
10450
|
}
|
|
10344
10451
|
return result;
|
|
10345
10452
|
}
|
|
@@ -10383,11 +10490,11 @@
|
|
|
10383
10490
|
var _descriptors2 = _descriptors(proxy),
|
|
10384
10491
|
isScriptable = _descriptors2.isScriptable,
|
|
10385
10492
|
isIndexable = _descriptors2.isIndexable;
|
|
10386
|
-
var
|
|
10387
|
-
|
|
10493
|
+
var _iterator13 = _createForOfIteratorHelper$1(names),
|
|
10494
|
+
_step13;
|
|
10388
10495
|
try {
|
|
10389
|
-
for (
|
|
10390
|
-
var prop =
|
|
10496
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
10497
|
+
var prop = _step13.value;
|
|
10391
10498
|
var scriptable = isScriptable(prop);
|
|
10392
10499
|
var indexable = isIndexable(prop);
|
|
10393
10500
|
var value = (indexable || scriptable) && proxy[prop];
|
|
@@ -10396,13 +10503,13 @@
|
|
|
10396
10503
|
}
|
|
10397
10504
|
}
|
|
10398
10505
|
} catch (err) {
|
|
10399
|
-
|
|
10506
|
+
_iterator13.e(err);
|
|
10400
10507
|
} finally {
|
|
10401
|
-
|
|
10508
|
+
_iterator13.f();
|
|
10402
10509
|
}
|
|
10403
10510
|
return false;
|
|
10404
10511
|
}
|
|
10405
|
-
var version = "4.
|
|
10512
|
+
var version = "4.5.1";
|
|
10406
10513
|
var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
|
|
10407
10514
|
function positionIsHorizontal(position, axis) {
|
|
10408
10515
|
return position === 'top' || position === 'bottom' || KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x';
|
|
@@ -10464,25 +10571,9 @@
|
|
|
10464
10571
|
}
|
|
10465
10572
|
return e;
|
|
10466
10573
|
}
|
|
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
10574
|
var Chart = /*#__PURE__*/function () {
|
|
10484
10575
|
function Chart(item, userConfig) {
|
|
10485
|
-
var
|
|
10576
|
+
var _this10 = this;
|
|
10486
10577
|
_classCallCheck$1(this, Chart);
|
|
10487
10578
|
var config = this.config = new Config(userConfig);
|
|
10488
10579
|
var initialCanvas = getCanvas(item);
|
|
@@ -10523,7 +10614,7 @@
|
|
|
10523
10614
|
this._animationsDisabled = undefined;
|
|
10524
10615
|
this.$context = undefined;
|
|
10525
10616
|
this._doResize = debounce(function (mode) {
|
|
10526
|
-
return
|
|
10617
|
+
return _this10.update(mode);
|
|
10527
10618
|
}, options.resizeDelay || 0);
|
|
10528
10619
|
this._dataChanges = [];
|
|
10529
10620
|
instances[this.id] = this;
|
|
@@ -10541,9 +10632,9 @@
|
|
|
10541
10632
|
return _createClass$1(Chart, [{
|
|
10542
10633
|
key: "aspectRatio",
|
|
10543
10634
|
get: function get() {
|
|
10544
|
-
var _this$
|
|
10545
|
-
aspectRatio = _this$
|
|
10546
|
-
maintainAspectRatio = _this$
|
|
10635
|
+
var _this$options10 = this.options,
|
|
10636
|
+
aspectRatio = _this$options10.aspectRatio,
|
|
10637
|
+
maintainAspectRatio = _this$options10.maintainAspectRatio,
|
|
10547
10638
|
width = this.width,
|
|
10548
10639
|
height = this.height,
|
|
10549
10640
|
_aspectRatio = this._aspectRatio;
|
|
@@ -10650,7 +10741,7 @@
|
|
|
10650
10741
|
}, {
|
|
10651
10742
|
key: "buildOrUpdateScales",
|
|
10652
10743
|
value: function buildOrUpdateScales() {
|
|
10653
|
-
var
|
|
10744
|
+
var _this11 = this;
|
|
10654
10745
|
var options = this.options;
|
|
10655
10746
|
var scaleOpts = options.scales;
|
|
10656
10747
|
var scales = this.scales;
|
|
@@ -10689,8 +10780,8 @@
|
|
|
10689
10780
|
scale = new scaleClass({
|
|
10690
10781
|
id: id,
|
|
10691
10782
|
type: scaleType,
|
|
10692
|
-
ctx:
|
|
10693
|
-
chart:
|
|
10783
|
+
ctx: _this11.ctx,
|
|
10784
|
+
chart: _this11
|
|
10694
10785
|
});
|
|
10695
10786
|
scales[scale.id] = scale;
|
|
10696
10787
|
}
|
|
@@ -10702,8 +10793,8 @@
|
|
|
10702
10793
|
}
|
|
10703
10794
|
});
|
|
10704
10795
|
each(scales, function (scale) {
|
|
10705
|
-
layouts.configure(
|
|
10706
|
-
layouts.addBox(
|
|
10796
|
+
layouts.configure(_this11, scale, scale.options);
|
|
10797
|
+
layouts.addBox(_this11, scale);
|
|
10707
10798
|
});
|
|
10708
10799
|
}
|
|
10709
10800
|
}, {
|
|
@@ -10726,7 +10817,7 @@
|
|
|
10726
10817
|
}, {
|
|
10727
10818
|
key: "_removeUnreferencedMetasets",
|
|
10728
10819
|
value: function _removeUnreferencedMetasets() {
|
|
10729
|
-
var
|
|
10820
|
+
var _this12 = this;
|
|
10730
10821
|
var metasets = this._metasets,
|
|
10731
10822
|
datasets = this.data.datasets;
|
|
10732
10823
|
if (metasets.length > datasets.length) {
|
|
@@ -10736,7 +10827,7 @@
|
|
|
10736
10827
|
if (datasets.filter(function (x) {
|
|
10737
10828
|
return x === meta._dataset;
|
|
10738
10829
|
}).length === 0) {
|
|
10739
|
-
|
|
10830
|
+
_this12._destroyDatasetMeta(index);
|
|
10740
10831
|
}
|
|
10741
10832
|
});
|
|
10742
10833
|
}
|
|
@@ -10783,9 +10874,9 @@
|
|
|
10783
10874
|
}, {
|
|
10784
10875
|
key: "_resetElements",
|
|
10785
10876
|
value: function _resetElements() {
|
|
10786
|
-
var
|
|
10877
|
+
var _this13 = this;
|
|
10787
10878
|
each(this.data.datasets, function (dataset, datasetIndex) {
|
|
10788
|
-
|
|
10879
|
+
_this13.getDatasetMeta(datasetIndex).controller.reset();
|
|
10789
10880
|
}, this);
|
|
10790
10881
|
}
|
|
10791
10882
|
}, {
|
|
@@ -10845,9 +10936,9 @@
|
|
|
10845
10936
|
}, {
|
|
10846
10937
|
key: "_updateScales",
|
|
10847
10938
|
value: function _updateScales() {
|
|
10848
|
-
var
|
|
10939
|
+
var _this14 = this;
|
|
10849
10940
|
each(this.scales, function (scale) {
|
|
10850
|
-
layouts.removeBox(
|
|
10941
|
+
layouts.removeBox(_this14, scale);
|
|
10851
10942
|
});
|
|
10852
10943
|
this.ensureScalesHaveIDs();
|
|
10853
10944
|
this.buildOrUpdateScales();
|
|
@@ -10868,21 +10959,21 @@
|
|
|
10868
10959
|
value: function _updateHiddenIndices() {
|
|
10869
10960
|
var _hiddenIndices = this._hiddenIndices;
|
|
10870
10961
|
var changes = this._getUniformDataChanges() || [];
|
|
10871
|
-
var
|
|
10872
|
-
|
|
10962
|
+
var _iterator14 = _createForOfIteratorHelper$1(changes),
|
|
10963
|
+
_step14;
|
|
10873
10964
|
try {
|
|
10874
|
-
for (
|
|
10875
|
-
var
|
|
10876
|
-
method =
|
|
10877
|
-
start =
|
|
10878
|
-
count =
|
|
10965
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
10966
|
+
var _step14$value = _step14.value,
|
|
10967
|
+
method = _step14$value.method,
|
|
10968
|
+
start = _step14$value.start,
|
|
10969
|
+
count = _step14$value.count;
|
|
10879
10970
|
var move = method === '_removeElements' ? -count : count;
|
|
10880
10971
|
moveNumericKeys(_hiddenIndices, start, move);
|
|
10881
10972
|
}
|
|
10882
10973
|
} catch (err) {
|
|
10883
|
-
|
|
10974
|
+
_iterator14.e(err);
|
|
10884
10975
|
} finally {
|
|
10885
|
-
|
|
10976
|
+
_iterator14.f();
|
|
10886
10977
|
}
|
|
10887
10978
|
}
|
|
10888
10979
|
}, {
|
|
@@ -10920,7 +11011,7 @@
|
|
|
10920
11011
|
}, {
|
|
10921
11012
|
key: "_updateLayout",
|
|
10922
11013
|
value: function _updateLayout(minPadding) {
|
|
10923
|
-
var
|
|
11014
|
+
var _this15 = this;
|
|
10924
11015
|
if (this.notifyPlugins('beforeLayout', {
|
|
10925
11016
|
cancelable: true
|
|
10926
11017
|
}) === false) {
|
|
@@ -10931,14 +11022,14 @@
|
|
|
10931
11022
|
var noArea = area.width <= 0 || area.height <= 0;
|
|
10932
11023
|
this._layers = [];
|
|
10933
11024
|
each(this.boxes, function (box) {
|
|
10934
|
-
var
|
|
11025
|
+
var _this15$_layers;
|
|
10935
11026
|
if (noArea && box.position === 'chartArea') {
|
|
10936
11027
|
return;
|
|
10937
11028
|
}
|
|
10938
11029
|
if (box.configure) {
|
|
10939
11030
|
box.configure();
|
|
10940
11031
|
}
|
|
10941
|
-
(
|
|
11032
|
+
(_this15$_layers = _this15._layers).push.apply(_this15$_layers, _toConsumableArray(box._layers()));
|
|
10942
11033
|
}, this);
|
|
10943
11034
|
this._layers.forEach(function (item, index) {
|
|
10944
11035
|
item._idx = index;
|
|
@@ -11069,27 +11160,20 @@
|
|
|
11069
11160
|
key: "_drawDataset",
|
|
11070
11161
|
value: function _drawDataset(meta) {
|
|
11071
11162
|
var ctx = this.ctx;
|
|
11072
|
-
var clip = meta._clip;
|
|
11073
|
-
var useClip = !clip.disabled;
|
|
11074
|
-
var area = getDatasetArea(meta, this.chartArea);
|
|
11075
11163
|
var args = {
|
|
11076
11164
|
meta: meta,
|
|
11077
11165
|
index: meta.index,
|
|
11078
11166
|
cancelable: true
|
|
11079
11167
|
};
|
|
11168
|
+
var clip = getDatasetClipArea(this, meta);
|
|
11080
11169
|
if (this.notifyPlugins('beforeDatasetDraw', args) === false) {
|
|
11081
11170
|
return;
|
|
11082
11171
|
}
|
|
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
|
-
});
|
|
11172
|
+
if (clip) {
|
|
11173
|
+
clipArea(ctx, clip);
|
|
11090
11174
|
}
|
|
11091
11175
|
meta.controller.draw();
|
|
11092
|
-
if (
|
|
11176
|
+
if (clip) {
|
|
11093
11177
|
unclipArea(ctx);
|
|
11094
11178
|
}
|
|
11095
11179
|
args.cancelable = false;
|
|
@@ -11260,17 +11344,17 @@
|
|
|
11260
11344
|
}, {
|
|
11261
11345
|
key: "bindUserEvents",
|
|
11262
11346
|
value: function bindUserEvents() {
|
|
11263
|
-
var
|
|
11347
|
+
var _this16 = this;
|
|
11264
11348
|
var listeners = this._listeners;
|
|
11265
11349
|
var platform = this.platform;
|
|
11266
11350
|
var _add = function _add(type, listener) {
|
|
11267
|
-
platform.addEventListener(
|
|
11351
|
+
platform.addEventListener(_this16, type, listener);
|
|
11268
11352
|
listeners[type] = listener;
|
|
11269
11353
|
};
|
|
11270
11354
|
var listener = function listener(e, x, y) {
|
|
11271
11355
|
e.offsetX = x;
|
|
11272
11356
|
e.offsetY = y;
|
|
11273
|
-
|
|
11357
|
+
_this16._eventHandler(e);
|
|
11274
11358
|
};
|
|
11275
11359
|
each(this.options.events, function (type) {
|
|
11276
11360
|
return _add(type, listener);
|
|
@@ -11279,40 +11363,40 @@
|
|
|
11279
11363
|
}, {
|
|
11280
11364
|
key: "bindResponsiveEvents",
|
|
11281
11365
|
value: function bindResponsiveEvents() {
|
|
11282
|
-
var
|
|
11366
|
+
var _this17 = this;
|
|
11283
11367
|
if (!this._responsiveListeners) {
|
|
11284
11368
|
this._responsiveListeners = {};
|
|
11285
11369
|
}
|
|
11286
11370
|
var listeners = this._responsiveListeners;
|
|
11287
11371
|
var platform = this.platform;
|
|
11288
11372
|
var _add = function _add(type, listener) {
|
|
11289
|
-
platform.addEventListener(
|
|
11373
|
+
platform.addEventListener(_this17, type, listener);
|
|
11290
11374
|
listeners[type] = listener;
|
|
11291
11375
|
};
|
|
11292
11376
|
var _remove = function _remove(type, listener) {
|
|
11293
11377
|
if (listeners[type]) {
|
|
11294
|
-
platform.removeEventListener(
|
|
11378
|
+
platform.removeEventListener(_this17, type, listener);
|
|
11295
11379
|
delete listeners[type];
|
|
11296
11380
|
}
|
|
11297
11381
|
};
|
|
11298
11382
|
var listener = function listener(width, height) {
|
|
11299
|
-
if (
|
|
11300
|
-
|
|
11383
|
+
if (_this17.canvas) {
|
|
11384
|
+
_this17.resize(width, height);
|
|
11301
11385
|
}
|
|
11302
11386
|
};
|
|
11303
11387
|
var detached;
|
|
11304
11388
|
var _attached = function attached() {
|
|
11305
11389
|
_remove('attach', _attached);
|
|
11306
|
-
|
|
11307
|
-
|
|
11390
|
+
_this17.attached = true;
|
|
11391
|
+
_this17.resize();
|
|
11308
11392
|
_add('resize', listener);
|
|
11309
11393
|
_add('detach', detached);
|
|
11310
11394
|
};
|
|
11311
11395
|
detached = function detached() {
|
|
11312
|
-
|
|
11396
|
+
_this17.attached = false;
|
|
11313
11397
|
_remove('resize', listener);
|
|
11314
|
-
|
|
11315
|
-
|
|
11398
|
+
_this17._stop();
|
|
11399
|
+
_this17._resize(0, 0);
|
|
11316
11400
|
_add('attach', _attached);
|
|
11317
11401
|
};
|
|
11318
11402
|
if (platform.isAttached(this.canvas)) {
|
|
@@ -11324,13 +11408,13 @@
|
|
|
11324
11408
|
}, {
|
|
11325
11409
|
key: "unbindEvents",
|
|
11326
11410
|
value: function unbindEvents() {
|
|
11327
|
-
var
|
|
11411
|
+
var _this18 = this;
|
|
11328
11412
|
each(this._listeners, function (listener, type) {
|
|
11329
|
-
|
|
11413
|
+
_this18.platform.removeEventListener(_this18, type, listener);
|
|
11330
11414
|
});
|
|
11331
11415
|
this._listeners = {};
|
|
11332
11416
|
each(this._responsiveListeners, function (listener, type) {
|
|
11333
|
-
|
|
11417
|
+
_this18.platform.removeEventListener(_this18, type, listener);
|
|
11334
11418
|
});
|
|
11335
11419
|
this._responsiveListeners = undefined;
|
|
11336
11420
|
}
|
|
@@ -11359,12 +11443,12 @@
|
|
|
11359
11443
|
}, {
|
|
11360
11444
|
key: "setActiveElements",
|
|
11361
11445
|
value: function setActiveElements(activeElements) {
|
|
11362
|
-
var
|
|
11446
|
+
var _this19 = this;
|
|
11363
11447
|
var lastActive = this._active || [];
|
|
11364
11448
|
var active = activeElements.map(function (_ref4) {
|
|
11365
11449
|
var datasetIndex = _ref4.datasetIndex,
|
|
11366
11450
|
index = _ref4.index;
|
|
11367
|
-
var meta =
|
|
11451
|
+
var meta = _this19.getDatasetMeta(datasetIndex);
|
|
11368
11452
|
if (!meta) {
|
|
11369
11453
|
throw new Error('No dataset found at index ' + datasetIndex);
|
|
11370
11454
|
}
|
|
@@ -11416,7 +11500,7 @@
|
|
|
11416
11500
|
}, {
|
|
11417
11501
|
key: "_eventHandler",
|
|
11418
11502
|
value: function _eventHandler(e, replay) {
|
|
11419
|
-
var
|
|
11503
|
+
var _this20 = this;
|
|
11420
11504
|
var args = {
|
|
11421
11505
|
event: e,
|
|
11422
11506
|
replay: replay,
|
|
@@ -11424,7 +11508,7 @@
|
|
|
11424
11508
|
inChartArea: this.isPointInArea(e)
|
|
11425
11509
|
};
|
|
11426
11510
|
var eventFilter = function eventFilter(plugin) {
|
|
11427
|
-
return (plugin.options.events ||
|
|
11511
|
+
return (plugin.options.events || _this20.options.events).includes(e["native"].type);
|
|
11428
11512
|
};
|
|
11429
11513
|
if (this.notifyPlugins('beforeEvent', args, eventFilter) === false) {
|
|
11430
11514
|
return;
|
|
@@ -11499,6 +11583,40 @@
|
|
|
11499
11583
|
return chart._plugins.invalidate();
|
|
11500
11584
|
});
|
|
11501
11585
|
}
|
|
11586
|
+
function clipSelf(ctx, element, endAngle) {
|
|
11587
|
+
var startAngle = element.startAngle,
|
|
11588
|
+
x = element.x,
|
|
11589
|
+
y = element.y,
|
|
11590
|
+
outerRadius = element.outerRadius,
|
|
11591
|
+
innerRadius = element.innerRadius,
|
|
11592
|
+
options = element.options;
|
|
11593
|
+
var borderWidth = options.borderWidth,
|
|
11594
|
+
borderJoinStyle = options.borderJoinStyle;
|
|
11595
|
+
var outerAngleClip = Math.min(borderWidth / outerRadius, _normalizeAngle(startAngle - endAngle));
|
|
11596
|
+
ctx.beginPath();
|
|
11597
|
+
ctx.arc(x, y, outerRadius - borderWidth / 2, startAngle + outerAngleClip / 2, endAngle - outerAngleClip / 2);
|
|
11598
|
+
if (innerRadius > 0) {
|
|
11599
|
+
var innerAngleClip = Math.min(borderWidth / innerRadius, _normalizeAngle(startAngle - endAngle));
|
|
11600
|
+
ctx.arc(x, y, innerRadius + borderWidth / 2, endAngle - innerAngleClip / 2, startAngle + innerAngleClip / 2, true);
|
|
11601
|
+
} else {
|
|
11602
|
+
var clipWidth = Math.min(borderWidth / 2, outerRadius * _normalizeAngle(startAngle - endAngle));
|
|
11603
|
+
if (borderJoinStyle === 'round') {
|
|
11604
|
+
ctx.arc(x, y, clipWidth, endAngle - PI / 2, startAngle + PI / 2, true);
|
|
11605
|
+
} else if (borderJoinStyle === 'bevel') {
|
|
11606
|
+
var r = 2 * clipWidth * clipWidth;
|
|
11607
|
+
var endX = -r * Math.cos(endAngle + PI / 2) + x;
|
|
11608
|
+
var endY = -r * Math.sin(endAngle + PI / 2) + y;
|
|
11609
|
+
var startX = r * Math.cos(startAngle + PI / 2) + x;
|
|
11610
|
+
var startY = r * Math.sin(startAngle + PI / 2) + y;
|
|
11611
|
+
ctx.lineTo(endX, endY);
|
|
11612
|
+
ctx.lineTo(startX, startY);
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
11615
|
+
ctx.closePath();
|
|
11616
|
+
ctx.moveTo(0, 0);
|
|
11617
|
+
ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
|
11618
|
+
ctx.clip('evenodd');
|
|
11619
|
+
}
|
|
11502
11620
|
function clipArc(ctx, element, endAngle) {
|
|
11503
11621
|
var startAngle = element.startAngle,
|
|
11504
11622
|
pixelMargin = element.pixelMargin,
|
|
@@ -11681,7 +11799,8 @@
|
|
|
11681
11799
|
var borderWidth = options.borderWidth,
|
|
11682
11800
|
borderJoinStyle = options.borderJoinStyle,
|
|
11683
11801
|
borderDash = options.borderDash,
|
|
11684
|
-
borderDashOffset = options.borderDashOffset
|
|
11802
|
+
borderDashOffset = options.borderDashOffset,
|
|
11803
|
+
borderRadius = options.borderRadius;
|
|
11685
11804
|
var inner = options.borderAlign === 'inner';
|
|
11686
11805
|
if (!borderWidth) {
|
|
11687
11806
|
return;
|
|
@@ -11708,6 +11827,9 @@
|
|
|
11708
11827
|
if (inner) {
|
|
11709
11828
|
clipArc(ctx, element, endAngle);
|
|
11710
11829
|
}
|
|
11830
|
+
if (options.selfJoin && endAngle - startAngle >= PI && borderRadius === 0 && borderJoinStyle !== 'miter') {
|
|
11831
|
+
clipSelf(ctx, element, endAngle);
|
|
11832
|
+
}
|
|
11711
11833
|
if (!fullCircles) {
|
|
11712
11834
|
pathArc(ctx, element, offset, spacing, endAngle, circular);
|
|
11713
11835
|
ctx.stroke();
|
|
@@ -11715,28 +11837,28 @@
|
|
|
11715
11837
|
}
|
|
11716
11838
|
var ArcElement = /*#__PURE__*/function (_Element3) {
|
|
11717
11839
|
function ArcElement(cfg) {
|
|
11718
|
-
var
|
|
11840
|
+
var _this21;
|
|
11719
11841
|
_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
|
-
|
|
11842
|
+
_this21 = _callSuper(this, ArcElement);
|
|
11843
|
+
_defineProperty$1(_this21, "circumference", void 0);
|
|
11844
|
+
_defineProperty$1(_this21, "endAngle", void 0);
|
|
11845
|
+
_defineProperty$1(_this21, "fullCircles", void 0);
|
|
11846
|
+
_defineProperty$1(_this21, "innerRadius", void 0);
|
|
11847
|
+
_defineProperty$1(_this21, "outerRadius", void 0);
|
|
11848
|
+
_defineProperty$1(_this21, "pixelMargin", void 0);
|
|
11849
|
+
_defineProperty$1(_this21, "startAngle", void 0);
|
|
11850
|
+
_this21.options = undefined;
|
|
11851
|
+
_this21.circumference = undefined;
|
|
11852
|
+
_this21.startAngle = undefined;
|
|
11853
|
+
_this21.endAngle = undefined;
|
|
11854
|
+
_this21.innerRadius = undefined;
|
|
11855
|
+
_this21.outerRadius = undefined;
|
|
11856
|
+
_this21.pixelMargin = 0;
|
|
11857
|
+
_this21.fullCircles = 0;
|
|
11736
11858
|
if (cfg) {
|
|
11737
|
-
Object.assign(
|
|
11859
|
+
Object.assign(_this21, cfg);
|
|
11738
11860
|
}
|
|
11739
|
-
return
|
|
11861
|
+
return _this21;
|
|
11740
11862
|
}
|
|
11741
11863
|
_inherits$1(ArcElement, _Element3);
|
|
11742
11864
|
return _createClass$1(ArcElement, [{
|
|
@@ -11772,9 +11894,9 @@
|
|
|
11772
11894
|
endAngle = _this$getProps3.endAngle,
|
|
11773
11895
|
innerRadius = _this$getProps3.innerRadius,
|
|
11774
11896
|
outerRadius = _this$getProps3.outerRadius;
|
|
11775
|
-
var _this$
|
|
11776
|
-
offset = _this$
|
|
11777
|
-
spacing = _this$
|
|
11897
|
+
var _this$options11 = this.options,
|
|
11898
|
+
offset = _this$options11.offset,
|
|
11899
|
+
spacing = _this$options11.spacing;
|
|
11778
11900
|
var halfAngle = (startAngle + endAngle) / 2;
|
|
11779
11901
|
var halfRadius = (innerRadius + outerRadius + spacing + offset) / 2;
|
|
11780
11902
|
return {
|
|
@@ -11825,7 +11947,8 @@
|
|
|
11825
11947
|
offset: 0,
|
|
11826
11948
|
spacing: 0,
|
|
11827
11949
|
angle: undefined,
|
|
11828
|
-
circular: true
|
|
11950
|
+
circular: true,
|
|
11951
|
+
selfJoin: false
|
|
11829
11952
|
});
|
|
11830
11953
|
_defineProperty$1(ArcElement, "defaultRoutes", {
|
|
11831
11954
|
backgroundColor: 'backgroundColor'
|
|
@@ -11991,11 +12114,11 @@
|
|
|
11991
12114
|
var segments = line.segments,
|
|
11992
12115
|
options = line.options;
|
|
11993
12116
|
var segmentMethod = _getSegmentMethod(line);
|
|
11994
|
-
var
|
|
11995
|
-
|
|
12117
|
+
var _iterator15 = _createForOfIteratorHelper$1(segments),
|
|
12118
|
+
_step15;
|
|
11996
12119
|
try {
|
|
11997
|
-
for (
|
|
11998
|
-
var segment =
|
|
12120
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
12121
|
+
var segment = _step15.value;
|
|
11999
12122
|
setStyle(ctx, options, segment.style);
|
|
12000
12123
|
ctx.beginPath();
|
|
12001
12124
|
if (segmentMethod(ctx, line, segment, {
|
|
@@ -12007,9 +12130,9 @@
|
|
|
12007
12130
|
ctx.stroke();
|
|
12008
12131
|
}
|
|
12009
12132
|
} catch (err) {
|
|
12010
|
-
|
|
12133
|
+
_iterator15.e(err);
|
|
12011
12134
|
} finally {
|
|
12012
|
-
|
|
12135
|
+
_iterator15.f();
|
|
12013
12136
|
}
|
|
12014
12137
|
}
|
|
12015
12138
|
var usePath2D = typeof Path2D === 'function';
|
|
@@ -12022,24 +12145,24 @@
|
|
|
12022
12145
|
}
|
|
12023
12146
|
var LineElement = /*#__PURE__*/function (_Element4) {
|
|
12024
12147
|
function LineElement(cfg) {
|
|
12025
|
-
var
|
|
12148
|
+
var _this22;
|
|
12026
12149
|
_classCallCheck$1(this, LineElement);
|
|
12027
|
-
|
|
12028
|
-
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
-
|
|
12150
|
+
_this22 = _callSuper(this, LineElement);
|
|
12151
|
+
_this22.animated = true;
|
|
12152
|
+
_this22.options = undefined;
|
|
12153
|
+
_this22._chart = undefined;
|
|
12154
|
+
_this22._loop = undefined;
|
|
12155
|
+
_this22._fullLoop = undefined;
|
|
12156
|
+
_this22._path = undefined;
|
|
12157
|
+
_this22._points = undefined;
|
|
12158
|
+
_this22._segments = undefined;
|
|
12159
|
+
_this22._decimated = false;
|
|
12160
|
+
_this22._pointsUpdated = false;
|
|
12161
|
+
_this22._datasetIndex = undefined;
|
|
12039
12162
|
if (cfg) {
|
|
12040
|
-
Object.assign(
|
|
12163
|
+
Object.assign(_this22, cfg);
|
|
12041
12164
|
}
|
|
12042
|
-
return
|
|
12165
|
+
return _this22;
|
|
12043
12166
|
}
|
|
12044
12167
|
_inherits$1(LineElement, _Element4);
|
|
12045
12168
|
return _createClass$1(LineElement, [{
|
|
@@ -12131,20 +12254,20 @@
|
|
|
12131
12254
|
var loop = this._loop;
|
|
12132
12255
|
start = start || 0;
|
|
12133
12256
|
count = count || this.points.length - start;
|
|
12134
|
-
var
|
|
12135
|
-
|
|
12257
|
+
var _iterator16 = _createForOfIteratorHelper$1(segments),
|
|
12258
|
+
_step16;
|
|
12136
12259
|
try {
|
|
12137
|
-
for (
|
|
12138
|
-
var segment =
|
|
12260
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
12261
|
+
var segment = _step16.value;
|
|
12139
12262
|
loop &= segmentMethod(ctx, this, segment, {
|
|
12140
12263
|
start: start,
|
|
12141
12264
|
end: start + count - 1
|
|
12142
12265
|
});
|
|
12143
12266
|
}
|
|
12144
12267
|
} catch (err) {
|
|
12145
|
-
|
|
12268
|
+
_iterator16.e(err);
|
|
12146
12269
|
} finally {
|
|
12147
|
-
|
|
12270
|
+
_iterator16.f();
|
|
12148
12271
|
}
|
|
12149
12272
|
return !!loop;
|
|
12150
12273
|
}
|
|
@@ -12197,20 +12320,20 @@
|
|
|
12197
12320
|
}
|
|
12198
12321
|
var PointElement = /*#__PURE__*/function (_Element5) {
|
|
12199
12322
|
function PointElement(cfg) {
|
|
12200
|
-
var
|
|
12323
|
+
var _this23;
|
|
12201
12324
|
_classCallCheck$1(this, PointElement);
|
|
12202
|
-
|
|
12203
|
-
_defineProperty$1(
|
|
12204
|
-
_defineProperty$1(
|
|
12205
|
-
_defineProperty$1(
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12325
|
+
_this23 = _callSuper(this, PointElement);
|
|
12326
|
+
_defineProperty$1(_this23, "parsed", void 0);
|
|
12327
|
+
_defineProperty$1(_this23, "skip", void 0);
|
|
12328
|
+
_defineProperty$1(_this23, "stop", void 0);
|
|
12329
|
+
_this23.options = undefined;
|
|
12330
|
+
_this23.parsed = undefined;
|
|
12331
|
+
_this23.skip = undefined;
|
|
12332
|
+
_this23.stop = undefined;
|
|
12210
12333
|
if (cfg) {
|
|
12211
|
-
Object.assign(
|
|
12334
|
+
Object.assign(_this23, cfg);
|
|
12212
12335
|
}
|
|
12213
|
-
return
|
|
12336
|
+
return _this23;
|
|
12214
12337
|
}
|
|
12215
12338
|
_inherits$1(PointElement, _Element5);
|
|
12216
12339
|
return _createClass$1(PointElement, [{
|
|
@@ -12407,28 +12530,28 @@
|
|
|
12407
12530
|
}
|
|
12408
12531
|
var BarElement = /*#__PURE__*/function (_Element6) {
|
|
12409
12532
|
function BarElement(cfg) {
|
|
12410
|
-
var
|
|
12533
|
+
var _this24;
|
|
12411
12534
|
_classCallCheck$1(this, BarElement);
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12535
|
+
_this24 = _callSuper(this, BarElement);
|
|
12536
|
+
_this24.options = undefined;
|
|
12537
|
+
_this24.horizontal = undefined;
|
|
12538
|
+
_this24.base = undefined;
|
|
12539
|
+
_this24.width = undefined;
|
|
12540
|
+
_this24.height = undefined;
|
|
12541
|
+
_this24.inflateAmount = undefined;
|
|
12419
12542
|
if (cfg) {
|
|
12420
|
-
Object.assign(
|
|
12543
|
+
Object.assign(_this24, cfg);
|
|
12421
12544
|
}
|
|
12422
|
-
return
|
|
12545
|
+
return _this24;
|
|
12423
12546
|
}
|
|
12424
12547
|
_inherits$1(BarElement, _Element6);
|
|
12425
12548
|
return _createClass$1(BarElement, [{
|
|
12426
12549
|
key: "draw",
|
|
12427
12550
|
value: function draw(ctx) {
|
|
12428
12551
|
var inflateAmount = this.inflateAmount,
|
|
12429
|
-
_this$
|
|
12430
|
-
borderColor = _this$
|
|
12431
|
-
backgroundColor = _this$
|
|
12552
|
+
_this$options12 = this.options,
|
|
12553
|
+
borderColor = _this$options12.borderColor,
|
|
12554
|
+
backgroundColor = _this$options12.backgroundColor;
|
|
12432
12555
|
var _boundingRects = boundingRects(this),
|
|
12433
12556
|
inner = _boundingRects.inner,
|
|
12434
12557
|
outer = _boundingRects.outer;
|
|
@@ -12793,11 +12916,11 @@
|
|
|
12793
12916
|
var points = line.points;
|
|
12794
12917
|
var tpoints = target.points;
|
|
12795
12918
|
var parts = [];
|
|
12796
|
-
var
|
|
12797
|
-
|
|
12919
|
+
var _iterator17 = _createForOfIteratorHelper$1(segments),
|
|
12920
|
+
_step17;
|
|
12798
12921
|
try {
|
|
12799
|
-
for (
|
|
12800
|
-
var segment =
|
|
12922
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
12923
|
+
var segment = _step17.value;
|
|
12801
12924
|
var start = segment.start,
|
|
12802
12925
|
end = segment.end;
|
|
12803
12926
|
end = _findSegmentEnd(start, end, points);
|
|
@@ -12812,18 +12935,18 @@
|
|
|
12812
12935
|
continue;
|
|
12813
12936
|
}
|
|
12814
12937
|
var targetSegments = _boundSegments(target, bounds);
|
|
12815
|
-
var
|
|
12816
|
-
|
|
12938
|
+
var _iterator18 = _createForOfIteratorHelper$1(targetSegments),
|
|
12939
|
+
_step18;
|
|
12817
12940
|
try {
|
|
12818
|
-
for (
|
|
12819
|
-
var tgt =
|
|
12941
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
12942
|
+
var tgt = _step18.value;
|
|
12820
12943
|
var subBounds = _getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);
|
|
12821
12944
|
var fillSources = _boundSegment(segment, points, subBounds);
|
|
12822
|
-
var
|
|
12823
|
-
|
|
12945
|
+
var _iterator19 = _createForOfIteratorHelper$1(fillSources),
|
|
12946
|
+
_step19;
|
|
12824
12947
|
try {
|
|
12825
|
-
for (
|
|
12826
|
-
var fillSource =
|
|
12948
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
12949
|
+
var fillSource = _step19.value;
|
|
12827
12950
|
parts.push({
|
|
12828
12951
|
source: fillSource,
|
|
12829
12952
|
target: tgt,
|
|
@@ -12832,21 +12955,21 @@
|
|
|
12832
12955
|
});
|
|
12833
12956
|
}
|
|
12834
12957
|
} catch (err) {
|
|
12835
|
-
|
|
12958
|
+
_iterator19.e(err);
|
|
12836
12959
|
} finally {
|
|
12837
|
-
|
|
12960
|
+
_iterator19.f();
|
|
12838
12961
|
}
|
|
12839
12962
|
}
|
|
12840
12963
|
} catch (err) {
|
|
12841
|
-
|
|
12964
|
+
_iterator18.e(err);
|
|
12842
12965
|
} finally {
|
|
12843
|
-
|
|
12966
|
+
_iterator18.f();
|
|
12844
12967
|
}
|
|
12845
12968
|
}
|
|
12846
12969
|
} catch (err) {
|
|
12847
|
-
|
|
12970
|
+
_iterator17.e(err);
|
|
12848
12971
|
} finally {
|
|
12849
|
-
|
|
12972
|
+
_iterator17.f();
|
|
12850
12973
|
}
|
|
12851
12974
|
return parts;
|
|
12852
12975
|
}
|
|
@@ -13211,7 +13334,9 @@
|
|
|
13211
13334
|
}
|
|
13212
13335
|
function _drawfill(ctx, source, area) {
|
|
13213
13336
|
var target = _getTarget(source);
|
|
13214
|
-
var
|
|
13337
|
+
var chart = source.chart,
|
|
13338
|
+
index = source.index,
|
|
13339
|
+
line = source.line,
|
|
13215
13340
|
scale = source.scale,
|
|
13216
13341
|
axis = source.axis;
|
|
13217
13342
|
var lineOpts = line.options;
|
|
@@ -13222,6 +13347,8 @@
|
|
|
13222
13347
|
above = _ref9$above === void 0 ? color : _ref9$above,
|
|
13223
13348
|
_ref9$below = _ref9.below,
|
|
13224
13349
|
below = _ref9$below === void 0 ? color : _ref9$below;
|
|
13350
|
+
var meta = chart.getDatasetMeta(index);
|
|
13351
|
+
var clip = getDatasetClipArea(chart, meta);
|
|
13225
13352
|
if (target && line.points.length) {
|
|
13226
13353
|
clipArea(ctx, area);
|
|
13227
13354
|
doFill(ctx, {
|
|
@@ -13231,7 +13358,8 @@
|
|
|
13231
13358
|
below: below,
|
|
13232
13359
|
area: area,
|
|
13233
13360
|
scale: scale,
|
|
13234
|
-
axis: axis
|
|
13361
|
+
axis: axis,
|
|
13362
|
+
clip: clip
|
|
13235
13363
|
});
|
|
13236
13364
|
unclipArea(ctx);
|
|
13237
13365
|
}
|
|
@@ -13242,32 +13370,92 @@
|
|
|
13242
13370
|
above = cfg.above,
|
|
13243
13371
|
below = cfg.below,
|
|
13244
13372
|
area = cfg.area,
|
|
13245
|
-
scale = cfg.scale
|
|
13373
|
+
scale = cfg.scale,
|
|
13374
|
+
clip = cfg.clip;
|
|
13246
13375
|
var property = line._loop ? 'angle' : cfg.axis;
|
|
13247
13376
|
ctx.save();
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13377
|
+
var fillColor = below;
|
|
13378
|
+
if (below !== above) {
|
|
13379
|
+
if (property === 'x') {
|
|
13380
|
+
clipVertical(ctx, target, area.top);
|
|
13381
|
+
fill(ctx, {
|
|
13382
|
+
line: line,
|
|
13383
|
+
target: target,
|
|
13384
|
+
color: above,
|
|
13385
|
+
scale: scale,
|
|
13386
|
+
property: property,
|
|
13387
|
+
clip: clip
|
|
13388
|
+
});
|
|
13389
|
+
ctx.restore();
|
|
13390
|
+
ctx.save();
|
|
13391
|
+
clipVertical(ctx, target, area.bottom);
|
|
13392
|
+
} else if (property === 'y') {
|
|
13393
|
+
clipHorizontal(ctx, target, area.left);
|
|
13394
|
+
fill(ctx, {
|
|
13395
|
+
line: line,
|
|
13396
|
+
target: target,
|
|
13397
|
+
color: below,
|
|
13398
|
+
scale: scale,
|
|
13399
|
+
property: property,
|
|
13400
|
+
clip: clip
|
|
13401
|
+
});
|
|
13402
|
+
ctx.restore();
|
|
13403
|
+
ctx.save();
|
|
13404
|
+
clipHorizontal(ctx, target, area.right);
|
|
13405
|
+
fillColor = above;
|
|
13406
|
+
}
|
|
13260
13407
|
}
|
|
13261
13408
|
fill(ctx, {
|
|
13262
13409
|
line: line,
|
|
13263
13410
|
target: target,
|
|
13264
|
-
color:
|
|
13411
|
+
color: fillColor,
|
|
13265
13412
|
scale: scale,
|
|
13266
|
-
property: property
|
|
13413
|
+
property: property,
|
|
13414
|
+
clip: clip
|
|
13267
13415
|
});
|
|
13268
13416
|
ctx.restore();
|
|
13269
13417
|
}
|
|
13270
13418
|
function clipVertical(ctx, target, clipY) {
|
|
13419
|
+
var segments = target.segments,
|
|
13420
|
+
points = target.points;
|
|
13421
|
+
var first = true;
|
|
13422
|
+
var lineLoop = false;
|
|
13423
|
+
ctx.beginPath();
|
|
13424
|
+
var _iterator20 = _createForOfIteratorHelper$1(segments),
|
|
13425
|
+
_step20;
|
|
13426
|
+
try {
|
|
13427
|
+
for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) {
|
|
13428
|
+
var segment = _step20.value;
|
|
13429
|
+
var start = segment.start,
|
|
13430
|
+
end = segment.end;
|
|
13431
|
+
var firstPoint = points[start];
|
|
13432
|
+
var lastPoint = points[_findSegmentEnd(start, end, points)];
|
|
13433
|
+
if (first) {
|
|
13434
|
+
ctx.moveTo(firstPoint.x, firstPoint.y);
|
|
13435
|
+
first = false;
|
|
13436
|
+
} else {
|
|
13437
|
+
ctx.lineTo(firstPoint.x, clipY);
|
|
13438
|
+
ctx.lineTo(firstPoint.x, firstPoint.y);
|
|
13439
|
+
}
|
|
13440
|
+
lineLoop = !!target.pathSegment(ctx, segment, {
|
|
13441
|
+
move: lineLoop
|
|
13442
|
+
});
|
|
13443
|
+
if (lineLoop) {
|
|
13444
|
+
ctx.closePath();
|
|
13445
|
+
} else {
|
|
13446
|
+
ctx.lineTo(lastPoint.x, clipY);
|
|
13447
|
+
}
|
|
13448
|
+
}
|
|
13449
|
+
} catch (err) {
|
|
13450
|
+
_iterator20.e(err);
|
|
13451
|
+
} finally {
|
|
13452
|
+
_iterator20.f();
|
|
13453
|
+
}
|
|
13454
|
+
ctx.lineTo(target.first().x, clipY);
|
|
13455
|
+
ctx.closePath();
|
|
13456
|
+
ctx.clip();
|
|
13457
|
+
}
|
|
13458
|
+
function clipHorizontal(ctx, target, clipX) {
|
|
13271
13459
|
var segments = target.segments,
|
|
13272
13460
|
points = target.points;
|
|
13273
13461
|
var first = true;
|
|
@@ -13286,7 +13474,7 @@
|
|
|
13286
13474
|
ctx.moveTo(firstPoint.x, firstPoint.y);
|
|
13287
13475
|
first = false;
|
|
13288
13476
|
} else {
|
|
13289
|
-
ctx.lineTo(firstPoint.
|
|
13477
|
+
ctx.lineTo(clipX, firstPoint.y);
|
|
13290
13478
|
ctx.lineTo(firstPoint.x, firstPoint.y);
|
|
13291
13479
|
}
|
|
13292
13480
|
lineLoop = !!target.pathSegment(ctx, segment, {
|
|
@@ -13295,7 +13483,7 @@
|
|
|
13295
13483
|
if (lineLoop) {
|
|
13296
13484
|
ctx.closePath();
|
|
13297
13485
|
} else {
|
|
13298
|
-
ctx.lineTo(lastPoint.
|
|
13486
|
+
ctx.lineTo(clipX, lastPoint.y);
|
|
13299
13487
|
}
|
|
13300
13488
|
}
|
|
13301
13489
|
} catch (err) {
|
|
@@ -13303,7 +13491,7 @@
|
|
|
13303
13491
|
} finally {
|
|
13304
13492
|
_iterator21.f();
|
|
13305
13493
|
}
|
|
13306
|
-
ctx.lineTo(target.first().
|
|
13494
|
+
ctx.lineTo(clipX, target.first().y);
|
|
13307
13495
|
ctx.closePath();
|
|
13308
13496
|
ctx.clip();
|
|
13309
13497
|
}
|
|
@@ -13312,7 +13500,8 @@
|
|
|
13312
13500
|
target = cfg.target,
|
|
13313
13501
|
property = cfg.property,
|
|
13314
13502
|
color = cfg.color,
|
|
13315
|
-
scale = cfg.scale
|
|
13503
|
+
scale = cfg.scale,
|
|
13504
|
+
clip = cfg.clip;
|
|
13316
13505
|
var segments = _segments(line, target, property);
|
|
13317
13506
|
var _iterator22 = _createForOfIteratorHelper$1(segments),
|
|
13318
13507
|
_step22;
|
|
@@ -13330,7 +13519,7 @@
|
|
|
13330
13519
|
var notShape = target !== true;
|
|
13331
13520
|
ctx.save();
|
|
13332
13521
|
ctx.fillStyle = backgroundColor;
|
|
13333
|
-
clipBounds(ctx, scale, notShape && _getBounds(property, start, end));
|
|
13522
|
+
clipBounds(ctx, scale, clip, notShape && _getBounds(property, start, end));
|
|
13334
13523
|
ctx.beginPath();
|
|
13335
13524
|
var lineLoop = !!line.pathSegment(ctx, src);
|
|
13336
13525
|
var loop = void 0;
|
|
@@ -13359,17 +13548,33 @@
|
|
|
13359
13548
|
_iterator22.f();
|
|
13360
13549
|
}
|
|
13361
13550
|
}
|
|
13362
|
-
function clipBounds(ctx, scale, bounds) {
|
|
13363
|
-
var
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13551
|
+
function clipBounds(ctx, scale, clip, bounds) {
|
|
13552
|
+
var chartArea = scale.chart.chartArea;
|
|
13553
|
+
var _ref0 = bounds || {},
|
|
13554
|
+
property = _ref0.property,
|
|
13555
|
+
start = _ref0.start,
|
|
13556
|
+
end = _ref0.end;
|
|
13557
|
+
if (property === 'x' || property === 'y') {
|
|
13558
|
+
var left, top, right, bottom;
|
|
13559
|
+
if (property === 'x') {
|
|
13560
|
+
left = start;
|
|
13561
|
+
top = chartArea.top;
|
|
13562
|
+
right = end;
|
|
13563
|
+
bottom = chartArea.bottom;
|
|
13564
|
+
} else {
|
|
13565
|
+
left = chartArea.left;
|
|
13566
|
+
top = start;
|
|
13567
|
+
right = chartArea.right;
|
|
13568
|
+
bottom = end;
|
|
13569
|
+
}
|
|
13371
13570
|
ctx.beginPath();
|
|
13372
|
-
|
|
13571
|
+
if (clip) {
|
|
13572
|
+
left = Math.max(left, clip.left);
|
|
13573
|
+
right = Math.min(right, clip.right);
|
|
13574
|
+
top = Math.max(top, clip.top);
|
|
13575
|
+
bottom = Math.min(bottom, clip.bottom);
|
|
13576
|
+
}
|
|
13577
|
+
ctx.rect(left, top, right - left, bottom - top);
|
|
13373
13578
|
ctx.clip();
|
|
13374
13579
|
}
|
|
13375
13580
|
}
|
|
@@ -13470,32 +13675,32 @@
|
|
|
13470
13675
|
};
|
|
13471
13676
|
var Legend = /*#__PURE__*/function (_Element7) {
|
|
13472
13677
|
function Legend(config) {
|
|
13473
|
-
var
|
|
13678
|
+
var _this25;
|
|
13474
13679
|
_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
|
|
13680
|
+
_this25 = _callSuper(this, Legend);
|
|
13681
|
+
_this25._added = false;
|
|
13682
|
+
_this25.legendHitBoxes = [];
|
|
13683
|
+
_this25._hoveredItem = null;
|
|
13684
|
+
_this25.doughnutMode = false;
|
|
13685
|
+
_this25.chart = config.chart;
|
|
13686
|
+
_this25.options = config.options;
|
|
13687
|
+
_this25.ctx = config.ctx;
|
|
13688
|
+
_this25.legendItems = undefined;
|
|
13689
|
+
_this25.columnSizes = undefined;
|
|
13690
|
+
_this25.lineWidths = undefined;
|
|
13691
|
+
_this25.maxHeight = undefined;
|
|
13692
|
+
_this25.maxWidth = undefined;
|
|
13693
|
+
_this25.top = undefined;
|
|
13694
|
+
_this25.bottom = undefined;
|
|
13695
|
+
_this25.left = undefined;
|
|
13696
|
+
_this25.right = undefined;
|
|
13697
|
+
_this25.height = undefined;
|
|
13698
|
+
_this25.width = undefined;
|
|
13699
|
+
_this25._margins = undefined;
|
|
13700
|
+
_this25.position = undefined;
|
|
13701
|
+
_this25.weight = undefined;
|
|
13702
|
+
_this25.fullSize = undefined;
|
|
13703
|
+
return _this25;
|
|
13499
13704
|
}
|
|
13500
13705
|
_inherits$1(Legend, _Element7);
|
|
13501
13706
|
return _createClass$1(Legend, [{
|
|
@@ -13524,17 +13729,17 @@
|
|
|
13524
13729
|
}, {
|
|
13525
13730
|
key: "buildLabels",
|
|
13526
13731
|
value: function buildLabels() {
|
|
13527
|
-
var
|
|
13732
|
+
var _this26 = this;
|
|
13528
13733
|
var labelOpts = this.options.labels || {};
|
|
13529
13734
|
var legendItems = callback(labelOpts.generateLabels, [this.chart], this) || [];
|
|
13530
13735
|
if (labelOpts.filter) {
|
|
13531
13736
|
legendItems = legendItems.filter(function (item) {
|
|
13532
|
-
return labelOpts.filter(item,
|
|
13737
|
+
return labelOpts.filter(item, _this26.chart.data);
|
|
13533
13738
|
});
|
|
13534
13739
|
}
|
|
13535
13740
|
if (labelOpts.sort) {
|
|
13536
13741
|
legendItems = legendItems.sort(function (a, b) {
|
|
13537
|
-
return labelOpts.sort(a, b,
|
|
13742
|
+
return labelOpts.sort(a, b, _this26.chart.data);
|
|
13538
13743
|
});
|
|
13539
13744
|
}
|
|
13540
13745
|
if (this.options.reverse) {
|
|
@@ -13656,10 +13861,10 @@
|
|
|
13656
13861
|
}
|
|
13657
13862
|
var titleHeight = this._computeTitleHeight();
|
|
13658
13863
|
var hitboxes = this.legendHitBoxes,
|
|
13659
|
-
_this$
|
|
13660
|
-
align = _this$
|
|
13661
|
-
padding = _this$
|
|
13662
|
-
rtl = _this$
|
|
13864
|
+
_this$options13 = this.options,
|
|
13865
|
+
align = _this$options13.align,
|
|
13866
|
+
padding = _this$options13.labels.padding,
|
|
13867
|
+
rtl = _this$options13.rtl;
|
|
13663
13868
|
var rtlHelper = getRtlAdapter(rtl, this.left, this.width);
|
|
13664
13869
|
if (this.isHorizontal()) {
|
|
13665
13870
|
var row = 0;
|
|
@@ -13724,7 +13929,7 @@
|
|
|
13724
13929
|
}, {
|
|
13725
13930
|
key: "_draw",
|
|
13726
13931
|
value: function _draw() {
|
|
13727
|
-
var
|
|
13932
|
+
var _this27 = this;
|
|
13728
13933
|
var opts = this.options,
|
|
13729
13934
|
columnSizes = this.columnSizes,
|
|
13730
13935
|
lineWidths = this.lineWidths,
|
|
@@ -13826,21 +14031,21 @@
|
|
|
13826
14031
|
var width = boxWidth + halfFontSize + textWidth;
|
|
13827
14032
|
var x = cursor.x;
|
|
13828
14033
|
var y = cursor.y;
|
|
13829
|
-
rtlHelper.setWidth(
|
|
14034
|
+
rtlHelper.setWidth(_this27.width);
|
|
13830
14035
|
if (isHorizontal) {
|
|
13831
|
-
if (i > 0 && x + width + padding >
|
|
14036
|
+
if (i > 0 && x + width + padding > _this27.right) {
|
|
13832
14037
|
y = cursor.y += lineHeight;
|
|
13833
14038
|
cursor.line++;
|
|
13834
|
-
x = cursor.x = _alignStartEnd(align,
|
|
14039
|
+
x = cursor.x = _alignStartEnd(align, _this27.left + padding, _this27.right - lineWidths[cursor.line]);
|
|
13835
14040
|
}
|
|
13836
|
-
} else if (i > 0 && y + lineHeight >
|
|
14041
|
+
} else if (i > 0 && y + lineHeight > _this27.bottom) {
|
|
13837
14042
|
x = cursor.x = x + columnSizes[cursor.line].width + padding;
|
|
13838
14043
|
cursor.line++;
|
|
13839
|
-
y = cursor.y = _alignStartEnd(align,
|
|
14044
|
+
y = cursor.y = _alignStartEnd(align, _this27.top + titleHeight + padding, _this27.bottom - columnSizes[cursor.line].height);
|
|
13840
14045
|
}
|
|
13841
14046
|
var realX = rtlHelper.x(x);
|
|
13842
14047
|
drawLegendBox(realX, y, legendItem);
|
|
13843
|
-
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width :
|
|
14048
|
+
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : _this27.right, opts.rtl);
|
|
13844
14049
|
fillText(rtlHelper.x(x), y, legendItem);
|
|
13845
14050
|
if (isHorizontal) {
|
|
13846
14051
|
cursor.x += width + padding;
|
|
@@ -14084,23 +14289,23 @@
|
|
|
14084
14289
|
};
|
|
14085
14290
|
var Title = /*#__PURE__*/function (_Element8) {
|
|
14086
14291
|
function Title(config) {
|
|
14087
|
-
var
|
|
14292
|
+
var _this28;
|
|
14088
14293
|
_classCallCheck$1(this, Title);
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
return
|
|
14294
|
+
_this28 = _callSuper(this, Title);
|
|
14295
|
+
_this28.chart = config.chart;
|
|
14296
|
+
_this28.options = config.options;
|
|
14297
|
+
_this28.ctx = config.ctx;
|
|
14298
|
+
_this28._padding = undefined;
|
|
14299
|
+
_this28.top = undefined;
|
|
14300
|
+
_this28.bottom = undefined;
|
|
14301
|
+
_this28.left = undefined;
|
|
14302
|
+
_this28.right = undefined;
|
|
14303
|
+
_this28.width = undefined;
|
|
14304
|
+
_this28.height = undefined;
|
|
14305
|
+
_this28.position = undefined;
|
|
14306
|
+
_this28.weight = undefined;
|
|
14307
|
+
_this28.fullSize = undefined;
|
|
14308
|
+
return _this28;
|
|
14104
14309
|
}
|
|
14105
14310
|
_inherits$1(Title, _Element8);
|
|
14106
14311
|
return _createClass$1(Title, [{
|
|
@@ -14619,37 +14824,37 @@
|
|
|
14619
14824
|
}
|
|
14620
14825
|
var Tooltip = /*#__PURE__*/function (_Element9) {
|
|
14621
14826
|
function Tooltip(config) {
|
|
14622
|
-
var
|
|
14827
|
+
var _this29;
|
|
14623
14828
|
_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
|
|
14829
|
+
_this29 = _callSuper(this, Tooltip);
|
|
14830
|
+
_this29.opacity = 0;
|
|
14831
|
+
_this29._active = [];
|
|
14832
|
+
_this29._eventPosition = undefined;
|
|
14833
|
+
_this29._size = undefined;
|
|
14834
|
+
_this29._cachedAnimations = undefined;
|
|
14835
|
+
_this29._tooltipItems = [];
|
|
14836
|
+
_this29.$animations = undefined;
|
|
14837
|
+
_this29.$context = undefined;
|
|
14838
|
+
_this29.chart = config.chart;
|
|
14839
|
+
_this29.options = config.options;
|
|
14840
|
+
_this29.dataPoints = undefined;
|
|
14841
|
+
_this29.title = undefined;
|
|
14842
|
+
_this29.beforeBody = undefined;
|
|
14843
|
+
_this29.body = undefined;
|
|
14844
|
+
_this29.afterBody = undefined;
|
|
14845
|
+
_this29.footer = undefined;
|
|
14846
|
+
_this29.xAlign = undefined;
|
|
14847
|
+
_this29.yAlign = undefined;
|
|
14848
|
+
_this29.x = undefined;
|
|
14849
|
+
_this29.y = undefined;
|
|
14850
|
+
_this29.height = undefined;
|
|
14851
|
+
_this29.width = undefined;
|
|
14852
|
+
_this29.caretX = undefined;
|
|
14853
|
+
_this29.caretY = undefined;
|
|
14854
|
+
_this29.labelColors = undefined;
|
|
14855
|
+
_this29.labelPointStyles = undefined;
|
|
14856
|
+
_this29.labelTextColors = undefined;
|
|
14857
|
+
return _this29;
|
|
14653
14858
|
}
|
|
14654
14859
|
_inherits$1(Tooltip, _Element9);
|
|
14655
14860
|
return _createClass$1(Tooltip, [{
|
|
@@ -14701,7 +14906,7 @@
|
|
|
14701
14906
|
}, {
|
|
14702
14907
|
key: "getBody",
|
|
14703
14908
|
value: function getBody(tooltipItems, options) {
|
|
14704
|
-
var
|
|
14909
|
+
var _this30 = this;
|
|
14705
14910
|
var callbacks = options.callbacks;
|
|
14706
14911
|
var bodyItems = [];
|
|
14707
14912
|
each(tooltipItems, function (context) {
|
|
@@ -14711,9 +14916,9 @@
|
|
|
14711
14916
|
after: []
|
|
14712
14917
|
};
|
|
14713
14918
|
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',
|
|
14919
|
+
pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, 'beforeLabel', _this30, context)));
|
|
14920
|
+
pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, 'label', _this30, context));
|
|
14921
|
+
pushOrConcat(bodyItem.after, splitNewlines(invokeCallbackWithFallback(scoped, 'afterLabel', _this30, context)));
|
|
14717
14922
|
bodyItems.push(bodyItem);
|
|
14718
14923
|
});
|
|
14719
14924
|
return bodyItems;
|
|
@@ -14739,7 +14944,7 @@
|
|
|
14739
14944
|
}, {
|
|
14740
14945
|
key: "_createItems",
|
|
14741
14946
|
value: function _createItems(options) {
|
|
14742
|
-
var
|
|
14947
|
+
var _this31 = this;
|
|
14743
14948
|
var active = this._active;
|
|
14744
14949
|
var data = this.chart.data;
|
|
14745
14950
|
var labelColors = [];
|
|
@@ -14762,9 +14967,9 @@
|
|
|
14762
14967
|
}
|
|
14763
14968
|
each(tooltipItems, function (context) {
|
|
14764
14969
|
var scoped = overrideCallbacks(options.callbacks, context);
|
|
14765
|
-
labelColors.push(invokeCallbackWithFallback(scoped, 'labelColor',
|
|
14766
|
-
labelPointStyles.push(invokeCallbackWithFallback(scoped, 'labelPointStyle',
|
|
14767
|
-
labelTextColors.push(invokeCallbackWithFallback(scoped, 'labelTextColor',
|
|
14970
|
+
labelColors.push(invokeCallbackWithFallback(scoped, 'labelColor', _this31, context));
|
|
14971
|
+
labelPointStyles.push(invokeCallbackWithFallback(scoped, 'labelPointStyle', _this31, context));
|
|
14972
|
+
labelTextColors.push(invokeCallbackWithFallback(scoped, 'labelTextColor', _this31, context));
|
|
14768
14973
|
});
|
|
14769
14974
|
this.labelColors = labelColors;
|
|
14770
14975
|
this.labelPointStyles = labelPointStyles;
|
|
@@ -15171,12 +15376,12 @@
|
|
|
15171
15376
|
}, {
|
|
15172
15377
|
key: "setActiveElements",
|
|
15173
15378
|
value: function setActiveElements(activeElements, eventPosition) {
|
|
15174
|
-
var
|
|
15379
|
+
var _this32 = this;
|
|
15175
15380
|
var lastActive = this._active;
|
|
15176
|
-
var active = activeElements.map(function (
|
|
15177
|
-
var datasetIndex =
|
|
15178
|
-
index =
|
|
15179
|
-
var meta =
|
|
15381
|
+
var active = activeElements.map(function (_ref1) {
|
|
15382
|
+
var datasetIndex = _ref1.datasetIndex,
|
|
15383
|
+
index = _ref1.index;
|
|
15384
|
+
var meta = _this32.chart.getDatasetMeta(datasetIndex);
|
|
15180
15385
|
if (!meta) {
|
|
15181
15386
|
throw new Error('Cannot find a dataset at index ' + datasetIndex);
|
|
15182
15387
|
}
|
|
@@ -15223,14 +15428,14 @@
|
|
|
15223
15428
|
}, {
|
|
15224
15429
|
key: "_getActiveElements",
|
|
15225
15430
|
value: function _getActiveElements(e, lastActive, replay, inChartArea) {
|
|
15226
|
-
var
|
|
15431
|
+
var _this33 = this;
|
|
15227
15432
|
var options = this.options;
|
|
15228
15433
|
if (e.type === 'mouseout') {
|
|
15229
15434
|
return [];
|
|
15230
15435
|
}
|
|
15231
15436
|
if (!inChartArea) {
|
|
15232
15437
|
return lastActive.filter(function (i) {
|
|
15233
|
-
return
|
|
15438
|
+
return _this33.chart.data.datasets[i.datasetIndex] && _this33.chart.getDatasetMeta(i.datasetIndex).controller.getParsed(i.index) !== undefined;
|
|
15234
15439
|
});
|
|
15235
15440
|
}
|
|
15236
15441
|
var active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay);
|
|
@@ -15415,13 +15620,13 @@
|
|
|
15415
15620
|
}
|
|
15416
15621
|
var CategoryScale = /*#__PURE__*/function (_Scale) {
|
|
15417
15622
|
function CategoryScale(cfg) {
|
|
15418
|
-
var
|
|
15623
|
+
var _this34;
|
|
15419
15624
|
_classCallCheck$1(this, CategoryScale);
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
return
|
|
15625
|
+
_this34 = _callSuper(this, CategoryScale, [cfg]);
|
|
15626
|
+
_this34._startValue = undefined;
|
|
15627
|
+
_this34._valueRange = 0;
|
|
15628
|
+
_this34._addedLabels = [];
|
|
15629
|
+
return _this34;
|
|
15425
15630
|
}
|
|
15426
15631
|
_inherits$1(CategoryScale, _Scale);
|
|
15427
15632
|
return _createClass$1(CategoryScale, [{
|
|
@@ -15652,9 +15857,9 @@
|
|
|
15652
15857
|
}
|
|
15653
15858
|
return ticks;
|
|
15654
15859
|
}
|
|
15655
|
-
function relativeLabelSize(value, minSpacing,
|
|
15656
|
-
var horizontal =
|
|
15657
|
-
minRotation =
|
|
15860
|
+
function relativeLabelSize(value, minSpacing, _ref10) {
|
|
15861
|
+
var horizontal = _ref10.horizontal,
|
|
15862
|
+
minRotation = _ref10.minRotation;
|
|
15658
15863
|
var rad = toRadians(minRotation);
|
|
15659
15864
|
var ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 0.001;
|
|
15660
15865
|
var length = 0.75 * minSpacing * ('' + value).length;
|
|
@@ -15662,15 +15867,15 @@
|
|
|
15662
15867
|
}
|
|
15663
15868
|
var LinearScaleBase = /*#__PURE__*/function (_Scale2) {
|
|
15664
15869
|
function LinearScaleBase(cfg) {
|
|
15665
|
-
var
|
|
15870
|
+
var _this35;
|
|
15666
15871
|
_classCallCheck$1(this, LinearScaleBase);
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15673
|
-
return
|
|
15872
|
+
_this35 = _callSuper(this, LinearScaleBase, [cfg]);
|
|
15873
|
+
_this35.start = undefined;
|
|
15874
|
+
_this35.end = undefined;
|
|
15875
|
+
_this35._startValue = undefined;
|
|
15876
|
+
_this35._endValue = undefined;
|
|
15877
|
+
_this35._valueRange = 0;
|
|
15878
|
+
return _this35;
|
|
15674
15879
|
}
|
|
15675
15880
|
_inherits$1(LinearScaleBase, _Scale2);
|
|
15676
15881
|
return _createClass$1(LinearScaleBase, [{
|
|
@@ -15874,9 +16079,9 @@
|
|
|
15874
16079
|
}
|
|
15875
16080
|
return Math.min(rangeExp, log10Floor(min));
|
|
15876
16081
|
}
|
|
15877
|
-
function generateTicks(generationOptions,
|
|
15878
|
-
var min =
|
|
15879
|
-
max =
|
|
16082
|
+
function generateTicks(generationOptions, _ref11) {
|
|
16083
|
+
var min = _ref11.min,
|
|
16084
|
+
max = _ref11.max;
|
|
15880
16085
|
min = finiteOrDefault(generationOptions.min, min);
|
|
15881
16086
|
var ticks = [];
|
|
15882
16087
|
var minExp = log10Floor(min);
|
|
@@ -15916,14 +16121,14 @@
|
|
|
15916
16121
|
}
|
|
15917
16122
|
var LogarithmicScale = /*#__PURE__*/function (_Scale3) {
|
|
15918
16123
|
function LogarithmicScale(cfg) {
|
|
15919
|
-
var
|
|
16124
|
+
var _this36;
|
|
15920
16125
|
_classCallCheck$1(this, LogarithmicScale);
|
|
15921
|
-
|
|
15922
|
-
|
|
15923
|
-
|
|
15924
|
-
|
|
15925
|
-
|
|
15926
|
-
return
|
|
16126
|
+
_this36 = _callSuper(this, LogarithmicScale, [cfg]);
|
|
16127
|
+
_this36.start = undefined;
|
|
16128
|
+
_this36.end = undefined;
|
|
16129
|
+
_this36._startValue = undefined;
|
|
16130
|
+
_this36._valueRange = 0;
|
|
16131
|
+
return _this36;
|
|
15927
16132
|
}
|
|
15928
16133
|
_inherits$1(LogarithmicScale, _Scale3);
|
|
15929
16134
|
return _createClass$1(LogarithmicScale, [{
|
|
@@ -16316,15 +16521,15 @@
|
|
|
16316
16521
|
}
|
|
16317
16522
|
var RadialLinearScale = /*#__PURE__*/function (_LinearScaleBase2) {
|
|
16318
16523
|
function RadialLinearScale(cfg) {
|
|
16319
|
-
var
|
|
16524
|
+
var _this37;
|
|
16320
16525
|
_classCallCheck$1(this, RadialLinearScale);
|
|
16321
|
-
|
|
16322
|
-
|
|
16323
|
-
|
|
16324
|
-
|
|
16325
|
-
|
|
16326
|
-
|
|
16327
|
-
return
|
|
16526
|
+
_this37 = _callSuper(this, RadialLinearScale, [cfg]);
|
|
16527
|
+
_this37.xCenter = undefined;
|
|
16528
|
+
_this37.yCenter = undefined;
|
|
16529
|
+
_this37.drawingArea = undefined;
|
|
16530
|
+
_this37._pointLabels = [];
|
|
16531
|
+
_this37._pointLabelItems = [];
|
|
16532
|
+
return _this37;
|
|
16328
16533
|
}
|
|
16329
16534
|
_inherits$1(RadialLinearScale, _LinearScaleBase2);
|
|
16330
16535
|
return _createClass$1(RadialLinearScale, [{
|
|
@@ -16355,13 +16560,13 @@
|
|
|
16355
16560
|
}, {
|
|
16356
16561
|
key: "generateTickLabels",
|
|
16357
16562
|
value: function generateTickLabels(ticks) {
|
|
16358
|
-
var
|
|
16563
|
+
var _this38 = this;
|
|
16359
16564
|
LinearScaleBase.prototype.generateTickLabels.call(this, ticks);
|
|
16360
16565
|
this._pointLabels = this.getLabels().map(function (value, index) {
|
|
16361
|
-
var label = callback(
|
|
16566
|
+
var label = callback(_this38.options.pointLabels.callback, [value, index], _this38);
|
|
16362
16567
|
return label || label === 0 ? label : '';
|
|
16363
16568
|
}).filter(function (v, i) {
|
|
16364
|
-
return
|
|
16569
|
+
return _this38.chart.getDataVisibility(i);
|
|
16365
16570
|
});
|
|
16366
16571
|
}
|
|
16367
16572
|
}, {
|
|
@@ -16457,9 +16662,9 @@
|
|
|
16457
16662
|
}, {
|
|
16458
16663
|
key: "drawBackground",
|
|
16459
16664
|
value: function drawBackground() {
|
|
16460
|
-
var _this$
|
|
16461
|
-
backgroundColor = _this$
|
|
16462
|
-
circular = _this$
|
|
16665
|
+
var _this$options14 = this.options,
|
|
16666
|
+
backgroundColor = _this$options14.backgroundColor,
|
|
16667
|
+
circular = _this$options14.grid.circular;
|
|
16463
16668
|
if (backgroundColor) {
|
|
16464
16669
|
var ctx = this.ctx;
|
|
16465
16670
|
ctx.save();
|
|
@@ -16474,7 +16679,7 @@
|
|
|
16474
16679
|
}, {
|
|
16475
16680
|
key: "drawGrid",
|
|
16476
16681
|
value: function drawGrid() {
|
|
16477
|
-
var
|
|
16682
|
+
var _this39 = this;
|
|
16478
16683
|
var ctx = this.ctx;
|
|
16479
16684
|
var opts = this.options;
|
|
16480
16685
|
var angleLines = opts.angleLines,
|
|
@@ -16487,12 +16692,12 @@
|
|
|
16487
16692
|
}
|
|
16488
16693
|
if (grid.display) {
|
|
16489
16694
|
this.ticks.forEach(function (tick, index) {
|
|
16490
|
-
if (index !== 0 || index === 0 &&
|
|
16491
|
-
offset =
|
|
16492
|
-
var context =
|
|
16695
|
+
if (index !== 0 || index === 0 && _this39.min < 0) {
|
|
16696
|
+
offset = _this39.getDistanceFromCenterForValue(tick.value);
|
|
16697
|
+
var context = _this39.getContext(index);
|
|
16493
16698
|
var optsAtIndex = grid.setContext(context);
|
|
16494
16699
|
var optsAtIndexBorder = border.setContext(context);
|
|
16495
|
-
drawRadiusLine(
|
|
16700
|
+
drawRadiusLine(_this39, optsAtIndex, offset, labelCount, optsAtIndexBorder);
|
|
16496
16701
|
}
|
|
16497
16702
|
});
|
|
16498
16703
|
}
|
|
@@ -16525,7 +16730,7 @@
|
|
|
16525
16730
|
}, {
|
|
16526
16731
|
key: "drawLabels",
|
|
16527
16732
|
value: function drawLabels() {
|
|
16528
|
-
var
|
|
16733
|
+
var _this40 = this;
|
|
16529
16734
|
var ctx = this.ctx;
|
|
16530
16735
|
var opts = this.options;
|
|
16531
16736
|
var tickOpts = opts.ticks;
|
|
@@ -16540,12 +16745,12 @@
|
|
|
16540
16745
|
ctx.textAlign = 'center';
|
|
16541
16746
|
ctx.textBaseline = 'middle';
|
|
16542
16747
|
this.ticks.forEach(function (tick, index) {
|
|
16543
|
-
if (index === 0 &&
|
|
16748
|
+
if (index === 0 && _this40.min >= 0 && !opts.reverse) {
|
|
16544
16749
|
return;
|
|
16545
16750
|
}
|
|
16546
|
-
var optsAtIndex = tickOpts.setContext(
|
|
16751
|
+
var optsAtIndex = tickOpts.setContext(_this40.getContext(index));
|
|
16547
16752
|
var tickFont = toFont(optsAtIndex.font);
|
|
16548
|
-
offset =
|
|
16753
|
+
offset = _this40.getDistanceFromCenterForValue(_this40.ticks[index].value);
|
|
16549
16754
|
if (optsAtIndex.showLabelBackdrop) {
|
|
16550
16755
|
ctx.font = tickFont.string;
|
|
16551
16756
|
width = ctx.measureText(tick.label).width;
|
|
@@ -16751,20 +16956,20 @@
|
|
|
16751
16956
|
}
|
|
16752
16957
|
var TimeScale = /*#__PURE__*/function (_Scale4) {
|
|
16753
16958
|
function TimeScale(props) {
|
|
16754
|
-
var
|
|
16959
|
+
var _this41;
|
|
16755
16960
|
_classCallCheck$1(this, TimeScale);
|
|
16756
|
-
|
|
16757
|
-
|
|
16961
|
+
_this41 = _callSuper(this, TimeScale, [props]);
|
|
16962
|
+
_this41._cache = {
|
|
16758
16963
|
data: [],
|
|
16759
16964
|
labels: [],
|
|
16760
16965
|
all: []
|
|
16761
16966
|
};
|
|
16762
|
-
|
|
16763
|
-
|
|
16764
|
-
|
|
16765
|
-
|
|
16766
|
-
|
|
16767
|
-
return
|
|
16967
|
+
_this41._unit = 'day';
|
|
16968
|
+
_this41._majorUnit = undefined;
|
|
16969
|
+
_this41._offsets = {};
|
|
16970
|
+
_this41._normalized = false;
|
|
16971
|
+
_this41._parseOpts = undefined;
|
|
16972
|
+
return _this41;
|
|
16768
16973
|
}
|
|
16769
16974
|
_inherits$1(TimeScale, _Scale4);
|
|
16770
16975
|
return _createClass$1(TimeScale, [{
|
|
@@ -17121,13 +17326,13 @@
|
|
|
17121
17326
|
}
|
|
17122
17327
|
var TimeSeriesScale = /*#__PURE__*/function (_TimeScale2) {
|
|
17123
17328
|
function TimeSeriesScale(props) {
|
|
17124
|
-
var
|
|
17329
|
+
var _this42;
|
|
17125
17330
|
_classCallCheck$1(this, TimeSeriesScale);
|
|
17126
|
-
|
|
17127
|
-
|
|
17128
|
-
|
|
17129
|
-
|
|
17130
|
-
return
|
|
17331
|
+
_this42 = _callSuper(this, TimeSeriesScale, [props]);
|
|
17332
|
+
_this42._table = [];
|
|
17333
|
+
_this42._minPos = undefined;
|
|
17334
|
+
_this42._tableRange = undefined;
|
|
17335
|
+
return _this42;
|
|
17131
17336
|
}
|
|
17132
17337
|
_inherits$1(TimeSeriesScale, _TimeScale2);
|
|
17133
17338
|
return _createClass$1(TimeSeriesScale, [{
|
|
@@ -17314,6 +17519,7 @@
|
|
|
17314
17519
|
fontString: fontString,
|
|
17315
17520
|
formatNumber: formatNumber,
|
|
17316
17521
|
getAngleFromPoint: getAngleFromPoint,
|
|
17522
|
+
getDatasetClipArea: getDatasetClipArea,
|
|
17317
17523
|
getHoverColor: getHoverColor,
|
|
17318
17524
|
getMaximumSize: getMaximumSize,
|
|
17319
17525
|
getRelativePosition: getRelativePosition,
|