chartkick 5.1.4 → 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 +13 -0
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +651 -475
- metadata +4 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Chart.js v4.
|
|
2
|
+
* Chart.js v4.5.1
|
|
3
3
|
* https://www.chartjs.org
|
|
4
4
|
* (c) 2025 Chart.js Contributors
|
|
5
5
|
* Released under the MIT License
|
|
@@ -3169,19 +3169,19 @@
|
|
|
3169
3169
|
try {
|
|
3170
3170
|
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
3171
3171
|
var scope = _step9.value;
|
|
3172
|
-
var
|
|
3172
|
+
var _iterator0 = _createForOfIteratorHelper$1(Object.keys(scope).filter(function (k) {
|
|
3173
3173
|
return !k.startsWith('_');
|
|
3174
3174
|
})),
|
|
3175
|
-
|
|
3175
|
+
_step0;
|
|
3176
3176
|
try {
|
|
3177
|
-
for (
|
|
3178
|
-
var key =
|
|
3177
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
3178
|
+
var key = _step0.value;
|
|
3179
3179
|
set.add(key);
|
|
3180
3180
|
}
|
|
3181
3181
|
} catch (err) {
|
|
3182
|
-
|
|
3182
|
+
_iterator0.e(err);
|
|
3183
3183
|
} finally {
|
|
3184
|
-
|
|
3184
|
+
_iterator0.f();
|
|
3185
3185
|
}
|
|
3186
3186
|
}
|
|
3187
3187
|
} catch (err) {
|
|
@@ -3565,10 +3565,10 @@
|
|
|
3565
3565
|
*/
|
|
3566
3566
|
function retinaScale(chart, forceRatio, forceStyle) {
|
|
3567
3567
|
var pixelRatio = forceRatio || 1;
|
|
3568
|
-
var deviceHeight =
|
|
3569
|
-
var deviceWidth =
|
|
3570
|
-
chart.height =
|
|
3571
|
-
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);
|
|
3572
3572
|
var canvas = chart.canvas;
|
|
3573
3573
|
// If no style has been set on the canvas, the render size is used as display size,
|
|
3574
3574
|
// making the chart visually bigger, so let's enforce it to the "correct" values.
|
|
@@ -3985,11 +3985,11 @@
|
|
|
3985
3985
|
start = e % count;
|
|
3986
3986
|
}
|
|
3987
3987
|
}
|
|
3988
|
-
var
|
|
3989
|
-
|
|
3988
|
+
var _iterator1 = _createForOfIteratorHelper$1(segments),
|
|
3989
|
+
_step1;
|
|
3990
3990
|
try {
|
|
3991
|
-
for (
|
|
3992
|
-
var segment =
|
|
3991
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
3992
|
+
var segment = _step1.value;
|
|
3993
3993
|
start = spanGaps ? start : segment.start;
|
|
3994
3994
|
var prev = points[start % count];
|
|
3995
3995
|
var style = void 0;
|
|
@@ -4014,9 +4014,9 @@
|
|
|
4014
4014
|
}
|
|
4015
4015
|
}
|
|
4016
4016
|
} catch (err) {
|
|
4017
|
-
|
|
4017
|
+
_iterator1.e(err);
|
|
4018
4018
|
} finally {
|
|
4019
|
-
|
|
4019
|
+
_iterator1.f();
|
|
4020
4020
|
}
|
|
4021
4021
|
return result;
|
|
4022
4022
|
}
|
|
@@ -4047,6 +4047,35 @@
|
|
|
4047
4047
|
};
|
|
4048
4048
|
return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);
|
|
4049
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
|
+
}
|
|
4050
4079
|
|
|
4051
4080
|
var Animator = /*#__PURE__*/function () {
|
|
4052
4081
|
function Animator() {
|
|
@@ -5757,6 +5786,39 @@
|
|
|
5757
5786
|
value: function _getStackCount(index) {
|
|
5758
5787
|
return this._getStacks(undefined, index).length;
|
|
5759
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
|
+
}
|
|
5760
5822
|
}, {
|
|
5761
5823
|
key: "_getStackIndex",
|
|
5762
5824
|
value: function _getStackIndex(datasetIndex, name, dataIndex) {
|
|
@@ -5861,10 +5923,13 @@
|
|
|
5861
5923
|
var skipNull = options.skipNull;
|
|
5862
5924
|
var maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);
|
|
5863
5925
|
var center, size;
|
|
5926
|
+
var axisCount = this._getAxisCount();
|
|
5864
5927
|
if (ruler.grouped) {
|
|
5865
5928
|
var stackCount = skipNull ? this._getStackCount(index) : ruler.stackCount;
|
|
5866
|
-
var range = options.barThickness === 'flex' ? computeFlexCategoryTraits(index, ruler, options, stackCount) : computeFitCategoryTraits(index, ruler, options, stackCount);
|
|
5867
|
-
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;
|
|
5868
5933
|
center = range.start + range.chunk * stackIndex + range.chunk / 2;
|
|
5869
5934
|
size = Math.min(maxBarThickness, range.chunk * range.ratio);
|
|
5870
5935
|
} else {
|
|
@@ -6382,21 +6447,29 @@
|
|
|
6382
6447
|
labels: {
|
|
6383
6448
|
generateLabels: function generateLabels(chart) {
|
|
6384
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;
|
|
6385
6456
|
if (data.labels.length && data.datasets.length) {
|
|
6386
|
-
var _chart$legend$options2 = chart.legend.options.labels,
|
|
6387
|
-
pointStyle = _chart$legend$options2.pointStyle,
|
|
6388
|
-
color = _chart$legend$options2.color;
|
|
6389
6457
|
return data.labels.map(function (label, i) {
|
|
6390
6458
|
var meta = chart.getDatasetMeta(0);
|
|
6391
6459
|
var style = meta.controller.getStyle(i);
|
|
6392
6460
|
return {
|
|
6393
6461
|
text: label,
|
|
6394
6462
|
fillStyle: style.backgroundColor,
|
|
6395
|
-
strokeStyle: style.borderColor,
|
|
6396
6463
|
fontColor: color,
|
|
6464
|
+
hidden: !chart.getDataVisibility(i),
|
|
6465
|
+
lineDash: style.borderDash,
|
|
6466
|
+
lineDashOffset: style.borderDashOffset,
|
|
6467
|
+
lineJoin: style.borderJoinStyle,
|
|
6397
6468
|
lineWidth: style.borderWidth,
|
|
6469
|
+
strokeStyle: style.borderColor,
|
|
6470
|
+
textAlign: textAlign,
|
|
6398
6471
|
pointStyle: pointStyle,
|
|
6399
|
-
|
|
6472
|
+
borderRadius: useBorderRadius && (borderRadius || style.borderRadius),
|
|
6400
6473
|
index: i
|
|
6401
6474
|
};
|
|
6402
6475
|
});
|
|
@@ -7369,11 +7442,11 @@
|
|
|
7369
7442
|
}
|
|
7370
7443
|
function buildStacks(layouts) {
|
|
7371
7444
|
var stacks = {};
|
|
7372
|
-
var
|
|
7373
|
-
|
|
7445
|
+
var _iterator6 = _createForOfIteratorHelper$1(layouts),
|
|
7446
|
+
_step6;
|
|
7374
7447
|
try {
|
|
7375
|
-
for (
|
|
7376
|
-
var wrap =
|
|
7448
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
7449
|
+
var wrap = _step6.value;
|
|
7377
7450
|
var stack = wrap.stack,
|
|
7378
7451
|
pos = wrap.pos,
|
|
7379
7452
|
stackWeight = wrap.stackWeight;
|
|
@@ -7390,9 +7463,9 @@
|
|
|
7390
7463
|
_stack.weight += stackWeight;
|
|
7391
7464
|
}
|
|
7392
7465
|
} catch (err) {
|
|
7393
|
-
|
|
7466
|
+
_iterator6.e(err);
|
|
7394
7467
|
} finally {
|
|
7395
|
-
|
|
7468
|
+
_iterator6.f();
|
|
7396
7469
|
}
|
|
7397
7470
|
return stacks;
|
|
7398
7471
|
}
|
|
@@ -7536,11 +7609,11 @@
|
|
|
7536
7609
|
var userPadding = params.padding;
|
|
7537
7610
|
var x = chartArea.x,
|
|
7538
7611
|
y = chartArea.y;
|
|
7539
|
-
var
|
|
7540
|
-
|
|
7612
|
+
var _iterator7 = _createForOfIteratorHelper$1(boxes),
|
|
7613
|
+
_step7;
|
|
7541
7614
|
try {
|
|
7542
|
-
for (
|
|
7543
|
-
var layout =
|
|
7615
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
7616
|
+
var layout = _step7.value;
|
|
7544
7617
|
var box = layout.box;
|
|
7545
7618
|
var stack = stacks[layout.stack] || {
|
|
7546
7619
|
count: 1,
|
|
@@ -7579,9 +7652,9 @@
|
|
|
7579
7652
|
}
|
|
7580
7653
|
}
|
|
7581
7654
|
} catch (err) {
|
|
7582
|
-
|
|
7655
|
+
_iterator7.e(err);
|
|
7583
7656
|
} finally {
|
|
7584
|
-
|
|
7657
|
+
_iterator7.f();
|
|
7585
7658
|
}
|
|
7586
7659
|
chartArea.x = x;
|
|
7587
7660
|
chartArea.y = y;
|
|
@@ -7820,37 +7893,37 @@
|
|
|
7820
7893
|
};
|
|
7821
7894
|
}
|
|
7822
7895
|
function nodeListContains(nodeList, canvas) {
|
|
7823
|
-
var
|
|
7824
|
-
|
|
7896
|
+
var _iterator8 = _createForOfIteratorHelper$1(nodeList),
|
|
7897
|
+
_step8;
|
|
7825
7898
|
try {
|
|
7826
|
-
for (
|
|
7827
|
-
var node =
|
|
7899
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
7900
|
+
var node = _step8.value;
|
|
7828
7901
|
if (node === canvas || node.contains(canvas)) {
|
|
7829
7902
|
return true;
|
|
7830
7903
|
}
|
|
7831
7904
|
}
|
|
7832
7905
|
} catch (err) {
|
|
7833
|
-
|
|
7906
|
+
_iterator8.e(err);
|
|
7834
7907
|
} finally {
|
|
7835
|
-
|
|
7908
|
+
_iterator8.f();
|
|
7836
7909
|
}
|
|
7837
7910
|
}
|
|
7838
7911
|
function createAttachObserver(chart, type, listener) {
|
|
7839
7912
|
var canvas = chart.canvas;
|
|
7840
7913
|
var observer = new MutationObserver(function (entries) {
|
|
7841
7914
|
var trigger = false;
|
|
7842
|
-
var
|
|
7843
|
-
|
|
7915
|
+
var _iterator9 = _createForOfIteratorHelper$1(entries),
|
|
7916
|
+
_step9;
|
|
7844
7917
|
try {
|
|
7845
|
-
for (
|
|
7846
|
-
var entry =
|
|
7918
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
7919
|
+
var entry = _step9.value;
|
|
7847
7920
|
trigger = trigger || nodeListContains(entry.addedNodes, canvas);
|
|
7848
7921
|
trigger = trigger && !nodeListContains(entry.removedNodes, canvas);
|
|
7849
7922
|
}
|
|
7850
7923
|
} catch (err) {
|
|
7851
|
-
|
|
7924
|
+
_iterator9.e(err);
|
|
7852
7925
|
} finally {
|
|
7853
|
-
|
|
7926
|
+
_iterator9.f();
|
|
7854
7927
|
}
|
|
7855
7928
|
if (trigger) {
|
|
7856
7929
|
listener();
|
|
@@ -7866,18 +7939,18 @@
|
|
|
7866
7939
|
var canvas = chart.canvas;
|
|
7867
7940
|
var observer = new MutationObserver(function (entries) {
|
|
7868
7941
|
var trigger = false;
|
|
7869
|
-
var
|
|
7870
|
-
|
|
7942
|
+
var _iterator0 = _createForOfIteratorHelper$1(entries),
|
|
7943
|
+
_step0;
|
|
7871
7944
|
try {
|
|
7872
|
-
for (
|
|
7873
|
-
var entry =
|
|
7945
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
7946
|
+
var entry = _step0.value;
|
|
7874
7947
|
trigger = trigger || nodeListContains(entry.removedNodes, canvas);
|
|
7875
7948
|
trigger = trigger && !nodeListContains(entry.addedNodes, canvas);
|
|
7876
7949
|
}
|
|
7877
7950
|
} catch (err) {
|
|
7878
|
-
|
|
7951
|
+
_iterator0.e(err);
|
|
7879
7952
|
} finally {
|
|
7880
|
-
|
|
7953
|
+
_iterator0.f();
|
|
7881
7954
|
}
|
|
7882
7955
|
if (trigger) {
|
|
7883
7956
|
listener();
|
|
@@ -9484,9 +9557,9 @@
|
|
|
9484
9557
|
value: function drawBorder() {
|
|
9485
9558
|
var chart = this.chart,
|
|
9486
9559
|
ctx = this.ctx,
|
|
9487
|
-
_this$
|
|
9488
|
-
border = _this$
|
|
9489
|
-
grid = _this$
|
|
9560
|
+
_this$options0 = this.options,
|
|
9561
|
+
border = _this$options0.border,
|
|
9562
|
+
grid = _this$options0.grid;
|
|
9490
9563
|
var borderOpts = border.setContext(this.getContext());
|
|
9491
9564
|
var axisWidth = border.display ? borderOpts.width : 0;
|
|
9492
9565
|
if (!axisWidth) {
|
|
@@ -9526,11 +9599,11 @@
|
|
|
9526
9599
|
clipArea(ctx, area);
|
|
9527
9600
|
}
|
|
9528
9601
|
var items = this.getLabelItems(chartArea);
|
|
9529
|
-
var
|
|
9530
|
-
|
|
9602
|
+
var _iterator1 = _createForOfIteratorHelper$1(items),
|
|
9603
|
+
_step1;
|
|
9531
9604
|
try {
|
|
9532
|
-
for (
|
|
9533
|
-
var item =
|
|
9605
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
9606
|
+
var item = _step1.value;
|
|
9534
9607
|
var renderTextOptions = item.options;
|
|
9535
9608
|
var tickFont = item.font;
|
|
9536
9609
|
var label = item.label;
|
|
@@ -9538,9 +9611,9 @@
|
|
|
9538
9611
|
renderText(ctx, label, 0, y, tickFont, renderTextOptions);
|
|
9539
9612
|
}
|
|
9540
9613
|
} catch (err) {
|
|
9541
|
-
|
|
9614
|
+
_iterator1.e(err);
|
|
9542
9615
|
} finally {
|
|
9543
|
-
|
|
9616
|
+
_iterator1.f();
|
|
9544
9617
|
}
|
|
9545
9618
|
if (area) {
|
|
9546
9619
|
unclipArea(ctx);
|
|
@@ -9550,10 +9623,10 @@
|
|
|
9550
9623
|
key: "drawTitle",
|
|
9551
9624
|
value: function drawTitle() {
|
|
9552
9625
|
var ctx = this.ctx,
|
|
9553
|
-
_this$
|
|
9554
|
-
position = _this$
|
|
9555
|
-
title = _this$
|
|
9556
|
-
reverse = _this$
|
|
9626
|
+
_this$options1 = this.options,
|
|
9627
|
+
position = _this$options1.position,
|
|
9628
|
+
title = _this$options1.title,
|
|
9629
|
+
reverse = _this$options1.reverse;
|
|
9557
9630
|
if (!title.display) {
|
|
9558
9631
|
return;
|
|
9559
9632
|
}
|
|
@@ -9598,7 +9671,7 @@
|
|
|
9598
9671
|
}, {
|
|
9599
9672
|
key: "_layers",
|
|
9600
9673
|
value: function _layers() {
|
|
9601
|
-
var
|
|
9674
|
+
var _this0 = this;
|
|
9602
9675
|
var opts = this.options;
|
|
9603
9676
|
var tz = opts.ticks && opts.ticks.z || 0;
|
|
9604
9677
|
var gz = valueOrDefault(opts.grid && opts.grid.z, -1);
|
|
@@ -9607,26 +9680,26 @@
|
|
|
9607
9680
|
return [{
|
|
9608
9681
|
z: tz,
|
|
9609
9682
|
draw: function draw(chartArea) {
|
|
9610
|
-
|
|
9683
|
+
_this0.draw(chartArea);
|
|
9611
9684
|
}
|
|
9612
9685
|
}];
|
|
9613
9686
|
}
|
|
9614
9687
|
return [{
|
|
9615
9688
|
z: gz,
|
|
9616
9689
|
draw: function draw(chartArea) {
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9690
|
+
_this0.drawBackground();
|
|
9691
|
+
_this0.drawGrid(chartArea);
|
|
9692
|
+
_this0.drawTitle();
|
|
9620
9693
|
}
|
|
9621
9694
|
}, {
|
|
9622
9695
|
z: bz,
|
|
9623
9696
|
draw: function draw() {
|
|
9624
|
-
|
|
9697
|
+
_this0.drawBorder();
|
|
9625
9698
|
}
|
|
9626
9699
|
}, {
|
|
9627
9700
|
z: tz,
|
|
9628
9701
|
draw: function draw(chartArea) {
|
|
9629
|
-
|
|
9702
|
+
_this0.drawLabels(chartArea);
|
|
9630
9703
|
}
|
|
9631
9704
|
}];
|
|
9632
9705
|
}
|
|
@@ -9847,23 +9920,23 @@
|
|
|
9847
9920
|
}, {
|
|
9848
9921
|
key: "removeScales",
|
|
9849
9922
|
value: function removeScales() {
|
|
9850
|
-
for (var
|
|
9851
|
-
args[
|
|
9923
|
+
for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
|
9924
|
+
args[_key0] = arguments[_key0];
|
|
9852
9925
|
}
|
|
9853
9926
|
this._each('unregister', args, this.scales);
|
|
9854
9927
|
}
|
|
9855
9928
|
}, {
|
|
9856
9929
|
key: "_each",
|
|
9857
9930
|
value: function _each(method, args, typedRegistry) {
|
|
9858
|
-
var
|
|
9931
|
+
var _this1 = this;
|
|
9859
9932
|
_toConsumableArray(args).forEach(function (arg) {
|
|
9860
|
-
var reg = typedRegistry ||
|
|
9861
|
-
if (typedRegistry || reg.isForType(arg) || reg ===
|
|
9862
|
-
|
|
9933
|
+
var reg = typedRegistry || _this1._getRegistryForType(arg);
|
|
9934
|
+
if (typedRegistry || reg.isForType(arg) || reg === _this1.plugins && arg.id) {
|
|
9935
|
+
_this1._exec(method, reg, arg);
|
|
9863
9936
|
} else {
|
|
9864
9937
|
each(arg, function (item) {
|
|
9865
|
-
var itemReg = typedRegistry ||
|
|
9866
|
-
|
|
9938
|
+
var itemReg = typedRegistry || _this1._getRegistryForType(item);
|
|
9939
|
+
_this1._exec(method, itemReg, item);
|
|
9867
9940
|
});
|
|
9868
9941
|
}
|
|
9869
9942
|
});
|
|
@@ -9902,7 +9975,7 @@
|
|
|
9902
9975
|
var PluginService = /*#__PURE__*/function () {
|
|
9903
9976
|
function PluginService() {
|
|
9904
9977
|
_classCallCheck$1(this, PluginService);
|
|
9905
|
-
this._init =
|
|
9978
|
+
this._init = undefined;
|
|
9906
9979
|
}
|
|
9907
9980
|
return _createClass$1(PluginService, [{
|
|
9908
9981
|
key: "notify",
|
|
@@ -9911,11 +9984,15 @@
|
|
|
9911
9984
|
this._init = this._createDescriptors(chart, true);
|
|
9912
9985
|
this._notify(this._init, chart, 'install');
|
|
9913
9986
|
}
|
|
9987
|
+
if (this._init === undefined) {
|
|
9988
|
+
return;
|
|
9989
|
+
}
|
|
9914
9990
|
var descriptors = filter ? this._descriptors(chart).filter(filter) : this._descriptors(chart);
|
|
9915
9991
|
var result = this._notify(descriptors, chart, hook, args);
|
|
9916
9992
|
if (hook === 'afterDestroy') {
|
|
9917
9993
|
this._notify(descriptors, chart, 'stop');
|
|
9918
9994
|
this._notify(this._init, chart, 'uninstall');
|
|
9995
|
+
this._init = undefined;
|
|
9919
9996
|
}
|
|
9920
9997
|
return result;
|
|
9921
9998
|
}
|
|
@@ -9923,11 +10000,11 @@
|
|
|
9923
10000
|
key: "_notify",
|
|
9924
10001
|
value: function _notify(descriptors, chart, hook, args) {
|
|
9925
10002
|
args = args || {};
|
|
9926
|
-
var
|
|
9927
|
-
|
|
10003
|
+
var _iterator10 = _createForOfIteratorHelper$1(descriptors),
|
|
10004
|
+
_step10;
|
|
9928
10005
|
try {
|
|
9929
|
-
for (
|
|
9930
|
-
var descriptor =
|
|
10006
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
10007
|
+
var descriptor = _step10.value;
|
|
9931
10008
|
var plugin = descriptor.plugin;
|
|
9932
10009
|
var method = plugin[hook];
|
|
9933
10010
|
var params = [chart, args, descriptor.options];
|
|
@@ -9936,9 +10013,9 @@
|
|
|
9936
10013
|
}
|
|
9937
10014
|
}
|
|
9938
10015
|
} catch (err) {
|
|
9939
|
-
|
|
10016
|
+
_iterator10.e(err);
|
|
9940
10017
|
} finally {
|
|
9941
|
-
|
|
10018
|
+
_iterator10.f();
|
|
9942
10019
|
}
|
|
9943
10020
|
return true;
|
|
9944
10021
|
}
|
|
@@ -10019,11 +10096,11 @@
|
|
|
10019
10096
|
localIds = _ref2.localIds;
|
|
10020
10097
|
var result = [];
|
|
10021
10098
|
var context = chart.getContext();
|
|
10022
|
-
var
|
|
10023
|
-
|
|
10099
|
+
var _iterator11 = _createForOfIteratorHelper$1(plugins),
|
|
10100
|
+
_step11;
|
|
10024
10101
|
try {
|
|
10025
|
-
for (
|
|
10026
|
-
var plugin =
|
|
10102
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
10103
|
+
var plugin = _step11.value;
|
|
10027
10104
|
var id = plugin.id;
|
|
10028
10105
|
var opts = getOpts(options[id], all);
|
|
10029
10106
|
if (opts === null) {
|
|
@@ -10038,9 +10115,9 @@
|
|
|
10038
10115
|
});
|
|
10039
10116
|
}
|
|
10040
10117
|
} catch (err) {
|
|
10041
|
-
|
|
10118
|
+
_iterator11.e(err);
|
|
10042
10119
|
} finally {
|
|
10043
|
-
|
|
10120
|
+
_iterator11.f();
|
|
10044
10121
|
}
|
|
10045
10122
|
return result;
|
|
10046
10123
|
}
|
|
@@ -10092,8 +10169,8 @@
|
|
|
10092
10169
|
if (idMatchesAxis(id)) {
|
|
10093
10170
|
return id;
|
|
10094
10171
|
}
|
|
10095
|
-
for (var
|
|
10096
|
-
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];
|
|
10097
10174
|
}
|
|
10098
10175
|
for (var _i3 = 0, _scaleOptions = scaleOptions; _i3 < _scaleOptions.length; _i3++) {
|
|
10099
10176
|
var opts = _scaleOptions[_i3];
|
|
@@ -10359,17 +10436,17 @@
|
|
|
10359
10436
|
var subResolver = this.createResolver(scopes, context, subPrefixes);
|
|
10360
10437
|
options = _attachContext(resolver, context, subResolver);
|
|
10361
10438
|
}
|
|
10362
|
-
var
|
|
10363
|
-
|
|
10439
|
+
var _iterator12 = _createForOfIteratorHelper$1(names),
|
|
10440
|
+
_step12;
|
|
10364
10441
|
try {
|
|
10365
|
-
for (
|
|
10366
|
-
var prop =
|
|
10442
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
10443
|
+
var prop = _step12.value;
|
|
10367
10444
|
result[prop] = options[prop];
|
|
10368
10445
|
}
|
|
10369
10446
|
} catch (err) {
|
|
10370
|
-
|
|
10447
|
+
_iterator12.e(err);
|
|
10371
10448
|
} finally {
|
|
10372
|
-
|
|
10449
|
+
_iterator12.f();
|
|
10373
10450
|
}
|
|
10374
10451
|
return result;
|
|
10375
10452
|
}
|
|
@@ -10413,11 +10490,11 @@
|
|
|
10413
10490
|
var _descriptors2 = _descriptors(proxy),
|
|
10414
10491
|
isScriptable = _descriptors2.isScriptable,
|
|
10415
10492
|
isIndexable = _descriptors2.isIndexable;
|
|
10416
|
-
var
|
|
10417
|
-
|
|
10493
|
+
var _iterator13 = _createForOfIteratorHelper$1(names),
|
|
10494
|
+
_step13;
|
|
10418
10495
|
try {
|
|
10419
|
-
for (
|
|
10420
|
-
var prop =
|
|
10496
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
10497
|
+
var prop = _step13.value;
|
|
10421
10498
|
var scriptable = isScriptable(prop);
|
|
10422
10499
|
var indexable = isIndexable(prop);
|
|
10423
10500
|
var value = (indexable || scriptable) && proxy[prop];
|
|
@@ -10426,13 +10503,13 @@
|
|
|
10426
10503
|
}
|
|
10427
10504
|
}
|
|
10428
10505
|
} catch (err) {
|
|
10429
|
-
|
|
10506
|
+
_iterator13.e(err);
|
|
10430
10507
|
} finally {
|
|
10431
|
-
|
|
10508
|
+
_iterator13.f();
|
|
10432
10509
|
}
|
|
10433
10510
|
return false;
|
|
10434
10511
|
}
|
|
10435
|
-
var version = "4.
|
|
10512
|
+
var version = "4.5.1";
|
|
10436
10513
|
var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
|
|
10437
10514
|
function positionIsHorizontal(position, axis) {
|
|
10438
10515
|
return position === 'top' || position === 'bottom' || KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x';
|
|
@@ -10494,25 +10571,9 @@
|
|
|
10494
10571
|
}
|
|
10495
10572
|
return e;
|
|
10496
10573
|
}
|
|
10497
|
-
function getSizeForArea(scale, chartArea, field) {
|
|
10498
|
-
return scale.options.clip ? scale[field] : chartArea[field];
|
|
10499
|
-
}
|
|
10500
|
-
function getDatasetArea(meta, chartArea) {
|
|
10501
|
-
var xScale = meta.xScale,
|
|
10502
|
-
yScale = meta.yScale;
|
|
10503
|
-
if (xScale && yScale) {
|
|
10504
|
-
return {
|
|
10505
|
-
left: getSizeForArea(xScale, chartArea, 'left'),
|
|
10506
|
-
right: getSizeForArea(xScale, chartArea, 'right'),
|
|
10507
|
-
top: getSizeForArea(yScale, chartArea, 'top'),
|
|
10508
|
-
bottom: getSizeForArea(yScale, chartArea, 'bottom')
|
|
10509
|
-
};
|
|
10510
|
-
}
|
|
10511
|
-
return chartArea;
|
|
10512
|
-
}
|
|
10513
10574
|
var Chart = /*#__PURE__*/function () {
|
|
10514
10575
|
function Chart(item, userConfig) {
|
|
10515
|
-
var
|
|
10576
|
+
var _this10 = this;
|
|
10516
10577
|
_classCallCheck$1(this, Chart);
|
|
10517
10578
|
var config = this.config = new Config(userConfig);
|
|
10518
10579
|
var initialCanvas = getCanvas(item);
|
|
@@ -10553,7 +10614,7 @@
|
|
|
10553
10614
|
this._animationsDisabled = undefined;
|
|
10554
10615
|
this.$context = undefined;
|
|
10555
10616
|
this._doResize = debounce(function (mode) {
|
|
10556
|
-
return
|
|
10617
|
+
return _this10.update(mode);
|
|
10557
10618
|
}, options.resizeDelay || 0);
|
|
10558
10619
|
this._dataChanges = [];
|
|
10559
10620
|
instances[this.id] = this;
|
|
@@ -10571,9 +10632,9 @@
|
|
|
10571
10632
|
return _createClass$1(Chart, [{
|
|
10572
10633
|
key: "aspectRatio",
|
|
10573
10634
|
get: function get() {
|
|
10574
|
-
var _this$
|
|
10575
|
-
aspectRatio = _this$
|
|
10576
|
-
maintainAspectRatio = _this$
|
|
10635
|
+
var _this$options10 = this.options,
|
|
10636
|
+
aspectRatio = _this$options10.aspectRatio,
|
|
10637
|
+
maintainAspectRatio = _this$options10.maintainAspectRatio,
|
|
10577
10638
|
width = this.width,
|
|
10578
10639
|
height = this.height,
|
|
10579
10640
|
_aspectRatio = this._aspectRatio;
|
|
@@ -10680,7 +10741,7 @@
|
|
|
10680
10741
|
}, {
|
|
10681
10742
|
key: "buildOrUpdateScales",
|
|
10682
10743
|
value: function buildOrUpdateScales() {
|
|
10683
|
-
var
|
|
10744
|
+
var _this11 = this;
|
|
10684
10745
|
var options = this.options;
|
|
10685
10746
|
var scaleOpts = options.scales;
|
|
10686
10747
|
var scales = this.scales;
|
|
@@ -10719,8 +10780,8 @@
|
|
|
10719
10780
|
scale = new scaleClass({
|
|
10720
10781
|
id: id,
|
|
10721
10782
|
type: scaleType,
|
|
10722
|
-
ctx:
|
|
10723
|
-
chart:
|
|
10783
|
+
ctx: _this11.ctx,
|
|
10784
|
+
chart: _this11
|
|
10724
10785
|
});
|
|
10725
10786
|
scales[scale.id] = scale;
|
|
10726
10787
|
}
|
|
@@ -10732,8 +10793,8 @@
|
|
|
10732
10793
|
}
|
|
10733
10794
|
});
|
|
10734
10795
|
each(scales, function (scale) {
|
|
10735
|
-
layouts.configure(
|
|
10736
|
-
layouts.addBox(
|
|
10796
|
+
layouts.configure(_this11, scale, scale.options);
|
|
10797
|
+
layouts.addBox(_this11, scale);
|
|
10737
10798
|
});
|
|
10738
10799
|
}
|
|
10739
10800
|
}, {
|
|
@@ -10756,7 +10817,7 @@
|
|
|
10756
10817
|
}, {
|
|
10757
10818
|
key: "_removeUnreferencedMetasets",
|
|
10758
10819
|
value: function _removeUnreferencedMetasets() {
|
|
10759
|
-
var
|
|
10820
|
+
var _this12 = this;
|
|
10760
10821
|
var metasets = this._metasets,
|
|
10761
10822
|
datasets = this.data.datasets;
|
|
10762
10823
|
if (metasets.length > datasets.length) {
|
|
@@ -10766,7 +10827,7 @@
|
|
|
10766
10827
|
if (datasets.filter(function (x) {
|
|
10767
10828
|
return x === meta._dataset;
|
|
10768
10829
|
}).length === 0) {
|
|
10769
|
-
|
|
10830
|
+
_this12._destroyDatasetMeta(index);
|
|
10770
10831
|
}
|
|
10771
10832
|
});
|
|
10772
10833
|
}
|
|
@@ -10813,9 +10874,9 @@
|
|
|
10813
10874
|
}, {
|
|
10814
10875
|
key: "_resetElements",
|
|
10815
10876
|
value: function _resetElements() {
|
|
10816
|
-
var
|
|
10877
|
+
var _this13 = this;
|
|
10817
10878
|
each(this.data.datasets, function (dataset, datasetIndex) {
|
|
10818
|
-
|
|
10879
|
+
_this13.getDatasetMeta(datasetIndex).controller.reset();
|
|
10819
10880
|
}, this);
|
|
10820
10881
|
}
|
|
10821
10882
|
}, {
|
|
@@ -10875,9 +10936,9 @@
|
|
|
10875
10936
|
}, {
|
|
10876
10937
|
key: "_updateScales",
|
|
10877
10938
|
value: function _updateScales() {
|
|
10878
|
-
var
|
|
10939
|
+
var _this14 = this;
|
|
10879
10940
|
each(this.scales, function (scale) {
|
|
10880
|
-
layouts.removeBox(
|
|
10941
|
+
layouts.removeBox(_this14, scale);
|
|
10881
10942
|
});
|
|
10882
10943
|
this.ensureScalesHaveIDs();
|
|
10883
10944
|
this.buildOrUpdateScales();
|
|
@@ -10898,21 +10959,21 @@
|
|
|
10898
10959
|
value: function _updateHiddenIndices() {
|
|
10899
10960
|
var _hiddenIndices = this._hiddenIndices;
|
|
10900
10961
|
var changes = this._getUniformDataChanges() || [];
|
|
10901
|
-
var
|
|
10902
|
-
|
|
10962
|
+
var _iterator14 = _createForOfIteratorHelper$1(changes),
|
|
10963
|
+
_step14;
|
|
10903
10964
|
try {
|
|
10904
|
-
for (
|
|
10905
|
-
var
|
|
10906
|
-
method =
|
|
10907
|
-
start =
|
|
10908
|
-
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;
|
|
10909
10970
|
var move = method === '_removeElements' ? -count : count;
|
|
10910
10971
|
moveNumericKeys(_hiddenIndices, start, move);
|
|
10911
10972
|
}
|
|
10912
10973
|
} catch (err) {
|
|
10913
|
-
|
|
10974
|
+
_iterator14.e(err);
|
|
10914
10975
|
} finally {
|
|
10915
|
-
|
|
10976
|
+
_iterator14.f();
|
|
10916
10977
|
}
|
|
10917
10978
|
}
|
|
10918
10979
|
}, {
|
|
@@ -10950,7 +11011,7 @@
|
|
|
10950
11011
|
}, {
|
|
10951
11012
|
key: "_updateLayout",
|
|
10952
11013
|
value: function _updateLayout(minPadding) {
|
|
10953
|
-
var
|
|
11014
|
+
var _this15 = this;
|
|
10954
11015
|
if (this.notifyPlugins('beforeLayout', {
|
|
10955
11016
|
cancelable: true
|
|
10956
11017
|
}) === false) {
|
|
@@ -10961,14 +11022,14 @@
|
|
|
10961
11022
|
var noArea = area.width <= 0 || area.height <= 0;
|
|
10962
11023
|
this._layers = [];
|
|
10963
11024
|
each(this.boxes, function (box) {
|
|
10964
|
-
var
|
|
11025
|
+
var _this15$_layers;
|
|
10965
11026
|
if (noArea && box.position === 'chartArea') {
|
|
10966
11027
|
return;
|
|
10967
11028
|
}
|
|
10968
11029
|
if (box.configure) {
|
|
10969
11030
|
box.configure();
|
|
10970
11031
|
}
|
|
10971
|
-
(
|
|
11032
|
+
(_this15$_layers = _this15._layers).push.apply(_this15$_layers, _toConsumableArray(box._layers()));
|
|
10972
11033
|
}, this);
|
|
10973
11034
|
this._layers.forEach(function (item, index) {
|
|
10974
11035
|
item._idx = index;
|
|
@@ -11099,27 +11160,20 @@
|
|
|
11099
11160
|
key: "_drawDataset",
|
|
11100
11161
|
value: function _drawDataset(meta) {
|
|
11101
11162
|
var ctx = this.ctx;
|
|
11102
|
-
var clip = meta._clip;
|
|
11103
|
-
var useClip = !clip.disabled;
|
|
11104
|
-
var area = getDatasetArea(meta, this.chartArea);
|
|
11105
11163
|
var args = {
|
|
11106
11164
|
meta: meta,
|
|
11107
11165
|
index: meta.index,
|
|
11108
11166
|
cancelable: true
|
|
11109
11167
|
};
|
|
11168
|
+
var clip = getDatasetClipArea(this, meta);
|
|
11110
11169
|
if (this.notifyPlugins('beforeDatasetDraw', args) === false) {
|
|
11111
11170
|
return;
|
|
11112
11171
|
}
|
|
11113
|
-
if (
|
|
11114
|
-
clipArea(ctx,
|
|
11115
|
-
left: clip.left === false ? 0 : area.left - clip.left,
|
|
11116
|
-
right: clip.right === false ? this.width : area.right + clip.right,
|
|
11117
|
-
top: clip.top === false ? 0 : area.top - clip.top,
|
|
11118
|
-
bottom: clip.bottom === false ? this.height : area.bottom + clip.bottom
|
|
11119
|
-
});
|
|
11172
|
+
if (clip) {
|
|
11173
|
+
clipArea(ctx, clip);
|
|
11120
11174
|
}
|
|
11121
11175
|
meta.controller.draw();
|
|
11122
|
-
if (
|
|
11176
|
+
if (clip) {
|
|
11123
11177
|
unclipArea(ctx);
|
|
11124
11178
|
}
|
|
11125
11179
|
args.cancelable = false;
|
|
@@ -11290,17 +11344,17 @@
|
|
|
11290
11344
|
}, {
|
|
11291
11345
|
key: "bindUserEvents",
|
|
11292
11346
|
value: function bindUserEvents() {
|
|
11293
|
-
var
|
|
11347
|
+
var _this16 = this;
|
|
11294
11348
|
var listeners = this._listeners;
|
|
11295
11349
|
var platform = this.platform;
|
|
11296
11350
|
var _add = function _add(type, listener) {
|
|
11297
|
-
platform.addEventListener(
|
|
11351
|
+
platform.addEventListener(_this16, type, listener);
|
|
11298
11352
|
listeners[type] = listener;
|
|
11299
11353
|
};
|
|
11300
11354
|
var listener = function listener(e, x, y) {
|
|
11301
11355
|
e.offsetX = x;
|
|
11302
11356
|
e.offsetY = y;
|
|
11303
|
-
|
|
11357
|
+
_this16._eventHandler(e);
|
|
11304
11358
|
};
|
|
11305
11359
|
each(this.options.events, function (type) {
|
|
11306
11360
|
return _add(type, listener);
|
|
@@ -11309,40 +11363,40 @@
|
|
|
11309
11363
|
}, {
|
|
11310
11364
|
key: "bindResponsiveEvents",
|
|
11311
11365
|
value: function bindResponsiveEvents() {
|
|
11312
|
-
var
|
|
11366
|
+
var _this17 = this;
|
|
11313
11367
|
if (!this._responsiveListeners) {
|
|
11314
11368
|
this._responsiveListeners = {};
|
|
11315
11369
|
}
|
|
11316
11370
|
var listeners = this._responsiveListeners;
|
|
11317
11371
|
var platform = this.platform;
|
|
11318
11372
|
var _add = function _add(type, listener) {
|
|
11319
|
-
platform.addEventListener(
|
|
11373
|
+
platform.addEventListener(_this17, type, listener);
|
|
11320
11374
|
listeners[type] = listener;
|
|
11321
11375
|
};
|
|
11322
11376
|
var _remove = function _remove(type, listener) {
|
|
11323
11377
|
if (listeners[type]) {
|
|
11324
|
-
platform.removeEventListener(
|
|
11378
|
+
platform.removeEventListener(_this17, type, listener);
|
|
11325
11379
|
delete listeners[type];
|
|
11326
11380
|
}
|
|
11327
11381
|
};
|
|
11328
11382
|
var listener = function listener(width, height) {
|
|
11329
|
-
if (
|
|
11330
|
-
|
|
11383
|
+
if (_this17.canvas) {
|
|
11384
|
+
_this17.resize(width, height);
|
|
11331
11385
|
}
|
|
11332
11386
|
};
|
|
11333
11387
|
var detached;
|
|
11334
11388
|
var _attached = function attached() {
|
|
11335
11389
|
_remove('attach', _attached);
|
|
11336
|
-
|
|
11337
|
-
|
|
11390
|
+
_this17.attached = true;
|
|
11391
|
+
_this17.resize();
|
|
11338
11392
|
_add('resize', listener);
|
|
11339
11393
|
_add('detach', detached);
|
|
11340
11394
|
};
|
|
11341
11395
|
detached = function detached() {
|
|
11342
|
-
|
|
11396
|
+
_this17.attached = false;
|
|
11343
11397
|
_remove('resize', listener);
|
|
11344
|
-
|
|
11345
|
-
|
|
11398
|
+
_this17._stop();
|
|
11399
|
+
_this17._resize(0, 0);
|
|
11346
11400
|
_add('attach', _attached);
|
|
11347
11401
|
};
|
|
11348
11402
|
if (platform.isAttached(this.canvas)) {
|
|
@@ -11354,13 +11408,13 @@
|
|
|
11354
11408
|
}, {
|
|
11355
11409
|
key: "unbindEvents",
|
|
11356
11410
|
value: function unbindEvents() {
|
|
11357
|
-
var
|
|
11411
|
+
var _this18 = this;
|
|
11358
11412
|
each(this._listeners, function (listener, type) {
|
|
11359
|
-
|
|
11413
|
+
_this18.platform.removeEventListener(_this18, type, listener);
|
|
11360
11414
|
});
|
|
11361
11415
|
this._listeners = {};
|
|
11362
11416
|
each(this._responsiveListeners, function (listener, type) {
|
|
11363
|
-
|
|
11417
|
+
_this18.platform.removeEventListener(_this18, type, listener);
|
|
11364
11418
|
});
|
|
11365
11419
|
this._responsiveListeners = undefined;
|
|
11366
11420
|
}
|
|
@@ -11389,12 +11443,12 @@
|
|
|
11389
11443
|
}, {
|
|
11390
11444
|
key: "setActiveElements",
|
|
11391
11445
|
value: function setActiveElements(activeElements) {
|
|
11392
|
-
var
|
|
11446
|
+
var _this19 = this;
|
|
11393
11447
|
var lastActive = this._active || [];
|
|
11394
11448
|
var active = activeElements.map(function (_ref4) {
|
|
11395
11449
|
var datasetIndex = _ref4.datasetIndex,
|
|
11396
11450
|
index = _ref4.index;
|
|
11397
|
-
var meta =
|
|
11451
|
+
var meta = _this19.getDatasetMeta(datasetIndex);
|
|
11398
11452
|
if (!meta) {
|
|
11399
11453
|
throw new Error('No dataset found at index ' + datasetIndex);
|
|
11400
11454
|
}
|
|
@@ -11446,7 +11500,7 @@
|
|
|
11446
11500
|
}, {
|
|
11447
11501
|
key: "_eventHandler",
|
|
11448
11502
|
value: function _eventHandler(e, replay) {
|
|
11449
|
-
var
|
|
11503
|
+
var _this20 = this;
|
|
11450
11504
|
var args = {
|
|
11451
11505
|
event: e,
|
|
11452
11506
|
replay: replay,
|
|
@@ -11454,7 +11508,7 @@
|
|
|
11454
11508
|
inChartArea: this.isPointInArea(e)
|
|
11455
11509
|
};
|
|
11456
11510
|
var eventFilter = function eventFilter(plugin) {
|
|
11457
|
-
return (plugin.options.events ||
|
|
11511
|
+
return (plugin.options.events || _this20.options.events).includes(e["native"].type);
|
|
11458
11512
|
};
|
|
11459
11513
|
if (this.notifyPlugins('beforeEvent', args, eventFilter) === false) {
|
|
11460
11514
|
return;
|
|
@@ -11529,6 +11583,40 @@
|
|
|
11529
11583
|
return chart._plugins.invalidate();
|
|
11530
11584
|
});
|
|
11531
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
|
+
}
|
|
11532
11620
|
function clipArc(ctx, element, endAngle) {
|
|
11533
11621
|
var startAngle = element.startAngle,
|
|
11534
11622
|
pixelMargin = element.pixelMargin,
|
|
@@ -11711,7 +11799,8 @@
|
|
|
11711
11799
|
var borderWidth = options.borderWidth,
|
|
11712
11800
|
borderJoinStyle = options.borderJoinStyle,
|
|
11713
11801
|
borderDash = options.borderDash,
|
|
11714
|
-
borderDashOffset = options.borderDashOffset
|
|
11802
|
+
borderDashOffset = options.borderDashOffset,
|
|
11803
|
+
borderRadius = options.borderRadius;
|
|
11715
11804
|
var inner = options.borderAlign === 'inner';
|
|
11716
11805
|
if (!borderWidth) {
|
|
11717
11806
|
return;
|
|
@@ -11738,6 +11827,9 @@
|
|
|
11738
11827
|
if (inner) {
|
|
11739
11828
|
clipArc(ctx, element, endAngle);
|
|
11740
11829
|
}
|
|
11830
|
+
if (options.selfJoin && endAngle - startAngle >= PI && borderRadius === 0 && borderJoinStyle !== 'miter') {
|
|
11831
|
+
clipSelf(ctx, element, endAngle);
|
|
11832
|
+
}
|
|
11741
11833
|
if (!fullCircles) {
|
|
11742
11834
|
pathArc(ctx, element, offset, spacing, endAngle, circular);
|
|
11743
11835
|
ctx.stroke();
|
|
@@ -11745,28 +11837,28 @@
|
|
|
11745
11837
|
}
|
|
11746
11838
|
var ArcElement = /*#__PURE__*/function (_Element3) {
|
|
11747
11839
|
function ArcElement(cfg) {
|
|
11748
|
-
var
|
|
11840
|
+
var _this21;
|
|
11749
11841
|
_classCallCheck$1(this, ArcElement);
|
|
11750
|
-
|
|
11751
|
-
_defineProperty$1(
|
|
11752
|
-
_defineProperty$1(
|
|
11753
|
-
_defineProperty$1(
|
|
11754
|
-
_defineProperty$1(
|
|
11755
|
-
_defineProperty$1(
|
|
11756
|
-
_defineProperty$1(
|
|
11757
|
-
_defineProperty$1(
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
|
|
11761
|
-
|
|
11762
|
-
|
|
11763
|
-
|
|
11764
|
-
|
|
11765
|
-
|
|
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;
|
|
11766
11858
|
if (cfg) {
|
|
11767
|
-
Object.assign(
|
|
11859
|
+
Object.assign(_this21, cfg);
|
|
11768
11860
|
}
|
|
11769
|
-
return
|
|
11861
|
+
return _this21;
|
|
11770
11862
|
}
|
|
11771
11863
|
_inherits$1(ArcElement, _Element3);
|
|
11772
11864
|
return _createClass$1(ArcElement, [{
|
|
@@ -11802,9 +11894,9 @@
|
|
|
11802
11894
|
endAngle = _this$getProps3.endAngle,
|
|
11803
11895
|
innerRadius = _this$getProps3.innerRadius,
|
|
11804
11896
|
outerRadius = _this$getProps3.outerRadius;
|
|
11805
|
-
var _this$
|
|
11806
|
-
offset = _this$
|
|
11807
|
-
spacing = _this$
|
|
11897
|
+
var _this$options11 = this.options,
|
|
11898
|
+
offset = _this$options11.offset,
|
|
11899
|
+
spacing = _this$options11.spacing;
|
|
11808
11900
|
var halfAngle = (startAngle + endAngle) / 2;
|
|
11809
11901
|
var halfRadius = (innerRadius + outerRadius + spacing + offset) / 2;
|
|
11810
11902
|
return {
|
|
@@ -11855,7 +11947,8 @@
|
|
|
11855
11947
|
offset: 0,
|
|
11856
11948
|
spacing: 0,
|
|
11857
11949
|
angle: undefined,
|
|
11858
|
-
circular: true
|
|
11950
|
+
circular: true,
|
|
11951
|
+
selfJoin: false
|
|
11859
11952
|
});
|
|
11860
11953
|
_defineProperty$1(ArcElement, "defaultRoutes", {
|
|
11861
11954
|
backgroundColor: 'backgroundColor'
|
|
@@ -12021,11 +12114,11 @@
|
|
|
12021
12114
|
var segments = line.segments,
|
|
12022
12115
|
options = line.options;
|
|
12023
12116
|
var segmentMethod = _getSegmentMethod(line);
|
|
12024
|
-
var
|
|
12025
|
-
|
|
12117
|
+
var _iterator15 = _createForOfIteratorHelper$1(segments),
|
|
12118
|
+
_step15;
|
|
12026
12119
|
try {
|
|
12027
|
-
for (
|
|
12028
|
-
var segment =
|
|
12120
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
|
12121
|
+
var segment = _step15.value;
|
|
12029
12122
|
setStyle(ctx, options, segment.style);
|
|
12030
12123
|
ctx.beginPath();
|
|
12031
12124
|
if (segmentMethod(ctx, line, segment, {
|
|
@@ -12037,9 +12130,9 @@
|
|
|
12037
12130
|
ctx.stroke();
|
|
12038
12131
|
}
|
|
12039
12132
|
} catch (err) {
|
|
12040
|
-
|
|
12133
|
+
_iterator15.e(err);
|
|
12041
12134
|
} finally {
|
|
12042
|
-
|
|
12135
|
+
_iterator15.f();
|
|
12043
12136
|
}
|
|
12044
12137
|
}
|
|
12045
12138
|
var usePath2D = typeof Path2D === 'function';
|
|
@@ -12052,24 +12145,24 @@
|
|
|
12052
12145
|
}
|
|
12053
12146
|
var LineElement = /*#__PURE__*/function (_Element4) {
|
|
12054
12147
|
function LineElement(cfg) {
|
|
12055
|
-
var
|
|
12148
|
+
var _this22;
|
|
12056
12149
|
_classCallCheck$1(this, LineElement);
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
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;
|
|
12069
12162
|
if (cfg) {
|
|
12070
|
-
Object.assign(
|
|
12163
|
+
Object.assign(_this22, cfg);
|
|
12071
12164
|
}
|
|
12072
|
-
return
|
|
12165
|
+
return _this22;
|
|
12073
12166
|
}
|
|
12074
12167
|
_inherits$1(LineElement, _Element4);
|
|
12075
12168
|
return _createClass$1(LineElement, [{
|
|
@@ -12161,20 +12254,20 @@
|
|
|
12161
12254
|
var loop = this._loop;
|
|
12162
12255
|
start = start || 0;
|
|
12163
12256
|
count = count || this.points.length - start;
|
|
12164
|
-
var
|
|
12165
|
-
|
|
12257
|
+
var _iterator16 = _createForOfIteratorHelper$1(segments),
|
|
12258
|
+
_step16;
|
|
12166
12259
|
try {
|
|
12167
|
-
for (
|
|
12168
|
-
var segment =
|
|
12260
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
|
12261
|
+
var segment = _step16.value;
|
|
12169
12262
|
loop &= segmentMethod(ctx, this, segment, {
|
|
12170
12263
|
start: start,
|
|
12171
12264
|
end: start + count - 1
|
|
12172
12265
|
});
|
|
12173
12266
|
}
|
|
12174
12267
|
} catch (err) {
|
|
12175
|
-
|
|
12268
|
+
_iterator16.e(err);
|
|
12176
12269
|
} finally {
|
|
12177
|
-
|
|
12270
|
+
_iterator16.f();
|
|
12178
12271
|
}
|
|
12179
12272
|
return !!loop;
|
|
12180
12273
|
}
|
|
@@ -12227,20 +12320,20 @@
|
|
|
12227
12320
|
}
|
|
12228
12321
|
var PointElement = /*#__PURE__*/function (_Element5) {
|
|
12229
12322
|
function PointElement(cfg) {
|
|
12230
|
-
var
|
|
12323
|
+
var _this23;
|
|
12231
12324
|
_classCallCheck$1(this, PointElement);
|
|
12232
|
-
|
|
12233
|
-
_defineProperty$1(
|
|
12234
|
-
_defineProperty$1(
|
|
12235
|
-
_defineProperty$1(
|
|
12236
|
-
|
|
12237
|
-
|
|
12238
|
-
|
|
12239
|
-
|
|
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;
|
|
12240
12333
|
if (cfg) {
|
|
12241
|
-
Object.assign(
|
|
12334
|
+
Object.assign(_this23, cfg);
|
|
12242
12335
|
}
|
|
12243
|
-
return
|
|
12336
|
+
return _this23;
|
|
12244
12337
|
}
|
|
12245
12338
|
_inherits$1(PointElement, _Element5);
|
|
12246
12339
|
return _createClass$1(PointElement, [{
|
|
@@ -12437,28 +12530,28 @@
|
|
|
12437
12530
|
}
|
|
12438
12531
|
var BarElement = /*#__PURE__*/function (_Element6) {
|
|
12439
12532
|
function BarElement(cfg) {
|
|
12440
|
-
var
|
|
12533
|
+
var _this24;
|
|
12441
12534
|
_classCallCheck$1(this, BarElement);
|
|
12442
|
-
|
|
12443
|
-
|
|
12444
|
-
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
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;
|
|
12449
12542
|
if (cfg) {
|
|
12450
|
-
Object.assign(
|
|
12543
|
+
Object.assign(_this24, cfg);
|
|
12451
12544
|
}
|
|
12452
|
-
return
|
|
12545
|
+
return _this24;
|
|
12453
12546
|
}
|
|
12454
12547
|
_inherits$1(BarElement, _Element6);
|
|
12455
12548
|
return _createClass$1(BarElement, [{
|
|
12456
12549
|
key: "draw",
|
|
12457
12550
|
value: function draw(ctx) {
|
|
12458
12551
|
var inflateAmount = this.inflateAmount,
|
|
12459
|
-
_this$
|
|
12460
|
-
borderColor = _this$
|
|
12461
|
-
backgroundColor = _this$
|
|
12552
|
+
_this$options12 = this.options,
|
|
12553
|
+
borderColor = _this$options12.borderColor,
|
|
12554
|
+
backgroundColor = _this$options12.backgroundColor;
|
|
12462
12555
|
var _boundingRects = boundingRects(this),
|
|
12463
12556
|
inner = _boundingRects.inner,
|
|
12464
12557
|
outer = _boundingRects.outer;
|
|
@@ -12823,11 +12916,11 @@
|
|
|
12823
12916
|
var points = line.points;
|
|
12824
12917
|
var tpoints = target.points;
|
|
12825
12918
|
var parts = [];
|
|
12826
|
-
var
|
|
12827
|
-
|
|
12919
|
+
var _iterator17 = _createForOfIteratorHelper$1(segments),
|
|
12920
|
+
_step17;
|
|
12828
12921
|
try {
|
|
12829
|
-
for (
|
|
12830
|
-
var segment =
|
|
12922
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
|
12923
|
+
var segment = _step17.value;
|
|
12831
12924
|
var start = segment.start,
|
|
12832
12925
|
end = segment.end;
|
|
12833
12926
|
end = _findSegmentEnd(start, end, points);
|
|
@@ -12842,18 +12935,18 @@
|
|
|
12842
12935
|
continue;
|
|
12843
12936
|
}
|
|
12844
12937
|
var targetSegments = _boundSegments(target, bounds);
|
|
12845
|
-
var
|
|
12846
|
-
|
|
12938
|
+
var _iterator18 = _createForOfIteratorHelper$1(targetSegments),
|
|
12939
|
+
_step18;
|
|
12847
12940
|
try {
|
|
12848
|
-
for (
|
|
12849
|
-
var tgt =
|
|
12941
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
|
12942
|
+
var tgt = _step18.value;
|
|
12850
12943
|
var subBounds = _getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);
|
|
12851
12944
|
var fillSources = _boundSegment(segment, points, subBounds);
|
|
12852
|
-
var
|
|
12853
|
-
|
|
12945
|
+
var _iterator19 = _createForOfIteratorHelper$1(fillSources),
|
|
12946
|
+
_step19;
|
|
12854
12947
|
try {
|
|
12855
|
-
for (
|
|
12856
|
-
var fillSource =
|
|
12948
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
|
12949
|
+
var fillSource = _step19.value;
|
|
12857
12950
|
parts.push({
|
|
12858
12951
|
source: fillSource,
|
|
12859
12952
|
target: tgt,
|
|
@@ -12862,21 +12955,21 @@
|
|
|
12862
12955
|
});
|
|
12863
12956
|
}
|
|
12864
12957
|
} catch (err) {
|
|
12865
|
-
|
|
12958
|
+
_iterator19.e(err);
|
|
12866
12959
|
} finally {
|
|
12867
|
-
|
|
12960
|
+
_iterator19.f();
|
|
12868
12961
|
}
|
|
12869
12962
|
}
|
|
12870
12963
|
} catch (err) {
|
|
12871
|
-
|
|
12964
|
+
_iterator18.e(err);
|
|
12872
12965
|
} finally {
|
|
12873
|
-
|
|
12966
|
+
_iterator18.f();
|
|
12874
12967
|
}
|
|
12875
12968
|
}
|
|
12876
12969
|
} catch (err) {
|
|
12877
|
-
|
|
12970
|
+
_iterator17.e(err);
|
|
12878
12971
|
} finally {
|
|
12879
|
-
|
|
12972
|
+
_iterator17.f();
|
|
12880
12973
|
}
|
|
12881
12974
|
return parts;
|
|
12882
12975
|
}
|
|
@@ -13241,7 +13334,9 @@
|
|
|
13241
13334
|
}
|
|
13242
13335
|
function _drawfill(ctx, source, area) {
|
|
13243
13336
|
var target = _getTarget(source);
|
|
13244
|
-
var
|
|
13337
|
+
var chart = source.chart,
|
|
13338
|
+
index = source.index,
|
|
13339
|
+
line = source.line,
|
|
13245
13340
|
scale = source.scale,
|
|
13246
13341
|
axis = source.axis;
|
|
13247
13342
|
var lineOpts = line.options;
|
|
@@ -13252,6 +13347,8 @@
|
|
|
13252
13347
|
above = _ref9$above === void 0 ? color : _ref9$above,
|
|
13253
13348
|
_ref9$below = _ref9.below,
|
|
13254
13349
|
below = _ref9$below === void 0 ? color : _ref9$below;
|
|
13350
|
+
var meta = chart.getDatasetMeta(index);
|
|
13351
|
+
var clip = getDatasetClipArea(chart, meta);
|
|
13255
13352
|
if (target && line.points.length) {
|
|
13256
13353
|
clipArea(ctx, area);
|
|
13257
13354
|
doFill(ctx, {
|
|
@@ -13261,7 +13358,8 @@
|
|
|
13261
13358
|
below: below,
|
|
13262
13359
|
area: area,
|
|
13263
13360
|
scale: scale,
|
|
13264
|
-
axis: axis
|
|
13361
|
+
axis: axis,
|
|
13362
|
+
clip: clip
|
|
13265
13363
|
});
|
|
13266
13364
|
unclipArea(ctx);
|
|
13267
13365
|
}
|
|
@@ -13272,32 +13370,92 @@
|
|
|
13272
13370
|
above = cfg.above,
|
|
13273
13371
|
below = cfg.below,
|
|
13274
13372
|
area = cfg.area,
|
|
13275
|
-
scale = cfg.scale
|
|
13373
|
+
scale = cfg.scale,
|
|
13374
|
+
clip = cfg.clip;
|
|
13276
13375
|
var property = line._loop ? 'angle' : cfg.axis;
|
|
13277
13376
|
ctx.save();
|
|
13278
|
-
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
|
|
13282
|
-
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
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
|
+
}
|
|
13290
13407
|
}
|
|
13291
13408
|
fill(ctx, {
|
|
13292
13409
|
line: line,
|
|
13293
13410
|
target: target,
|
|
13294
|
-
color:
|
|
13411
|
+
color: fillColor,
|
|
13295
13412
|
scale: scale,
|
|
13296
|
-
property: property
|
|
13413
|
+
property: property,
|
|
13414
|
+
clip: clip
|
|
13297
13415
|
});
|
|
13298
13416
|
ctx.restore();
|
|
13299
13417
|
}
|
|
13300
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) {
|
|
13301
13459
|
var segments = target.segments,
|
|
13302
13460
|
points = target.points;
|
|
13303
13461
|
var first = true;
|
|
@@ -13316,7 +13474,7 @@
|
|
|
13316
13474
|
ctx.moveTo(firstPoint.x, firstPoint.y);
|
|
13317
13475
|
first = false;
|
|
13318
13476
|
} else {
|
|
13319
|
-
ctx.lineTo(firstPoint.
|
|
13477
|
+
ctx.lineTo(clipX, firstPoint.y);
|
|
13320
13478
|
ctx.lineTo(firstPoint.x, firstPoint.y);
|
|
13321
13479
|
}
|
|
13322
13480
|
lineLoop = !!target.pathSegment(ctx, segment, {
|
|
@@ -13325,7 +13483,7 @@
|
|
|
13325
13483
|
if (lineLoop) {
|
|
13326
13484
|
ctx.closePath();
|
|
13327
13485
|
} else {
|
|
13328
|
-
ctx.lineTo(lastPoint.
|
|
13486
|
+
ctx.lineTo(clipX, lastPoint.y);
|
|
13329
13487
|
}
|
|
13330
13488
|
}
|
|
13331
13489
|
} catch (err) {
|
|
@@ -13333,7 +13491,7 @@
|
|
|
13333
13491
|
} finally {
|
|
13334
13492
|
_iterator21.f();
|
|
13335
13493
|
}
|
|
13336
|
-
ctx.lineTo(target.first().
|
|
13494
|
+
ctx.lineTo(clipX, target.first().y);
|
|
13337
13495
|
ctx.closePath();
|
|
13338
13496
|
ctx.clip();
|
|
13339
13497
|
}
|
|
@@ -13342,7 +13500,8 @@
|
|
|
13342
13500
|
target = cfg.target,
|
|
13343
13501
|
property = cfg.property,
|
|
13344
13502
|
color = cfg.color,
|
|
13345
|
-
scale = cfg.scale
|
|
13503
|
+
scale = cfg.scale,
|
|
13504
|
+
clip = cfg.clip;
|
|
13346
13505
|
var segments = _segments(line, target, property);
|
|
13347
13506
|
var _iterator22 = _createForOfIteratorHelper$1(segments),
|
|
13348
13507
|
_step22;
|
|
@@ -13360,7 +13519,7 @@
|
|
|
13360
13519
|
var notShape = target !== true;
|
|
13361
13520
|
ctx.save();
|
|
13362
13521
|
ctx.fillStyle = backgroundColor;
|
|
13363
|
-
clipBounds(ctx, scale, notShape && _getBounds(property, start, end));
|
|
13522
|
+
clipBounds(ctx, scale, clip, notShape && _getBounds(property, start, end));
|
|
13364
13523
|
ctx.beginPath();
|
|
13365
13524
|
var lineLoop = !!line.pathSegment(ctx, src);
|
|
13366
13525
|
var loop = void 0;
|
|
@@ -13389,17 +13548,33 @@
|
|
|
13389
13548
|
_iterator22.f();
|
|
13390
13549
|
}
|
|
13391
13550
|
}
|
|
13392
|
-
function clipBounds(ctx, scale, bounds) {
|
|
13393
|
-
var
|
|
13394
|
-
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13398
|
-
|
|
13399
|
-
|
|
13400
|
-
|
|
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
|
+
}
|
|
13401
13570
|
ctx.beginPath();
|
|
13402
|
-
|
|
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);
|
|
13403
13578
|
ctx.clip();
|
|
13404
13579
|
}
|
|
13405
13580
|
}
|
|
@@ -13500,32 +13675,32 @@
|
|
|
13500
13675
|
};
|
|
13501
13676
|
var Legend = /*#__PURE__*/function (_Element7) {
|
|
13502
13677
|
function Legend(config) {
|
|
13503
|
-
var
|
|
13678
|
+
var _this25;
|
|
13504
13679
|
_classCallCheck$1(this, Legend);
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13508
|
-
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13521
|
-
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13527
|
-
|
|
13528
|
-
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;
|
|
13529
13704
|
}
|
|
13530
13705
|
_inherits$1(Legend, _Element7);
|
|
13531
13706
|
return _createClass$1(Legend, [{
|
|
@@ -13554,17 +13729,17 @@
|
|
|
13554
13729
|
}, {
|
|
13555
13730
|
key: "buildLabels",
|
|
13556
13731
|
value: function buildLabels() {
|
|
13557
|
-
var
|
|
13732
|
+
var _this26 = this;
|
|
13558
13733
|
var labelOpts = this.options.labels || {};
|
|
13559
13734
|
var legendItems = callback(labelOpts.generateLabels, [this.chart], this) || [];
|
|
13560
13735
|
if (labelOpts.filter) {
|
|
13561
13736
|
legendItems = legendItems.filter(function (item) {
|
|
13562
|
-
return labelOpts.filter(item,
|
|
13737
|
+
return labelOpts.filter(item, _this26.chart.data);
|
|
13563
13738
|
});
|
|
13564
13739
|
}
|
|
13565
13740
|
if (labelOpts.sort) {
|
|
13566
13741
|
legendItems = legendItems.sort(function (a, b) {
|
|
13567
|
-
return labelOpts.sort(a, b,
|
|
13742
|
+
return labelOpts.sort(a, b, _this26.chart.data);
|
|
13568
13743
|
});
|
|
13569
13744
|
}
|
|
13570
13745
|
if (this.options.reverse) {
|
|
@@ -13686,10 +13861,10 @@
|
|
|
13686
13861
|
}
|
|
13687
13862
|
var titleHeight = this._computeTitleHeight();
|
|
13688
13863
|
var hitboxes = this.legendHitBoxes,
|
|
13689
|
-
_this$
|
|
13690
|
-
align = _this$
|
|
13691
|
-
padding = _this$
|
|
13692
|
-
rtl = _this$
|
|
13864
|
+
_this$options13 = this.options,
|
|
13865
|
+
align = _this$options13.align,
|
|
13866
|
+
padding = _this$options13.labels.padding,
|
|
13867
|
+
rtl = _this$options13.rtl;
|
|
13693
13868
|
var rtlHelper = getRtlAdapter(rtl, this.left, this.width);
|
|
13694
13869
|
if (this.isHorizontal()) {
|
|
13695
13870
|
var row = 0;
|
|
@@ -13754,7 +13929,7 @@
|
|
|
13754
13929
|
}, {
|
|
13755
13930
|
key: "_draw",
|
|
13756
13931
|
value: function _draw() {
|
|
13757
|
-
var
|
|
13932
|
+
var _this27 = this;
|
|
13758
13933
|
var opts = this.options,
|
|
13759
13934
|
columnSizes = this.columnSizes,
|
|
13760
13935
|
lineWidths = this.lineWidths,
|
|
@@ -13856,21 +14031,21 @@
|
|
|
13856
14031
|
var width = boxWidth + halfFontSize + textWidth;
|
|
13857
14032
|
var x = cursor.x;
|
|
13858
14033
|
var y = cursor.y;
|
|
13859
|
-
rtlHelper.setWidth(
|
|
14034
|
+
rtlHelper.setWidth(_this27.width);
|
|
13860
14035
|
if (isHorizontal) {
|
|
13861
|
-
if (i > 0 && x + width + padding >
|
|
14036
|
+
if (i > 0 && x + width + padding > _this27.right) {
|
|
13862
14037
|
y = cursor.y += lineHeight;
|
|
13863
14038
|
cursor.line++;
|
|
13864
|
-
x = cursor.x = _alignStartEnd(align,
|
|
14039
|
+
x = cursor.x = _alignStartEnd(align, _this27.left + padding, _this27.right - lineWidths[cursor.line]);
|
|
13865
14040
|
}
|
|
13866
|
-
} else if (i > 0 && y + lineHeight >
|
|
14041
|
+
} else if (i > 0 && y + lineHeight > _this27.bottom) {
|
|
13867
14042
|
x = cursor.x = x + columnSizes[cursor.line].width + padding;
|
|
13868
14043
|
cursor.line++;
|
|
13869
|
-
y = cursor.y = _alignStartEnd(align,
|
|
14044
|
+
y = cursor.y = _alignStartEnd(align, _this27.top + titleHeight + padding, _this27.bottom - columnSizes[cursor.line].height);
|
|
13870
14045
|
}
|
|
13871
14046
|
var realX = rtlHelper.x(x);
|
|
13872
14047
|
drawLegendBox(realX, y, legendItem);
|
|
13873
|
-
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width :
|
|
14048
|
+
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : _this27.right, opts.rtl);
|
|
13874
14049
|
fillText(rtlHelper.x(x), y, legendItem);
|
|
13875
14050
|
if (isHorizontal) {
|
|
13876
14051
|
cursor.x += width + padding;
|
|
@@ -14114,23 +14289,23 @@
|
|
|
14114
14289
|
};
|
|
14115
14290
|
var Title = /*#__PURE__*/function (_Element8) {
|
|
14116
14291
|
function Title(config) {
|
|
14117
|
-
var
|
|
14292
|
+
var _this28;
|
|
14118
14293
|
_classCallCheck$1(this, Title);
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
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;
|
|
14134
14309
|
}
|
|
14135
14310
|
_inherits$1(Title, _Element8);
|
|
14136
14311
|
return _createClass$1(Title, [{
|
|
@@ -14649,37 +14824,37 @@
|
|
|
14649
14824
|
}
|
|
14650
14825
|
var Tooltip = /*#__PURE__*/function (_Element9) {
|
|
14651
14826
|
function Tooltip(config) {
|
|
14652
|
-
var
|
|
14827
|
+
var _this29;
|
|
14653
14828
|
_classCallCheck$1(this, Tooltip);
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14661
|
-
|
|
14662
|
-
|
|
14663
|
-
|
|
14664
|
-
|
|
14665
|
-
|
|
14666
|
-
|
|
14667
|
-
|
|
14668
|
-
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
|
|
14672
|
-
|
|
14673
|
-
|
|
14674
|
-
|
|
14675
|
-
|
|
14676
|
-
|
|
14677
|
-
|
|
14678
|
-
|
|
14679
|
-
|
|
14680
|
-
|
|
14681
|
-
|
|
14682
|
-
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;
|
|
14683
14858
|
}
|
|
14684
14859
|
_inherits$1(Tooltip, _Element9);
|
|
14685
14860
|
return _createClass$1(Tooltip, [{
|
|
@@ -14731,7 +14906,7 @@
|
|
|
14731
14906
|
}, {
|
|
14732
14907
|
key: "getBody",
|
|
14733
14908
|
value: function getBody(tooltipItems, options) {
|
|
14734
|
-
var
|
|
14909
|
+
var _this30 = this;
|
|
14735
14910
|
var callbacks = options.callbacks;
|
|
14736
14911
|
var bodyItems = [];
|
|
14737
14912
|
each(tooltipItems, function (context) {
|
|
@@ -14741,9 +14916,9 @@
|
|
|
14741
14916
|
after: []
|
|
14742
14917
|
};
|
|
14743
14918
|
var scoped = overrideCallbacks(callbacks, context);
|
|
14744
|
-
pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, 'beforeLabel',
|
|
14745
|
-
pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, 'label',
|
|
14746
|
-
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)));
|
|
14747
14922
|
bodyItems.push(bodyItem);
|
|
14748
14923
|
});
|
|
14749
14924
|
return bodyItems;
|
|
@@ -14769,7 +14944,7 @@
|
|
|
14769
14944
|
}, {
|
|
14770
14945
|
key: "_createItems",
|
|
14771
14946
|
value: function _createItems(options) {
|
|
14772
|
-
var
|
|
14947
|
+
var _this31 = this;
|
|
14773
14948
|
var active = this._active;
|
|
14774
14949
|
var data = this.chart.data;
|
|
14775
14950
|
var labelColors = [];
|
|
@@ -14792,9 +14967,9 @@
|
|
|
14792
14967
|
}
|
|
14793
14968
|
each(tooltipItems, function (context) {
|
|
14794
14969
|
var scoped = overrideCallbacks(options.callbacks, context);
|
|
14795
|
-
labelColors.push(invokeCallbackWithFallback(scoped, 'labelColor',
|
|
14796
|
-
labelPointStyles.push(invokeCallbackWithFallback(scoped, 'labelPointStyle',
|
|
14797
|
-
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));
|
|
14798
14973
|
});
|
|
14799
14974
|
this.labelColors = labelColors;
|
|
14800
14975
|
this.labelPointStyles = labelPointStyles;
|
|
@@ -15201,12 +15376,12 @@
|
|
|
15201
15376
|
}, {
|
|
15202
15377
|
key: "setActiveElements",
|
|
15203
15378
|
value: function setActiveElements(activeElements, eventPosition) {
|
|
15204
|
-
var
|
|
15379
|
+
var _this32 = this;
|
|
15205
15380
|
var lastActive = this._active;
|
|
15206
|
-
var active = activeElements.map(function (
|
|
15207
|
-
var datasetIndex =
|
|
15208
|
-
index =
|
|
15209
|
-
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);
|
|
15210
15385
|
if (!meta) {
|
|
15211
15386
|
throw new Error('Cannot find a dataset at index ' + datasetIndex);
|
|
15212
15387
|
}
|
|
@@ -15253,14 +15428,14 @@
|
|
|
15253
15428
|
}, {
|
|
15254
15429
|
key: "_getActiveElements",
|
|
15255
15430
|
value: function _getActiveElements(e, lastActive, replay, inChartArea) {
|
|
15256
|
-
var
|
|
15431
|
+
var _this33 = this;
|
|
15257
15432
|
var options = this.options;
|
|
15258
15433
|
if (e.type === 'mouseout') {
|
|
15259
15434
|
return [];
|
|
15260
15435
|
}
|
|
15261
15436
|
if (!inChartArea) {
|
|
15262
15437
|
return lastActive.filter(function (i) {
|
|
15263
|
-
return
|
|
15438
|
+
return _this33.chart.data.datasets[i.datasetIndex] && _this33.chart.getDatasetMeta(i.datasetIndex).controller.getParsed(i.index) !== undefined;
|
|
15264
15439
|
});
|
|
15265
15440
|
}
|
|
15266
15441
|
var active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay);
|
|
@@ -15445,13 +15620,13 @@
|
|
|
15445
15620
|
}
|
|
15446
15621
|
var CategoryScale = /*#__PURE__*/function (_Scale) {
|
|
15447
15622
|
function CategoryScale(cfg) {
|
|
15448
|
-
var
|
|
15623
|
+
var _this34;
|
|
15449
15624
|
_classCallCheck$1(this, CategoryScale);
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
return
|
|
15625
|
+
_this34 = _callSuper(this, CategoryScale, [cfg]);
|
|
15626
|
+
_this34._startValue = undefined;
|
|
15627
|
+
_this34._valueRange = 0;
|
|
15628
|
+
_this34._addedLabels = [];
|
|
15629
|
+
return _this34;
|
|
15455
15630
|
}
|
|
15456
15631
|
_inherits$1(CategoryScale, _Scale);
|
|
15457
15632
|
return _createClass$1(CategoryScale, [{
|
|
@@ -15682,9 +15857,9 @@
|
|
|
15682
15857
|
}
|
|
15683
15858
|
return ticks;
|
|
15684
15859
|
}
|
|
15685
|
-
function relativeLabelSize(value, minSpacing,
|
|
15686
|
-
var horizontal =
|
|
15687
|
-
minRotation =
|
|
15860
|
+
function relativeLabelSize(value, minSpacing, _ref10) {
|
|
15861
|
+
var horizontal = _ref10.horizontal,
|
|
15862
|
+
minRotation = _ref10.minRotation;
|
|
15688
15863
|
var rad = toRadians(minRotation);
|
|
15689
15864
|
var ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 0.001;
|
|
15690
15865
|
var length = 0.75 * minSpacing * ('' + value).length;
|
|
@@ -15692,15 +15867,15 @@
|
|
|
15692
15867
|
}
|
|
15693
15868
|
var LinearScaleBase = /*#__PURE__*/function (_Scale2) {
|
|
15694
15869
|
function LinearScaleBase(cfg) {
|
|
15695
|
-
var
|
|
15870
|
+
var _this35;
|
|
15696
15871
|
_classCallCheck$1(this, LinearScaleBase);
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
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;
|
|
15704
15879
|
}
|
|
15705
15880
|
_inherits$1(LinearScaleBase, _Scale2);
|
|
15706
15881
|
return _createClass$1(LinearScaleBase, [{
|
|
@@ -15904,9 +16079,9 @@
|
|
|
15904
16079
|
}
|
|
15905
16080
|
return Math.min(rangeExp, log10Floor(min));
|
|
15906
16081
|
}
|
|
15907
|
-
function generateTicks(generationOptions,
|
|
15908
|
-
var min =
|
|
15909
|
-
max =
|
|
16082
|
+
function generateTicks(generationOptions, _ref11) {
|
|
16083
|
+
var min = _ref11.min,
|
|
16084
|
+
max = _ref11.max;
|
|
15910
16085
|
min = finiteOrDefault(generationOptions.min, min);
|
|
15911
16086
|
var ticks = [];
|
|
15912
16087
|
var minExp = log10Floor(min);
|
|
@@ -15946,14 +16121,14 @@
|
|
|
15946
16121
|
}
|
|
15947
16122
|
var LogarithmicScale = /*#__PURE__*/function (_Scale3) {
|
|
15948
16123
|
function LogarithmicScale(cfg) {
|
|
15949
|
-
var
|
|
16124
|
+
var _this36;
|
|
15950
16125
|
_classCallCheck$1(this, LogarithmicScale);
|
|
15951
|
-
|
|
15952
|
-
|
|
15953
|
-
|
|
15954
|
-
|
|
15955
|
-
|
|
15956
|
-
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;
|
|
15957
16132
|
}
|
|
15958
16133
|
_inherits$1(LogarithmicScale, _Scale3);
|
|
15959
16134
|
return _createClass$1(LogarithmicScale, [{
|
|
@@ -16346,15 +16521,15 @@
|
|
|
16346
16521
|
}
|
|
16347
16522
|
var RadialLinearScale = /*#__PURE__*/function (_LinearScaleBase2) {
|
|
16348
16523
|
function RadialLinearScale(cfg) {
|
|
16349
|
-
var
|
|
16524
|
+
var _this37;
|
|
16350
16525
|
_classCallCheck$1(this, RadialLinearScale);
|
|
16351
|
-
|
|
16352
|
-
|
|
16353
|
-
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
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;
|
|
16358
16533
|
}
|
|
16359
16534
|
_inherits$1(RadialLinearScale, _LinearScaleBase2);
|
|
16360
16535
|
return _createClass$1(RadialLinearScale, [{
|
|
@@ -16385,13 +16560,13 @@
|
|
|
16385
16560
|
}, {
|
|
16386
16561
|
key: "generateTickLabels",
|
|
16387
16562
|
value: function generateTickLabels(ticks) {
|
|
16388
|
-
var
|
|
16563
|
+
var _this38 = this;
|
|
16389
16564
|
LinearScaleBase.prototype.generateTickLabels.call(this, ticks);
|
|
16390
16565
|
this._pointLabels = this.getLabels().map(function (value, index) {
|
|
16391
|
-
var label = callback(
|
|
16566
|
+
var label = callback(_this38.options.pointLabels.callback, [value, index], _this38);
|
|
16392
16567
|
return label || label === 0 ? label : '';
|
|
16393
16568
|
}).filter(function (v, i) {
|
|
16394
|
-
return
|
|
16569
|
+
return _this38.chart.getDataVisibility(i);
|
|
16395
16570
|
});
|
|
16396
16571
|
}
|
|
16397
16572
|
}, {
|
|
@@ -16487,9 +16662,9 @@
|
|
|
16487
16662
|
}, {
|
|
16488
16663
|
key: "drawBackground",
|
|
16489
16664
|
value: function drawBackground() {
|
|
16490
|
-
var _this$
|
|
16491
|
-
backgroundColor = _this$
|
|
16492
|
-
circular = _this$
|
|
16665
|
+
var _this$options14 = this.options,
|
|
16666
|
+
backgroundColor = _this$options14.backgroundColor,
|
|
16667
|
+
circular = _this$options14.grid.circular;
|
|
16493
16668
|
if (backgroundColor) {
|
|
16494
16669
|
var ctx = this.ctx;
|
|
16495
16670
|
ctx.save();
|
|
@@ -16504,7 +16679,7 @@
|
|
|
16504
16679
|
}, {
|
|
16505
16680
|
key: "drawGrid",
|
|
16506
16681
|
value: function drawGrid() {
|
|
16507
|
-
var
|
|
16682
|
+
var _this39 = this;
|
|
16508
16683
|
var ctx = this.ctx;
|
|
16509
16684
|
var opts = this.options;
|
|
16510
16685
|
var angleLines = opts.angleLines,
|
|
@@ -16517,12 +16692,12 @@
|
|
|
16517
16692
|
}
|
|
16518
16693
|
if (grid.display) {
|
|
16519
16694
|
this.ticks.forEach(function (tick, index) {
|
|
16520
|
-
if (index !== 0 || index === 0 &&
|
|
16521
|
-
offset =
|
|
16522
|
-
var context =
|
|
16695
|
+
if (index !== 0 || index === 0 && _this39.min < 0) {
|
|
16696
|
+
offset = _this39.getDistanceFromCenterForValue(tick.value);
|
|
16697
|
+
var context = _this39.getContext(index);
|
|
16523
16698
|
var optsAtIndex = grid.setContext(context);
|
|
16524
16699
|
var optsAtIndexBorder = border.setContext(context);
|
|
16525
|
-
drawRadiusLine(
|
|
16700
|
+
drawRadiusLine(_this39, optsAtIndex, offset, labelCount, optsAtIndexBorder);
|
|
16526
16701
|
}
|
|
16527
16702
|
});
|
|
16528
16703
|
}
|
|
@@ -16555,7 +16730,7 @@
|
|
|
16555
16730
|
}, {
|
|
16556
16731
|
key: "drawLabels",
|
|
16557
16732
|
value: function drawLabels() {
|
|
16558
|
-
var
|
|
16733
|
+
var _this40 = this;
|
|
16559
16734
|
var ctx = this.ctx;
|
|
16560
16735
|
var opts = this.options;
|
|
16561
16736
|
var tickOpts = opts.ticks;
|
|
@@ -16570,12 +16745,12 @@
|
|
|
16570
16745
|
ctx.textAlign = 'center';
|
|
16571
16746
|
ctx.textBaseline = 'middle';
|
|
16572
16747
|
this.ticks.forEach(function (tick, index) {
|
|
16573
|
-
if (index === 0 &&
|
|
16748
|
+
if (index === 0 && _this40.min >= 0 && !opts.reverse) {
|
|
16574
16749
|
return;
|
|
16575
16750
|
}
|
|
16576
|
-
var optsAtIndex = tickOpts.setContext(
|
|
16751
|
+
var optsAtIndex = tickOpts.setContext(_this40.getContext(index));
|
|
16577
16752
|
var tickFont = toFont(optsAtIndex.font);
|
|
16578
|
-
offset =
|
|
16753
|
+
offset = _this40.getDistanceFromCenterForValue(_this40.ticks[index].value);
|
|
16579
16754
|
if (optsAtIndex.showLabelBackdrop) {
|
|
16580
16755
|
ctx.font = tickFont.string;
|
|
16581
16756
|
width = ctx.measureText(tick.label).width;
|
|
@@ -16781,20 +16956,20 @@
|
|
|
16781
16956
|
}
|
|
16782
16957
|
var TimeScale = /*#__PURE__*/function (_Scale4) {
|
|
16783
16958
|
function TimeScale(props) {
|
|
16784
|
-
var
|
|
16959
|
+
var _this41;
|
|
16785
16960
|
_classCallCheck$1(this, TimeScale);
|
|
16786
|
-
|
|
16787
|
-
|
|
16961
|
+
_this41 = _callSuper(this, TimeScale, [props]);
|
|
16962
|
+
_this41._cache = {
|
|
16788
16963
|
data: [],
|
|
16789
16964
|
labels: [],
|
|
16790
16965
|
all: []
|
|
16791
16966
|
};
|
|
16792
|
-
|
|
16793
|
-
|
|
16794
|
-
|
|
16795
|
-
|
|
16796
|
-
|
|
16797
|
-
return
|
|
16967
|
+
_this41._unit = 'day';
|
|
16968
|
+
_this41._majorUnit = undefined;
|
|
16969
|
+
_this41._offsets = {};
|
|
16970
|
+
_this41._normalized = false;
|
|
16971
|
+
_this41._parseOpts = undefined;
|
|
16972
|
+
return _this41;
|
|
16798
16973
|
}
|
|
16799
16974
|
_inherits$1(TimeScale, _Scale4);
|
|
16800
16975
|
return _createClass$1(TimeScale, [{
|
|
@@ -17151,13 +17326,13 @@
|
|
|
17151
17326
|
}
|
|
17152
17327
|
var TimeSeriesScale = /*#__PURE__*/function (_TimeScale2) {
|
|
17153
17328
|
function TimeSeriesScale(props) {
|
|
17154
|
-
var
|
|
17329
|
+
var _this42;
|
|
17155
17330
|
_classCallCheck$1(this, TimeSeriesScale);
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
|
|
17159
|
-
|
|
17160
|
-
return
|
|
17331
|
+
_this42 = _callSuper(this, TimeSeriesScale, [props]);
|
|
17332
|
+
_this42._table = [];
|
|
17333
|
+
_this42._minPos = undefined;
|
|
17334
|
+
_this42._tableRange = undefined;
|
|
17335
|
+
return _this42;
|
|
17161
17336
|
}
|
|
17162
17337
|
_inherits$1(TimeSeriesScale, _TimeScale2);
|
|
17163
17338
|
return _createClass$1(TimeSeriesScale, [{
|
|
@@ -17344,6 +17519,7 @@
|
|
|
17344
17519
|
fontString: fontString,
|
|
17345
17520
|
formatNumber: formatNumber,
|
|
17346
17521
|
getAngleFromPoint: getAngleFromPoint,
|
|
17522
|
+
getDatasetClipArea: getDatasetClipArea,
|
|
17347
17523
|
getHoverColor: getHoverColor,
|
|
17348
17524
|
getMaximumSize: getMaximumSize,
|
|
17349
17525
|
getRelativePosition: getRelativePosition,
|