chartkick 5.1.5 → 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 +9 -0
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +581 -437
- 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
|
}
|
@@ -5786,6 +5786,39 @@
|
|
5786
5786
|
value: function _getStackCount(index) {
|
5787
5787
|
return this._getStacks(undefined, index).length;
|
5788
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
|
+
}
|
5789
5822
|
}, {
|
5790
5823
|
key: "_getStackIndex",
|
5791
5824
|
value: function _getStackIndex(datasetIndex, name, dataIndex) {
|
@@ -5890,10 +5923,13 @@
|
|
5890
5923
|
var skipNull = options.skipNull;
|
5891
5924
|
var maxBarThickness = valueOrDefault(options.maxBarThickness, Infinity);
|
5892
5925
|
var center, size;
|
5926
|
+
var axisCount = this._getAxisCount();
|
5893
5927
|
if (ruler.grouped) {
|
5894
5928
|
var stackCount = skipNull ? this._getStackCount(index) : ruler.stackCount;
|
5895
|
-
var range = options.barThickness === 'flex' ? computeFlexCategoryTraits(index, ruler, options, stackCount) : computeFitCategoryTraits(index, ruler, options, stackCount);
|
5896
|
-
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;
|
5897
5933
|
center = range.start + range.chunk * stackIndex + range.chunk / 2;
|
5898
5934
|
size = Math.min(maxBarThickness, range.chunk * range.ratio);
|
5899
5935
|
} else {
|
@@ -6411,21 +6447,29 @@
|
|
6411
6447
|
labels: {
|
6412
6448
|
generateLabels: function generateLabels(chart) {
|
6413
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;
|
6414
6456
|
if (data.labels.length && data.datasets.length) {
|
6415
|
-
var _chart$legend$options2 = chart.legend.options.labels,
|
6416
|
-
pointStyle = _chart$legend$options2.pointStyle,
|
6417
|
-
color = _chart$legend$options2.color;
|
6418
6457
|
return data.labels.map(function (label, i) {
|
6419
6458
|
var meta = chart.getDatasetMeta(0);
|
6420
6459
|
var style = meta.controller.getStyle(i);
|
6421
6460
|
return {
|
6422
6461
|
text: label,
|
6423
6462
|
fillStyle: style.backgroundColor,
|
6424
|
-
strokeStyle: style.borderColor,
|
6425
6463
|
fontColor: color,
|
6464
|
+
hidden: !chart.getDataVisibility(i),
|
6465
|
+
lineDash: style.borderDash,
|
6466
|
+
lineDashOffset: style.borderDashOffset,
|
6467
|
+
lineJoin: style.borderJoinStyle,
|
6426
6468
|
lineWidth: style.borderWidth,
|
6469
|
+
strokeStyle: style.borderColor,
|
6470
|
+
textAlign: textAlign,
|
6427
6471
|
pointStyle: pointStyle,
|
6428
|
-
|
6472
|
+
borderRadius: useBorderRadius && (borderRadius || style.borderRadius),
|
6429
6473
|
index: i
|
6430
6474
|
};
|
6431
6475
|
});
|
@@ -7398,11 +7442,11 @@
|
|
7398
7442
|
}
|
7399
7443
|
function buildStacks(layouts) {
|
7400
7444
|
var stacks = {};
|
7401
|
-
var
|
7402
|
-
|
7445
|
+
var _iterator6 = _createForOfIteratorHelper$1(layouts),
|
7446
|
+
_step6;
|
7403
7447
|
try {
|
7404
|
-
for (
|
7405
|
-
var wrap =
|
7448
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
7449
|
+
var wrap = _step6.value;
|
7406
7450
|
var stack = wrap.stack,
|
7407
7451
|
pos = wrap.pos,
|
7408
7452
|
stackWeight = wrap.stackWeight;
|
@@ -7419,9 +7463,9 @@
|
|
7419
7463
|
_stack.weight += stackWeight;
|
7420
7464
|
}
|
7421
7465
|
} catch (err) {
|
7422
|
-
|
7466
|
+
_iterator6.e(err);
|
7423
7467
|
} finally {
|
7424
|
-
|
7468
|
+
_iterator6.f();
|
7425
7469
|
}
|
7426
7470
|
return stacks;
|
7427
7471
|
}
|
@@ -7565,11 +7609,11 @@
|
|
7565
7609
|
var userPadding = params.padding;
|
7566
7610
|
var x = chartArea.x,
|
7567
7611
|
y = chartArea.y;
|
7568
|
-
var
|
7569
|
-
|
7612
|
+
var _iterator7 = _createForOfIteratorHelper$1(boxes),
|
7613
|
+
_step7;
|
7570
7614
|
try {
|
7571
|
-
for (
|
7572
|
-
var layout =
|
7615
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
7616
|
+
var layout = _step7.value;
|
7573
7617
|
var box = layout.box;
|
7574
7618
|
var stack = stacks[layout.stack] || {
|
7575
7619
|
count: 1,
|
@@ -7608,9 +7652,9 @@
|
|
7608
7652
|
}
|
7609
7653
|
}
|
7610
7654
|
} catch (err) {
|
7611
|
-
|
7655
|
+
_iterator7.e(err);
|
7612
7656
|
} finally {
|
7613
|
-
|
7657
|
+
_iterator7.f();
|
7614
7658
|
}
|
7615
7659
|
chartArea.x = x;
|
7616
7660
|
chartArea.y = y;
|
@@ -7849,37 +7893,37 @@
|
|
7849
7893
|
};
|
7850
7894
|
}
|
7851
7895
|
function nodeListContains(nodeList, canvas) {
|
7852
|
-
var
|
7853
|
-
|
7896
|
+
var _iterator8 = _createForOfIteratorHelper$1(nodeList),
|
7897
|
+
_step8;
|
7854
7898
|
try {
|
7855
|
-
for (
|
7856
|
-
var node =
|
7899
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
7900
|
+
var node = _step8.value;
|
7857
7901
|
if (node === canvas || node.contains(canvas)) {
|
7858
7902
|
return true;
|
7859
7903
|
}
|
7860
7904
|
}
|
7861
7905
|
} catch (err) {
|
7862
|
-
|
7906
|
+
_iterator8.e(err);
|
7863
7907
|
} finally {
|
7864
|
-
|
7908
|
+
_iterator8.f();
|
7865
7909
|
}
|
7866
7910
|
}
|
7867
7911
|
function createAttachObserver(chart, type, listener) {
|
7868
7912
|
var canvas = chart.canvas;
|
7869
7913
|
var observer = new MutationObserver(function (entries) {
|
7870
7914
|
var trigger = false;
|
7871
|
-
var
|
7872
|
-
|
7915
|
+
var _iterator9 = _createForOfIteratorHelper$1(entries),
|
7916
|
+
_step9;
|
7873
7917
|
try {
|
7874
|
-
for (
|
7875
|
-
var entry =
|
7918
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
7919
|
+
var entry = _step9.value;
|
7876
7920
|
trigger = trigger || nodeListContains(entry.addedNodes, canvas);
|
7877
7921
|
trigger = trigger && !nodeListContains(entry.removedNodes, canvas);
|
7878
7922
|
}
|
7879
7923
|
} catch (err) {
|
7880
|
-
|
7924
|
+
_iterator9.e(err);
|
7881
7925
|
} finally {
|
7882
|
-
|
7926
|
+
_iterator9.f();
|
7883
7927
|
}
|
7884
7928
|
if (trigger) {
|
7885
7929
|
listener();
|
@@ -7895,18 +7939,18 @@
|
|
7895
7939
|
var canvas = chart.canvas;
|
7896
7940
|
var observer = new MutationObserver(function (entries) {
|
7897
7941
|
var trigger = false;
|
7898
|
-
var
|
7899
|
-
|
7942
|
+
var _iterator0 = _createForOfIteratorHelper$1(entries),
|
7943
|
+
_step0;
|
7900
7944
|
try {
|
7901
|
-
for (
|
7902
|
-
var entry =
|
7945
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
7946
|
+
var entry = _step0.value;
|
7903
7947
|
trigger = trigger || nodeListContains(entry.removedNodes, canvas);
|
7904
7948
|
trigger = trigger && !nodeListContains(entry.addedNodes, canvas);
|
7905
7949
|
}
|
7906
7950
|
} catch (err) {
|
7907
|
-
|
7951
|
+
_iterator0.e(err);
|
7908
7952
|
} finally {
|
7909
|
-
|
7953
|
+
_iterator0.f();
|
7910
7954
|
}
|
7911
7955
|
if (trigger) {
|
7912
7956
|
listener();
|
@@ -9513,9 +9557,9 @@
|
|
9513
9557
|
value: function drawBorder() {
|
9514
9558
|
var chart = this.chart,
|
9515
9559
|
ctx = this.ctx,
|
9516
|
-
_this$
|
9517
|
-
border = _this$
|
9518
|
-
grid = _this$
|
9560
|
+
_this$options0 = this.options,
|
9561
|
+
border = _this$options0.border,
|
9562
|
+
grid = _this$options0.grid;
|
9519
9563
|
var borderOpts = border.setContext(this.getContext());
|
9520
9564
|
var axisWidth = border.display ? borderOpts.width : 0;
|
9521
9565
|
if (!axisWidth) {
|
@@ -9555,11 +9599,11 @@
|
|
9555
9599
|
clipArea(ctx, area);
|
9556
9600
|
}
|
9557
9601
|
var items = this.getLabelItems(chartArea);
|
9558
|
-
var
|
9559
|
-
|
9602
|
+
var _iterator1 = _createForOfIteratorHelper$1(items),
|
9603
|
+
_step1;
|
9560
9604
|
try {
|
9561
|
-
for (
|
9562
|
-
var item =
|
9605
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
9606
|
+
var item = _step1.value;
|
9563
9607
|
var renderTextOptions = item.options;
|
9564
9608
|
var tickFont = item.font;
|
9565
9609
|
var label = item.label;
|
@@ -9567,9 +9611,9 @@
|
|
9567
9611
|
renderText(ctx, label, 0, y, tickFont, renderTextOptions);
|
9568
9612
|
}
|
9569
9613
|
} catch (err) {
|
9570
|
-
|
9614
|
+
_iterator1.e(err);
|
9571
9615
|
} finally {
|
9572
|
-
|
9616
|
+
_iterator1.f();
|
9573
9617
|
}
|
9574
9618
|
if (area) {
|
9575
9619
|
unclipArea(ctx);
|
@@ -9579,10 +9623,10 @@
|
|
9579
9623
|
key: "drawTitle",
|
9580
9624
|
value: function drawTitle() {
|
9581
9625
|
var ctx = this.ctx,
|
9582
|
-
_this$
|
9583
|
-
position = _this$
|
9584
|
-
title = _this$
|
9585
|
-
reverse = _this$
|
9626
|
+
_this$options1 = this.options,
|
9627
|
+
position = _this$options1.position,
|
9628
|
+
title = _this$options1.title,
|
9629
|
+
reverse = _this$options1.reverse;
|
9586
9630
|
if (!title.display) {
|
9587
9631
|
return;
|
9588
9632
|
}
|
@@ -9627,7 +9671,7 @@
|
|
9627
9671
|
}, {
|
9628
9672
|
key: "_layers",
|
9629
9673
|
value: function _layers() {
|
9630
|
-
var
|
9674
|
+
var _this0 = this;
|
9631
9675
|
var opts = this.options;
|
9632
9676
|
var tz = opts.ticks && opts.ticks.z || 0;
|
9633
9677
|
var gz = valueOrDefault(opts.grid && opts.grid.z, -1);
|
@@ -9636,26 +9680,26 @@
|
|
9636
9680
|
return [{
|
9637
9681
|
z: tz,
|
9638
9682
|
draw: function draw(chartArea) {
|
9639
|
-
|
9683
|
+
_this0.draw(chartArea);
|
9640
9684
|
}
|
9641
9685
|
}];
|
9642
9686
|
}
|
9643
9687
|
return [{
|
9644
9688
|
z: gz,
|
9645
9689
|
draw: function draw(chartArea) {
|
9646
|
-
|
9647
|
-
|
9648
|
-
|
9690
|
+
_this0.drawBackground();
|
9691
|
+
_this0.drawGrid(chartArea);
|
9692
|
+
_this0.drawTitle();
|
9649
9693
|
}
|
9650
9694
|
}, {
|
9651
9695
|
z: bz,
|
9652
9696
|
draw: function draw() {
|
9653
|
-
|
9697
|
+
_this0.drawBorder();
|
9654
9698
|
}
|
9655
9699
|
}, {
|
9656
9700
|
z: tz,
|
9657
9701
|
draw: function draw(chartArea) {
|
9658
|
-
|
9702
|
+
_this0.drawLabels(chartArea);
|
9659
9703
|
}
|
9660
9704
|
}];
|
9661
9705
|
}
|
@@ -9876,23 +9920,23 @@
|
|
9876
9920
|
}, {
|
9877
9921
|
key: "removeScales",
|
9878
9922
|
value: function removeScales() {
|
9879
|
-
for (var
|
9880
|
-
args[
|
9923
|
+
for (var _len0 = arguments.length, args = new Array(_len0), _key0 = 0; _key0 < _len0; _key0++) {
|
9924
|
+
args[_key0] = arguments[_key0];
|
9881
9925
|
}
|
9882
9926
|
this._each('unregister', args, this.scales);
|
9883
9927
|
}
|
9884
9928
|
}, {
|
9885
9929
|
key: "_each",
|
9886
9930
|
value: function _each(method, args, typedRegistry) {
|
9887
|
-
var
|
9931
|
+
var _this1 = this;
|
9888
9932
|
_toConsumableArray(args).forEach(function (arg) {
|
9889
|
-
var reg = typedRegistry ||
|
9890
|
-
if (typedRegistry || reg.isForType(arg) || reg ===
|
9891
|
-
|
9933
|
+
var reg = typedRegistry || _this1._getRegistryForType(arg);
|
9934
|
+
if (typedRegistry || reg.isForType(arg) || reg === _this1.plugins && arg.id) {
|
9935
|
+
_this1._exec(method, reg, arg);
|
9892
9936
|
} else {
|
9893
9937
|
each(arg, function (item) {
|
9894
|
-
var itemReg = typedRegistry ||
|
9895
|
-
|
9938
|
+
var itemReg = typedRegistry || _this1._getRegistryForType(item);
|
9939
|
+
_this1._exec(method, itemReg, item);
|
9896
9940
|
});
|
9897
9941
|
}
|
9898
9942
|
});
|
@@ -9931,7 +9975,7 @@
|
|
9931
9975
|
var PluginService = /*#__PURE__*/function () {
|
9932
9976
|
function PluginService() {
|
9933
9977
|
_classCallCheck$1(this, PluginService);
|
9934
|
-
this._init =
|
9978
|
+
this._init = undefined;
|
9935
9979
|
}
|
9936
9980
|
return _createClass$1(PluginService, [{
|
9937
9981
|
key: "notify",
|
@@ -9940,11 +9984,15 @@
|
|
9940
9984
|
this._init = this._createDescriptors(chart, true);
|
9941
9985
|
this._notify(this._init, chart, 'install');
|
9942
9986
|
}
|
9987
|
+
if (this._init === undefined) {
|
9988
|
+
return;
|
9989
|
+
}
|
9943
9990
|
var descriptors = filter ? this._descriptors(chart).filter(filter) : this._descriptors(chart);
|
9944
9991
|
var result = this._notify(descriptors, chart, hook, args);
|
9945
9992
|
if (hook === 'afterDestroy') {
|
9946
9993
|
this._notify(descriptors, chart, 'stop');
|
9947
9994
|
this._notify(this._init, chart, 'uninstall');
|
9995
|
+
this._init = undefined;
|
9948
9996
|
}
|
9949
9997
|
return result;
|
9950
9998
|
}
|
@@ -9952,11 +10000,11 @@
|
|
9952
10000
|
key: "_notify",
|
9953
10001
|
value: function _notify(descriptors, chart, hook, args) {
|
9954
10002
|
args = args || {};
|
9955
|
-
var
|
9956
|
-
|
10003
|
+
var _iterator10 = _createForOfIteratorHelper$1(descriptors),
|
10004
|
+
_step10;
|
9957
10005
|
try {
|
9958
|
-
for (
|
9959
|
-
var descriptor =
|
10006
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
10007
|
+
var descriptor = _step10.value;
|
9960
10008
|
var plugin = descriptor.plugin;
|
9961
10009
|
var method = plugin[hook];
|
9962
10010
|
var params = [chart, args, descriptor.options];
|
@@ -9965,9 +10013,9 @@
|
|
9965
10013
|
}
|
9966
10014
|
}
|
9967
10015
|
} catch (err) {
|
9968
|
-
|
10016
|
+
_iterator10.e(err);
|
9969
10017
|
} finally {
|
9970
|
-
|
10018
|
+
_iterator10.f();
|
9971
10019
|
}
|
9972
10020
|
return true;
|
9973
10021
|
}
|
@@ -10048,11 +10096,11 @@
|
|
10048
10096
|
localIds = _ref2.localIds;
|
10049
10097
|
var result = [];
|
10050
10098
|
var context = chart.getContext();
|
10051
|
-
var
|
10052
|
-
|
10099
|
+
var _iterator11 = _createForOfIteratorHelper$1(plugins),
|
10100
|
+
_step11;
|
10053
10101
|
try {
|
10054
|
-
for (
|
10055
|
-
var plugin =
|
10102
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
10103
|
+
var plugin = _step11.value;
|
10056
10104
|
var id = plugin.id;
|
10057
10105
|
var opts = getOpts(options[id], all);
|
10058
10106
|
if (opts === null) {
|
@@ -10067,9 +10115,9 @@
|
|
10067
10115
|
});
|
10068
10116
|
}
|
10069
10117
|
} catch (err) {
|
10070
|
-
|
10118
|
+
_iterator11.e(err);
|
10071
10119
|
} finally {
|
10072
|
-
|
10120
|
+
_iterator11.f();
|
10073
10121
|
}
|
10074
10122
|
return result;
|
10075
10123
|
}
|
@@ -10121,8 +10169,8 @@
|
|
10121
10169
|
if (idMatchesAxis(id)) {
|
10122
10170
|
return id;
|
10123
10171
|
}
|
10124
|
-
for (var
|
10125
|
-
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];
|
10126
10174
|
}
|
10127
10175
|
for (var _i3 = 0, _scaleOptions = scaleOptions; _i3 < _scaleOptions.length; _i3++) {
|
10128
10176
|
var opts = _scaleOptions[_i3];
|
@@ -10388,17 +10436,17 @@
|
|
10388
10436
|
var subResolver = this.createResolver(scopes, context, subPrefixes);
|
10389
10437
|
options = _attachContext(resolver, context, subResolver);
|
10390
10438
|
}
|
10391
|
-
var
|
10392
|
-
|
10439
|
+
var _iterator12 = _createForOfIteratorHelper$1(names),
|
10440
|
+
_step12;
|
10393
10441
|
try {
|
10394
|
-
for (
|
10395
|
-
var prop =
|
10442
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
10443
|
+
var prop = _step12.value;
|
10396
10444
|
result[prop] = options[prop];
|
10397
10445
|
}
|
10398
10446
|
} catch (err) {
|
10399
|
-
|
10447
|
+
_iterator12.e(err);
|
10400
10448
|
} finally {
|
10401
|
-
|
10449
|
+
_iterator12.f();
|
10402
10450
|
}
|
10403
10451
|
return result;
|
10404
10452
|
}
|
@@ -10442,11 +10490,11 @@
|
|
10442
10490
|
var _descriptors2 = _descriptors(proxy),
|
10443
10491
|
isScriptable = _descriptors2.isScriptable,
|
10444
10492
|
isIndexable = _descriptors2.isIndexable;
|
10445
|
-
var
|
10446
|
-
|
10493
|
+
var _iterator13 = _createForOfIteratorHelper$1(names),
|
10494
|
+
_step13;
|
10447
10495
|
try {
|
10448
|
-
for (
|
10449
|
-
var prop =
|
10496
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
10497
|
+
var prop = _step13.value;
|
10450
10498
|
var scriptable = isScriptable(prop);
|
10451
10499
|
var indexable = isIndexable(prop);
|
10452
10500
|
var value = (indexable || scriptable) && proxy[prop];
|
@@ -10455,13 +10503,13 @@
|
|
10455
10503
|
}
|
10456
10504
|
}
|
10457
10505
|
} catch (err) {
|
10458
|
-
|
10506
|
+
_iterator13.e(err);
|
10459
10507
|
} finally {
|
10460
|
-
|
10508
|
+
_iterator13.f();
|
10461
10509
|
}
|
10462
10510
|
return false;
|
10463
10511
|
}
|
10464
|
-
var version = "4.
|
10512
|
+
var version = "4.5.1";
|
10465
10513
|
var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
|
10466
10514
|
function positionIsHorizontal(position, axis) {
|
10467
10515
|
return position === 'top' || position === 'bottom' || KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x';
|
@@ -10525,7 +10573,7 @@
|
|
10525
10573
|
}
|
10526
10574
|
var Chart = /*#__PURE__*/function () {
|
10527
10575
|
function Chart(item, userConfig) {
|
10528
|
-
var
|
10576
|
+
var _this10 = this;
|
10529
10577
|
_classCallCheck$1(this, Chart);
|
10530
10578
|
var config = this.config = new Config(userConfig);
|
10531
10579
|
var initialCanvas = getCanvas(item);
|
@@ -10566,7 +10614,7 @@
|
|
10566
10614
|
this._animationsDisabled = undefined;
|
10567
10615
|
this.$context = undefined;
|
10568
10616
|
this._doResize = debounce(function (mode) {
|
10569
|
-
return
|
10617
|
+
return _this10.update(mode);
|
10570
10618
|
}, options.resizeDelay || 0);
|
10571
10619
|
this._dataChanges = [];
|
10572
10620
|
instances[this.id] = this;
|
@@ -10584,9 +10632,9 @@
|
|
10584
10632
|
return _createClass$1(Chart, [{
|
10585
10633
|
key: "aspectRatio",
|
10586
10634
|
get: function get() {
|
10587
|
-
var _this$
|
10588
|
-
aspectRatio = _this$
|
10589
|
-
maintainAspectRatio = _this$
|
10635
|
+
var _this$options10 = this.options,
|
10636
|
+
aspectRatio = _this$options10.aspectRatio,
|
10637
|
+
maintainAspectRatio = _this$options10.maintainAspectRatio,
|
10590
10638
|
width = this.width,
|
10591
10639
|
height = this.height,
|
10592
10640
|
_aspectRatio = this._aspectRatio;
|
@@ -10693,7 +10741,7 @@
|
|
10693
10741
|
}, {
|
10694
10742
|
key: "buildOrUpdateScales",
|
10695
10743
|
value: function buildOrUpdateScales() {
|
10696
|
-
var
|
10744
|
+
var _this11 = this;
|
10697
10745
|
var options = this.options;
|
10698
10746
|
var scaleOpts = options.scales;
|
10699
10747
|
var scales = this.scales;
|
@@ -10732,8 +10780,8 @@
|
|
10732
10780
|
scale = new scaleClass({
|
10733
10781
|
id: id,
|
10734
10782
|
type: scaleType,
|
10735
|
-
ctx:
|
10736
|
-
chart:
|
10783
|
+
ctx: _this11.ctx,
|
10784
|
+
chart: _this11
|
10737
10785
|
});
|
10738
10786
|
scales[scale.id] = scale;
|
10739
10787
|
}
|
@@ -10745,8 +10793,8 @@
|
|
10745
10793
|
}
|
10746
10794
|
});
|
10747
10795
|
each(scales, function (scale) {
|
10748
|
-
layouts.configure(
|
10749
|
-
layouts.addBox(
|
10796
|
+
layouts.configure(_this11, scale, scale.options);
|
10797
|
+
layouts.addBox(_this11, scale);
|
10750
10798
|
});
|
10751
10799
|
}
|
10752
10800
|
}, {
|
@@ -10769,7 +10817,7 @@
|
|
10769
10817
|
}, {
|
10770
10818
|
key: "_removeUnreferencedMetasets",
|
10771
10819
|
value: function _removeUnreferencedMetasets() {
|
10772
|
-
var
|
10820
|
+
var _this12 = this;
|
10773
10821
|
var metasets = this._metasets,
|
10774
10822
|
datasets = this.data.datasets;
|
10775
10823
|
if (metasets.length > datasets.length) {
|
@@ -10779,7 +10827,7 @@
|
|
10779
10827
|
if (datasets.filter(function (x) {
|
10780
10828
|
return x === meta._dataset;
|
10781
10829
|
}).length === 0) {
|
10782
|
-
|
10830
|
+
_this12._destroyDatasetMeta(index);
|
10783
10831
|
}
|
10784
10832
|
});
|
10785
10833
|
}
|
@@ -10826,9 +10874,9 @@
|
|
10826
10874
|
}, {
|
10827
10875
|
key: "_resetElements",
|
10828
10876
|
value: function _resetElements() {
|
10829
|
-
var
|
10877
|
+
var _this13 = this;
|
10830
10878
|
each(this.data.datasets, function (dataset, datasetIndex) {
|
10831
|
-
|
10879
|
+
_this13.getDatasetMeta(datasetIndex).controller.reset();
|
10832
10880
|
}, this);
|
10833
10881
|
}
|
10834
10882
|
}, {
|
@@ -10888,9 +10936,9 @@
|
|
10888
10936
|
}, {
|
10889
10937
|
key: "_updateScales",
|
10890
10938
|
value: function _updateScales() {
|
10891
|
-
var
|
10939
|
+
var _this14 = this;
|
10892
10940
|
each(this.scales, function (scale) {
|
10893
|
-
layouts.removeBox(
|
10941
|
+
layouts.removeBox(_this14, scale);
|
10894
10942
|
});
|
10895
10943
|
this.ensureScalesHaveIDs();
|
10896
10944
|
this.buildOrUpdateScales();
|
@@ -10911,21 +10959,21 @@
|
|
10911
10959
|
value: function _updateHiddenIndices() {
|
10912
10960
|
var _hiddenIndices = this._hiddenIndices;
|
10913
10961
|
var changes = this._getUniformDataChanges() || [];
|
10914
|
-
var
|
10915
|
-
|
10962
|
+
var _iterator14 = _createForOfIteratorHelper$1(changes),
|
10963
|
+
_step14;
|
10916
10964
|
try {
|
10917
|
-
for (
|
10918
|
-
var
|
10919
|
-
method =
|
10920
|
-
start =
|
10921
|
-
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;
|
10922
10970
|
var move = method === '_removeElements' ? -count : count;
|
10923
10971
|
moveNumericKeys(_hiddenIndices, start, move);
|
10924
10972
|
}
|
10925
10973
|
} catch (err) {
|
10926
|
-
|
10974
|
+
_iterator14.e(err);
|
10927
10975
|
} finally {
|
10928
|
-
|
10976
|
+
_iterator14.f();
|
10929
10977
|
}
|
10930
10978
|
}
|
10931
10979
|
}, {
|
@@ -10963,7 +11011,7 @@
|
|
10963
11011
|
}, {
|
10964
11012
|
key: "_updateLayout",
|
10965
11013
|
value: function _updateLayout(minPadding) {
|
10966
|
-
var
|
11014
|
+
var _this15 = this;
|
10967
11015
|
if (this.notifyPlugins('beforeLayout', {
|
10968
11016
|
cancelable: true
|
10969
11017
|
}) === false) {
|
@@ -10974,14 +11022,14 @@
|
|
10974
11022
|
var noArea = area.width <= 0 || area.height <= 0;
|
10975
11023
|
this._layers = [];
|
10976
11024
|
each(this.boxes, function (box) {
|
10977
|
-
var
|
11025
|
+
var _this15$_layers;
|
10978
11026
|
if (noArea && box.position === 'chartArea') {
|
10979
11027
|
return;
|
10980
11028
|
}
|
10981
11029
|
if (box.configure) {
|
10982
11030
|
box.configure();
|
10983
11031
|
}
|
10984
|
-
(
|
11032
|
+
(_this15$_layers = _this15._layers).push.apply(_this15$_layers, _toConsumableArray(box._layers()));
|
10985
11033
|
}, this);
|
10986
11034
|
this._layers.forEach(function (item, index) {
|
10987
11035
|
item._idx = index;
|
@@ -11296,17 +11344,17 @@
|
|
11296
11344
|
}, {
|
11297
11345
|
key: "bindUserEvents",
|
11298
11346
|
value: function bindUserEvents() {
|
11299
|
-
var
|
11347
|
+
var _this16 = this;
|
11300
11348
|
var listeners = this._listeners;
|
11301
11349
|
var platform = this.platform;
|
11302
11350
|
var _add = function _add(type, listener) {
|
11303
|
-
platform.addEventListener(
|
11351
|
+
platform.addEventListener(_this16, type, listener);
|
11304
11352
|
listeners[type] = listener;
|
11305
11353
|
};
|
11306
11354
|
var listener = function listener(e, x, y) {
|
11307
11355
|
e.offsetX = x;
|
11308
11356
|
e.offsetY = y;
|
11309
|
-
|
11357
|
+
_this16._eventHandler(e);
|
11310
11358
|
};
|
11311
11359
|
each(this.options.events, function (type) {
|
11312
11360
|
return _add(type, listener);
|
@@ -11315,40 +11363,40 @@
|
|
11315
11363
|
}, {
|
11316
11364
|
key: "bindResponsiveEvents",
|
11317
11365
|
value: function bindResponsiveEvents() {
|
11318
|
-
var
|
11366
|
+
var _this17 = this;
|
11319
11367
|
if (!this._responsiveListeners) {
|
11320
11368
|
this._responsiveListeners = {};
|
11321
11369
|
}
|
11322
11370
|
var listeners = this._responsiveListeners;
|
11323
11371
|
var platform = this.platform;
|
11324
11372
|
var _add = function _add(type, listener) {
|
11325
|
-
platform.addEventListener(
|
11373
|
+
platform.addEventListener(_this17, type, listener);
|
11326
11374
|
listeners[type] = listener;
|
11327
11375
|
};
|
11328
11376
|
var _remove = function _remove(type, listener) {
|
11329
11377
|
if (listeners[type]) {
|
11330
|
-
platform.removeEventListener(
|
11378
|
+
platform.removeEventListener(_this17, type, listener);
|
11331
11379
|
delete listeners[type];
|
11332
11380
|
}
|
11333
11381
|
};
|
11334
11382
|
var listener = function listener(width, height) {
|
11335
|
-
if (
|
11336
|
-
|
11383
|
+
if (_this17.canvas) {
|
11384
|
+
_this17.resize(width, height);
|
11337
11385
|
}
|
11338
11386
|
};
|
11339
11387
|
var detached;
|
11340
11388
|
var _attached = function attached() {
|
11341
11389
|
_remove('attach', _attached);
|
11342
|
-
|
11343
|
-
|
11390
|
+
_this17.attached = true;
|
11391
|
+
_this17.resize();
|
11344
11392
|
_add('resize', listener);
|
11345
11393
|
_add('detach', detached);
|
11346
11394
|
};
|
11347
11395
|
detached = function detached() {
|
11348
|
-
|
11396
|
+
_this17.attached = false;
|
11349
11397
|
_remove('resize', listener);
|
11350
|
-
|
11351
|
-
|
11398
|
+
_this17._stop();
|
11399
|
+
_this17._resize(0, 0);
|
11352
11400
|
_add('attach', _attached);
|
11353
11401
|
};
|
11354
11402
|
if (platform.isAttached(this.canvas)) {
|
@@ -11360,13 +11408,13 @@
|
|
11360
11408
|
}, {
|
11361
11409
|
key: "unbindEvents",
|
11362
11410
|
value: function unbindEvents() {
|
11363
|
-
var
|
11411
|
+
var _this18 = this;
|
11364
11412
|
each(this._listeners, function (listener, type) {
|
11365
|
-
|
11413
|
+
_this18.platform.removeEventListener(_this18, type, listener);
|
11366
11414
|
});
|
11367
11415
|
this._listeners = {};
|
11368
11416
|
each(this._responsiveListeners, function (listener, type) {
|
11369
|
-
|
11417
|
+
_this18.platform.removeEventListener(_this18, type, listener);
|
11370
11418
|
});
|
11371
11419
|
this._responsiveListeners = undefined;
|
11372
11420
|
}
|
@@ -11395,12 +11443,12 @@
|
|
11395
11443
|
}, {
|
11396
11444
|
key: "setActiveElements",
|
11397
11445
|
value: function setActiveElements(activeElements) {
|
11398
|
-
var
|
11446
|
+
var _this19 = this;
|
11399
11447
|
var lastActive = this._active || [];
|
11400
11448
|
var active = activeElements.map(function (_ref4) {
|
11401
11449
|
var datasetIndex = _ref4.datasetIndex,
|
11402
11450
|
index = _ref4.index;
|
11403
|
-
var meta =
|
11451
|
+
var meta = _this19.getDatasetMeta(datasetIndex);
|
11404
11452
|
if (!meta) {
|
11405
11453
|
throw new Error('No dataset found at index ' + datasetIndex);
|
11406
11454
|
}
|
@@ -11452,7 +11500,7 @@
|
|
11452
11500
|
}, {
|
11453
11501
|
key: "_eventHandler",
|
11454
11502
|
value: function _eventHandler(e, replay) {
|
11455
|
-
var
|
11503
|
+
var _this20 = this;
|
11456
11504
|
var args = {
|
11457
11505
|
event: e,
|
11458
11506
|
replay: replay,
|
@@ -11460,7 +11508,7 @@
|
|
11460
11508
|
inChartArea: this.isPointInArea(e)
|
11461
11509
|
};
|
11462
11510
|
var eventFilter = function eventFilter(plugin) {
|
11463
|
-
return (plugin.options.events ||
|
11511
|
+
return (plugin.options.events || _this20.options.events).includes(e["native"].type);
|
11464
11512
|
};
|
11465
11513
|
if (this.notifyPlugins('beforeEvent', args, eventFilter) === false) {
|
11466
11514
|
return;
|
@@ -11535,6 +11583,40 @@
|
|
11535
11583
|
return chart._plugins.invalidate();
|
11536
11584
|
});
|
11537
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
|
+
}
|
11538
11620
|
function clipArc(ctx, element, endAngle) {
|
11539
11621
|
var startAngle = element.startAngle,
|
11540
11622
|
pixelMargin = element.pixelMargin,
|
@@ -11717,7 +11799,8 @@
|
|
11717
11799
|
var borderWidth = options.borderWidth,
|
11718
11800
|
borderJoinStyle = options.borderJoinStyle,
|
11719
11801
|
borderDash = options.borderDash,
|
11720
|
-
borderDashOffset = options.borderDashOffset
|
11802
|
+
borderDashOffset = options.borderDashOffset,
|
11803
|
+
borderRadius = options.borderRadius;
|
11721
11804
|
var inner = options.borderAlign === 'inner';
|
11722
11805
|
if (!borderWidth) {
|
11723
11806
|
return;
|
@@ -11744,6 +11827,9 @@
|
|
11744
11827
|
if (inner) {
|
11745
11828
|
clipArc(ctx, element, endAngle);
|
11746
11829
|
}
|
11830
|
+
if (options.selfJoin && endAngle - startAngle >= PI && borderRadius === 0 && borderJoinStyle !== 'miter') {
|
11831
|
+
clipSelf(ctx, element, endAngle);
|
11832
|
+
}
|
11747
11833
|
if (!fullCircles) {
|
11748
11834
|
pathArc(ctx, element, offset, spacing, endAngle, circular);
|
11749
11835
|
ctx.stroke();
|
@@ -11751,28 +11837,28 @@
|
|
11751
11837
|
}
|
11752
11838
|
var ArcElement = /*#__PURE__*/function (_Element3) {
|
11753
11839
|
function ArcElement(cfg) {
|
11754
|
-
var
|
11840
|
+
var _this21;
|
11755
11841
|
_classCallCheck$1(this, ArcElement);
|
11756
|
-
|
11757
|
-
_defineProperty$1(
|
11758
|
-
_defineProperty$1(
|
11759
|
-
_defineProperty$1(
|
11760
|
-
_defineProperty$1(
|
11761
|
-
_defineProperty$1(
|
11762
|
-
_defineProperty$1(
|
11763
|
-
_defineProperty$1(
|
11764
|
-
|
11765
|
-
|
11766
|
-
|
11767
|
-
|
11768
|
-
|
11769
|
-
|
11770
|
-
|
11771
|
-
|
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;
|
11772
11858
|
if (cfg) {
|
11773
|
-
Object.assign(
|
11859
|
+
Object.assign(_this21, cfg);
|
11774
11860
|
}
|
11775
|
-
return
|
11861
|
+
return _this21;
|
11776
11862
|
}
|
11777
11863
|
_inherits$1(ArcElement, _Element3);
|
11778
11864
|
return _createClass$1(ArcElement, [{
|
@@ -11808,9 +11894,9 @@
|
|
11808
11894
|
endAngle = _this$getProps3.endAngle,
|
11809
11895
|
innerRadius = _this$getProps3.innerRadius,
|
11810
11896
|
outerRadius = _this$getProps3.outerRadius;
|
11811
|
-
var _this$
|
11812
|
-
offset = _this$
|
11813
|
-
spacing = _this$
|
11897
|
+
var _this$options11 = this.options,
|
11898
|
+
offset = _this$options11.offset,
|
11899
|
+
spacing = _this$options11.spacing;
|
11814
11900
|
var halfAngle = (startAngle + endAngle) / 2;
|
11815
11901
|
var halfRadius = (innerRadius + outerRadius + spacing + offset) / 2;
|
11816
11902
|
return {
|
@@ -11861,7 +11947,8 @@
|
|
11861
11947
|
offset: 0,
|
11862
11948
|
spacing: 0,
|
11863
11949
|
angle: undefined,
|
11864
|
-
circular: true
|
11950
|
+
circular: true,
|
11951
|
+
selfJoin: false
|
11865
11952
|
});
|
11866
11953
|
_defineProperty$1(ArcElement, "defaultRoutes", {
|
11867
11954
|
backgroundColor: 'backgroundColor'
|
@@ -12027,11 +12114,11 @@
|
|
12027
12114
|
var segments = line.segments,
|
12028
12115
|
options = line.options;
|
12029
12116
|
var segmentMethod = _getSegmentMethod(line);
|
12030
|
-
var
|
12031
|
-
|
12117
|
+
var _iterator15 = _createForOfIteratorHelper$1(segments),
|
12118
|
+
_step15;
|
12032
12119
|
try {
|
12033
|
-
for (
|
12034
|
-
var segment =
|
12120
|
+
for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
|
12121
|
+
var segment = _step15.value;
|
12035
12122
|
setStyle(ctx, options, segment.style);
|
12036
12123
|
ctx.beginPath();
|
12037
12124
|
if (segmentMethod(ctx, line, segment, {
|
@@ -12043,9 +12130,9 @@
|
|
12043
12130
|
ctx.stroke();
|
12044
12131
|
}
|
12045
12132
|
} catch (err) {
|
12046
|
-
|
12133
|
+
_iterator15.e(err);
|
12047
12134
|
} finally {
|
12048
|
-
|
12135
|
+
_iterator15.f();
|
12049
12136
|
}
|
12050
12137
|
}
|
12051
12138
|
var usePath2D = typeof Path2D === 'function';
|
@@ -12058,24 +12145,24 @@
|
|
12058
12145
|
}
|
12059
12146
|
var LineElement = /*#__PURE__*/function (_Element4) {
|
12060
12147
|
function LineElement(cfg) {
|
12061
|
-
var
|
12148
|
+
var _this22;
|
12062
12149
|
_classCallCheck$1(this, LineElement);
|
12063
|
-
|
12064
|
-
|
12065
|
-
|
12066
|
-
|
12067
|
-
|
12068
|
-
|
12069
|
-
|
12070
|
-
|
12071
|
-
|
12072
|
-
|
12073
|
-
|
12074
|
-
|
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;
|
12075
12162
|
if (cfg) {
|
12076
|
-
Object.assign(
|
12163
|
+
Object.assign(_this22, cfg);
|
12077
12164
|
}
|
12078
|
-
return
|
12165
|
+
return _this22;
|
12079
12166
|
}
|
12080
12167
|
_inherits$1(LineElement, _Element4);
|
12081
12168
|
return _createClass$1(LineElement, [{
|
@@ -12167,20 +12254,20 @@
|
|
12167
12254
|
var loop = this._loop;
|
12168
12255
|
start = start || 0;
|
12169
12256
|
count = count || this.points.length - start;
|
12170
|
-
var
|
12171
|
-
|
12257
|
+
var _iterator16 = _createForOfIteratorHelper$1(segments),
|
12258
|
+
_step16;
|
12172
12259
|
try {
|
12173
|
-
for (
|
12174
|
-
var segment =
|
12260
|
+
for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
|
12261
|
+
var segment = _step16.value;
|
12175
12262
|
loop &= segmentMethod(ctx, this, segment, {
|
12176
12263
|
start: start,
|
12177
12264
|
end: start + count - 1
|
12178
12265
|
});
|
12179
12266
|
}
|
12180
12267
|
} catch (err) {
|
12181
|
-
|
12268
|
+
_iterator16.e(err);
|
12182
12269
|
} finally {
|
12183
|
-
|
12270
|
+
_iterator16.f();
|
12184
12271
|
}
|
12185
12272
|
return !!loop;
|
12186
12273
|
}
|
@@ -12233,20 +12320,20 @@
|
|
12233
12320
|
}
|
12234
12321
|
var PointElement = /*#__PURE__*/function (_Element5) {
|
12235
12322
|
function PointElement(cfg) {
|
12236
|
-
var
|
12323
|
+
var _this23;
|
12237
12324
|
_classCallCheck$1(this, PointElement);
|
12238
|
-
|
12239
|
-
_defineProperty$1(
|
12240
|
-
_defineProperty$1(
|
12241
|
-
_defineProperty$1(
|
12242
|
-
|
12243
|
-
|
12244
|
-
|
12245
|
-
|
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;
|
12246
12333
|
if (cfg) {
|
12247
|
-
Object.assign(
|
12334
|
+
Object.assign(_this23, cfg);
|
12248
12335
|
}
|
12249
|
-
return
|
12336
|
+
return _this23;
|
12250
12337
|
}
|
12251
12338
|
_inherits$1(PointElement, _Element5);
|
12252
12339
|
return _createClass$1(PointElement, [{
|
@@ -12443,28 +12530,28 @@
|
|
12443
12530
|
}
|
12444
12531
|
var BarElement = /*#__PURE__*/function (_Element6) {
|
12445
12532
|
function BarElement(cfg) {
|
12446
|
-
var
|
12533
|
+
var _this24;
|
12447
12534
|
_classCallCheck$1(this, BarElement);
|
12448
|
-
|
12449
|
-
|
12450
|
-
|
12451
|
-
|
12452
|
-
|
12453
|
-
|
12454
|
-
|
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;
|
12455
12542
|
if (cfg) {
|
12456
|
-
Object.assign(
|
12543
|
+
Object.assign(_this24, cfg);
|
12457
12544
|
}
|
12458
|
-
return
|
12545
|
+
return _this24;
|
12459
12546
|
}
|
12460
12547
|
_inherits$1(BarElement, _Element6);
|
12461
12548
|
return _createClass$1(BarElement, [{
|
12462
12549
|
key: "draw",
|
12463
12550
|
value: function draw(ctx) {
|
12464
12551
|
var inflateAmount = this.inflateAmount,
|
12465
|
-
_this$
|
12466
|
-
borderColor = _this$
|
12467
|
-
backgroundColor = _this$
|
12552
|
+
_this$options12 = this.options,
|
12553
|
+
borderColor = _this$options12.borderColor,
|
12554
|
+
backgroundColor = _this$options12.backgroundColor;
|
12468
12555
|
var _boundingRects = boundingRects(this),
|
12469
12556
|
inner = _boundingRects.inner,
|
12470
12557
|
outer = _boundingRects.outer;
|
@@ -12829,11 +12916,11 @@
|
|
12829
12916
|
var points = line.points;
|
12830
12917
|
var tpoints = target.points;
|
12831
12918
|
var parts = [];
|
12832
|
-
var
|
12833
|
-
|
12919
|
+
var _iterator17 = _createForOfIteratorHelper$1(segments),
|
12920
|
+
_step17;
|
12834
12921
|
try {
|
12835
|
-
for (
|
12836
|
-
var segment =
|
12922
|
+
for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) {
|
12923
|
+
var segment = _step17.value;
|
12837
12924
|
var start = segment.start,
|
12838
12925
|
end = segment.end;
|
12839
12926
|
end = _findSegmentEnd(start, end, points);
|
@@ -12848,18 +12935,18 @@
|
|
12848
12935
|
continue;
|
12849
12936
|
}
|
12850
12937
|
var targetSegments = _boundSegments(target, bounds);
|
12851
|
-
var
|
12852
|
-
|
12938
|
+
var _iterator18 = _createForOfIteratorHelper$1(targetSegments),
|
12939
|
+
_step18;
|
12853
12940
|
try {
|
12854
|
-
for (
|
12855
|
-
var tgt =
|
12941
|
+
for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
|
12942
|
+
var tgt = _step18.value;
|
12856
12943
|
var subBounds = _getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);
|
12857
12944
|
var fillSources = _boundSegment(segment, points, subBounds);
|
12858
|
-
var
|
12859
|
-
|
12945
|
+
var _iterator19 = _createForOfIteratorHelper$1(fillSources),
|
12946
|
+
_step19;
|
12860
12947
|
try {
|
12861
|
-
for (
|
12862
|
-
var fillSource =
|
12948
|
+
for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) {
|
12949
|
+
var fillSource = _step19.value;
|
12863
12950
|
parts.push({
|
12864
12951
|
source: fillSource,
|
12865
12952
|
target: tgt,
|
@@ -12868,21 +12955,21 @@
|
|
12868
12955
|
});
|
12869
12956
|
}
|
12870
12957
|
} catch (err) {
|
12871
|
-
|
12958
|
+
_iterator19.e(err);
|
12872
12959
|
} finally {
|
12873
|
-
|
12960
|
+
_iterator19.f();
|
12874
12961
|
}
|
12875
12962
|
}
|
12876
12963
|
} catch (err) {
|
12877
|
-
|
12964
|
+
_iterator18.e(err);
|
12878
12965
|
} finally {
|
12879
|
-
|
12966
|
+
_iterator18.f();
|
12880
12967
|
}
|
12881
12968
|
}
|
12882
12969
|
} catch (err) {
|
12883
|
-
|
12970
|
+
_iterator17.e(err);
|
12884
12971
|
} finally {
|
12885
|
-
|
12972
|
+
_iterator17.f();
|
12886
12973
|
}
|
12887
12974
|
return parts;
|
12888
12975
|
}
|
@@ -13287,24 +13374,41 @@
|
|
13287
13374
|
clip = cfg.clip;
|
13288
13375
|
var property = line._loop ? 'angle' : cfg.axis;
|
13289
13376
|
ctx.save();
|
13290
|
-
|
13291
|
-
|
13292
|
-
|
13293
|
-
|
13294
|
-
|
13295
|
-
|
13296
|
-
|
13297
|
-
|
13298
|
-
|
13299
|
-
|
13300
|
-
|
13301
|
-
|
13302
|
-
|
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
|
+
}
|
13303
13407
|
}
|
13304
13408
|
fill(ctx, {
|
13305
13409
|
line: line,
|
13306
13410
|
target: target,
|
13307
|
-
color:
|
13411
|
+
color: fillColor,
|
13308
13412
|
scale: scale,
|
13309
13413
|
property: property,
|
13310
13414
|
clip: clip
|
@@ -13312,6 +13416,46 @@
|
|
13312
13416
|
ctx.restore();
|
13313
13417
|
}
|
13314
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) {
|
13315
13459
|
var segments = target.segments,
|
13316
13460
|
points = target.points;
|
13317
13461
|
var first = true;
|
@@ -13330,7 +13474,7 @@
|
|
13330
13474
|
ctx.moveTo(firstPoint.x, firstPoint.y);
|
13331
13475
|
first = false;
|
13332
13476
|
} else {
|
13333
|
-
ctx.lineTo(firstPoint.
|
13477
|
+
ctx.lineTo(clipX, firstPoint.y);
|
13334
13478
|
ctx.lineTo(firstPoint.x, firstPoint.y);
|
13335
13479
|
}
|
13336
13480
|
lineLoop = !!target.pathSegment(ctx, segment, {
|
@@ -13339,7 +13483,7 @@
|
|
13339
13483
|
if (lineLoop) {
|
13340
13484
|
ctx.closePath();
|
13341
13485
|
} else {
|
13342
|
-
ctx.lineTo(lastPoint.
|
13486
|
+
ctx.lineTo(clipX, lastPoint.y);
|
13343
13487
|
}
|
13344
13488
|
}
|
13345
13489
|
} catch (err) {
|
@@ -13347,7 +13491,7 @@
|
|
13347
13491
|
} finally {
|
13348
13492
|
_iterator21.f();
|
13349
13493
|
}
|
13350
|
-
ctx.lineTo(target.first().
|
13494
|
+
ctx.lineTo(clipX, target.first().y);
|
13351
13495
|
ctx.closePath();
|
13352
13496
|
ctx.clip();
|
13353
13497
|
}
|
@@ -13406,10 +13550,10 @@
|
|
13406
13550
|
}
|
13407
13551
|
function clipBounds(ctx, scale, clip, bounds) {
|
13408
13552
|
var chartArea = scale.chart.chartArea;
|
13409
|
-
var
|
13410
|
-
property =
|
13411
|
-
start =
|
13412
|
-
end =
|
13553
|
+
var _ref0 = bounds || {},
|
13554
|
+
property = _ref0.property,
|
13555
|
+
start = _ref0.start,
|
13556
|
+
end = _ref0.end;
|
13413
13557
|
if (property === 'x' || property === 'y') {
|
13414
13558
|
var left, top, right, bottom;
|
13415
13559
|
if (property === 'x') {
|
@@ -13531,32 +13675,32 @@
|
|
13531
13675
|
};
|
13532
13676
|
var Legend = /*#__PURE__*/function (_Element7) {
|
13533
13677
|
function Legend(config) {
|
13534
|
-
var
|
13678
|
+
var _this25;
|
13535
13679
|
_classCallCheck$1(this, Legend);
|
13536
|
-
|
13537
|
-
|
13538
|
-
|
13539
|
-
|
13540
|
-
|
13541
|
-
|
13542
|
-
|
13543
|
-
|
13544
|
-
|
13545
|
-
|
13546
|
-
|
13547
|
-
|
13548
|
-
|
13549
|
-
|
13550
|
-
|
13551
|
-
|
13552
|
-
|
13553
|
-
|
13554
|
-
|
13555
|
-
|
13556
|
-
|
13557
|
-
|
13558
|
-
|
13559
|
-
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;
|
13560
13704
|
}
|
13561
13705
|
_inherits$1(Legend, _Element7);
|
13562
13706
|
return _createClass$1(Legend, [{
|
@@ -13585,17 +13729,17 @@
|
|
13585
13729
|
}, {
|
13586
13730
|
key: "buildLabels",
|
13587
13731
|
value: function buildLabels() {
|
13588
|
-
var
|
13732
|
+
var _this26 = this;
|
13589
13733
|
var labelOpts = this.options.labels || {};
|
13590
13734
|
var legendItems = callback(labelOpts.generateLabels, [this.chart], this) || [];
|
13591
13735
|
if (labelOpts.filter) {
|
13592
13736
|
legendItems = legendItems.filter(function (item) {
|
13593
|
-
return labelOpts.filter(item,
|
13737
|
+
return labelOpts.filter(item, _this26.chart.data);
|
13594
13738
|
});
|
13595
13739
|
}
|
13596
13740
|
if (labelOpts.sort) {
|
13597
13741
|
legendItems = legendItems.sort(function (a, b) {
|
13598
|
-
return labelOpts.sort(a, b,
|
13742
|
+
return labelOpts.sort(a, b, _this26.chart.data);
|
13599
13743
|
});
|
13600
13744
|
}
|
13601
13745
|
if (this.options.reverse) {
|
@@ -13717,10 +13861,10 @@
|
|
13717
13861
|
}
|
13718
13862
|
var titleHeight = this._computeTitleHeight();
|
13719
13863
|
var hitboxes = this.legendHitBoxes,
|
13720
|
-
_this$
|
13721
|
-
align = _this$
|
13722
|
-
padding = _this$
|
13723
|
-
rtl = _this$
|
13864
|
+
_this$options13 = this.options,
|
13865
|
+
align = _this$options13.align,
|
13866
|
+
padding = _this$options13.labels.padding,
|
13867
|
+
rtl = _this$options13.rtl;
|
13724
13868
|
var rtlHelper = getRtlAdapter(rtl, this.left, this.width);
|
13725
13869
|
if (this.isHorizontal()) {
|
13726
13870
|
var row = 0;
|
@@ -13785,7 +13929,7 @@
|
|
13785
13929
|
}, {
|
13786
13930
|
key: "_draw",
|
13787
13931
|
value: function _draw() {
|
13788
|
-
var
|
13932
|
+
var _this27 = this;
|
13789
13933
|
var opts = this.options,
|
13790
13934
|
columnSizes = this.columnSizes,
|
13791
13935
|
lineWidths = this.lineWidths,
|
@@ -13887,21 +14031,21 @@
|
|
13887
14031
|
var width = boxWidth + halfFontSize + textWidth;
|
13888
14032
|
var x = cursor.x;
|
13889
14033
|
var y = cursor.y;
|
13890
|
-
rtlHelper.setWidth(
|
14034
|
+
rtlHelper.setWidth(_this27.width);
|
13891
14035
|
if (isHorizontal) {
|
13892
|
-
if (i > 0 && x + width + padding >
|
14036
|
+
if (i > 0 && x + width + padding > _this27.right) {
|
13893
14037
|
y = cursor.y += lineHeight;
|
13894
14038
|
cursor.line++;
|
13895
|
-
x = cursor.x = _alignStartEnd(align,
|
14039
|
+
x = cursor.x = _alignStartEnd(align, _this27.left + padding, _this27.right - lineWidths[cursor.line]);
|
13896
14040
|
}
|
13897
|
-
} else if (i > 0 && y + lineHeight >
|
14041
|
+
} else if (i > 0 && y + lineHeight > _this27.bottom) {
|
13898
14042
|
x = cursor.x = x + columnSizes[cursor.line].width + padding;
|
13899
14043
|
cursor.line++;
|
13900
|
-
y = cursor.y = _alignStartEnd(align,
|
14044
|
+
y = cursor.y = _alignStartEnd(align, _this27.top + titleHeight + padding, _this27.bottom - columnSizes[cursor.line].height);
|
13901
14045
|
}
|
13902
14046
|
var realX = rtlHelper.x(x);
|
13903
14047
|
drawLegendBox(realX, y, legendItem);
|
13904
|
-
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width :
|
14048
|
+
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : _this27.right, opts.rtl);
|
13905
14049
|
fillText(rtlHelper.x(x), y, legendItem);
|
13906
14050
|
if (isHorizontal) {
|
13907
14051
|
cursor.x += width + padding;
|
@@ -14145,23 +14289,23 @@
|
|
14145
14289
|
};
|
14146
14290
|
var Title = /*#__PURE__*/function (_Element8) {
|
14147
14291
|
function Title(config) {
|
14148
|
-
var
|
14292
|
+
var _this28;
|
14149
14293
|
_classCallCheck$1(this, Title);
|
14150
|
-
|
14151
|
-
|
14152
|
-
|
14153
|
-
|
14154
|
-
|
14155
|
-
|
14156
|
-
|
14157
|
-
|
14158
|
-
|
14159
|
-
|
14160
|
-
|
14161
|
-
|
14162
|
-
|
14163
|
-
|
14164
|
-
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;
|
14165
14309
|
}
|
14166
14310
|
_inherits$1(Title, _Element8);
|
14167
14311
|
return _createClass$1(Title, [{
|
@@ -14680,37 +14824,37 @@
|
|
14680
14824
|
}
|
14681
14825
|
var Tooltip = /*#__PURE__*/function (_Element9) {
|
14682
14826
|
function Tooltip(config) {
|
14683
|
-
var
|
14827
|
+
var _this29;
|
14684
14828
|
_classCallCheck$1(this, Tooltip);
|
14685
|
-
|
14686
|
-
|
14687
|
-
|
14688
|
-
|
14689
|
-
|
14690
|
-
|
14691
|
-
|
14692
|
-
|
14693
|
-
|
14694
|
-
|
14695
|
-
|
14696
|
-
|
14697
|
-
|
14698
|
-
|
14699
|
-
|
14700
|
-
|
14701
|
-
|
14702
|
-
|
14703
|
-
|
14704
|
-
|
14705
|
-
|
14706
|
-
|
14707
|
-
|
14708
|
-
|
14709
|
-
|
14710
|
-
|
14711
|
-
|
14712
|
-
|
14713
|
-
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;
|
14714
14858
|
}
|
14715
14859
|
_inherits$1(Tooltip, _Element9);
|
14716
14860
|
return _createClass$1(Tooltip, [{
|
@@ -14762,7 +14906,7 @@
|
|
14762
14906
|
}, {
|
14763
14907
|
key: "getBody",
|
14764
14908
|
value: function getBody(tooltipItems, options) {
|
14765
|
-
var
|
14909
|
+
var _this30 = this;
|
14766
14910
|
var callbacks = options.callbacks;
|
14767
14911
|
var bodyItems = [];
|
14768
14912
|
each(tooltipItems, function (context) {
|
@@ -14772,9 +14916,9 @@
|
|
14772
14916
|
after: []
|
14773
14917
|
};
|
14774
14918
|
var scoped = overrideCallbacks(callbacks, context);
|
14775
|
-
pushOrConcat(bodyItem.before, splitNewlines(invokeCallbackWithFallback(scoped, 'beforeLabel',
|
14776
|
-
pushOrConcat(bodyItem.lines, invokeCallbackWithFallback(scoped, 'label',
|
14777
|
-
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)));
|
14778
14922
|
bodyItems.push(bodyItem);
|
14779
14923
|
});
|
14780
14924
|
return bodyItems;
|
@@ -14800,7 +14944,7 @@
|
|
14800
14944
|
}, {
|
14801
14945
|
key: "_createItems",
|
14802
14946
|
value: function _createItems(options) {
|
14803
|
-
var
|
14947
|
+
var _this31 = this;
|
14804
14948
|
var active = this._active;
|
14805
14949
|
var data = this.chart.data;
|
14806
14950
|
var labelColors = [];
|
@@ -14823,9 +14967,9 @@
|
|
14823
14967
|
}
|
14824
14968
|
each(tooltipItems, function (context) {
|
14825
14969
|
var scoped = overrideCallbacks(options.callbacks, context);
|
14826
|
-
labelColors.push(invokeCallbackWithFallback(scoped, 'labelColor',
|
14827
|
-
labelPointStyles.push(invokeCallbackWithFallback(scoped, 'labelPointStyle',
|
14828
|
-
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));
|
14829
14973
|
});
|
14830
14974
|
this.labelColors = labelColors;
|
14831
14975
|
this.labelPointStyles = labelPointStyles;
|
@@ -15232,12 +15376,12 @@
|
|
15232
15376
|
}, {
|
15233
15377
|
key: "setActiveElements",
|
15234
15378
|
value: function setActiveElements(activeElements, eventPosition) {
|
15235
|
-
var
|
15379
|
+
var _this32 = this;
|
15236
15380
|
var lastActive = this._active;
|
15237
|
-
var active = activeElements.map(function (
|
15238
|
-
var datasetIndex =
|
15239
|
-
index =
|
15240
|
-
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);
|
15241
15385
|
if (!meta) {
|
15242
15386
|
throw new Error('Cannot find a dataset at index ' + datasetIndex);
|
15243
15387
|
}
|
@@ -15284,14 +15428,14 @@
|
|
15284
15428
|
}, {
|
15285
15429
|
key: "_getActiveElements",
|
15286
15430
|
value: function _getActiveElements(e, lastActive, replay, inChartArea) {
|
15287
|
-
var
|
15431
|
+
var _this33 = this;
|
15288
15432
|
var options = this.options;
|
15289
15433
|
if (e.type === 'mouseout') {
|
15290
15434
|
return [];
|
15291
15435
|
}
|
15292
15436
|
if (!inChartArea) {
|
15293
15437
|
return lastActive.filter(function (i) {
|
15294
|
-
return
|
15438
|
+
return _this33.chart.data.datasets[i.datasetIndex] && _this33.chart.getDatasetMeta(i.datasetIndex).controller.getParsed(i.index) !== undefined;
|
15295
15439
|
});
|
15296
15440
|
}
|
15297
15441
|
var active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay);
|
@@ -15476,13 +15620,13 @@
|
|
15476
15620
|
}
|
15477
15621
|
var CategoryScale = /*#__PURE__*/function (_Scale) {
|
15478
15622
|
function CategoryScale(cfg) {
|
15479
|
-
var
|
15623
|
+
var _this34;
|
15480
15624
|
_classCallCheck$1(this, CategoryScale);
|
15481
|
-
|
15482
|
-
|
15483
|
-
|
15484
|
-
|
15485
|
-
return
|
15625
|
+
_this34 = _callSuper(this, CategoryScale, [cfg]);
|
15626
|
+
_this34._startValue = undefined;
|
15627
|
+
_this34._valueRange = 0;
|
15628
|
+
_this34._addedLabels = [];
|
15629
|
+
return _this34;
|
15486
15630
|
}
|
15487
15631
|
_inherits$1(CategoryScale, _Scale);
|
15488
15632
|
return _createClass$1(CategoryScale, [{
|
@@ -15713,9 +15857,9 @@
|
|
15713
15857
|
}
|
15714
15858
|
return ticks;
|
15715
15859
|
}
|
15716
|
-
function relativeLabelSize(value, minSpacing,
|
15717
|
-
var horizontal =
|
15718
|
-
minRotation =
|
15860
|
+
function relativeLabelSize(value, minSpacing, _ref10) {
|
15861
|
+
var horizontal = _ref10.horizontal,
|
15862
|
+
minRotation = _ref10.minRotation;
|
15719
15863
|
var rad = toRadians(minRotation);
|
15720
15864
|
var ratio = (horizontal ? Math.sin(rad) : Math.cos(rad)) || 0.001;
|
15721
15865
|
var length = 0.75 * minSpacing * ('' + value).length;
|
@@ -15723,15 +15867,15 @@
|
|
15723
15867
|
}
|
15724
15868
|
var LinearScaleBase = /*#__PURE__*/function (_Scale2) {
|
15725
15869
|
function LinearScaleBase(cfg) {
|
15726
|
-
var
|
15870
|
+
var _this35;
|
15727
15871
|
_classCallCheck$1(this, LinearScaleBase);
|
15728
|
-
|
15729
|
-
|
15730
|
-
|
15731
|
-
|
15732
|
-
|
15733
|
-
|
15734
|
-
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;
|
15735
15879
|
}
|
15736
15880
|
_inherits$1(LinearScaleBase, _Scale2);
|
15737
15881
|
return _createClass$1(LinearScaleBase, [{
|
@@ -15935,9 +16079,9 @@
|
|
15935
16079
|
}
|
15936
16080
|
return Math.min(rangeExp, log10Floor(min));
|
15937
16081
|
}
|
15938
|
-
function generateTicks(generationOptions,
|
15939
|
-
var min =
|
15940
|
-
max =
|
16082
|
+
function generateTicks(generationOptions, _ref11) {
|
16083
|
+
var min = _ref11.min,
|
16084
|
+
max = _ref11.max;
|
15941
16085
|
min = finiteOrDefault(generationOptions.min, min);
|
15942
16086
|
var ticks = [];
|
15943
16087
|
var minExp = log10Floor(min);
|
@@ -15977,14 +16121,14 @@
|
|
15977
16121
|
}
|
15978
16122
|
var LogarithmicScale = /*#__PURE__*/function (_Scale3) {
|
15979
16123
|
function LogarithmicScale(cfg) {
|
15980
|
-
var
|
16124
|
+
var _this36;
|
15981
16125
|
_classCallCheck$1(this, LogarithmicScale);
|
15982
|
-
|
15983
|
-
|
15984
|
-
|
15985
|
-
|
15986
|
-
|
15987
|
-
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;
|
15988
16132
|
}
|
15989
16133
|
_inherits$1(LogarithmicScale, _Scale3);
|
15990
16134
|
return _createClass$1(LogarithmicScale, [{
|
@@ -16377,15 +16521,15 @@
|
|
16377
16521
|
}
|
16378
16522
|
var RadialLinearScale = /*#__PURE__*/function (_LinearScaleBase2) {
|
16379
16523
|
function RadialLinearScale(cfg) {
|
16380
|
-
var
|
16524
|
+
var _this37;
|
16381
16525
|
_classCallCheck$1(this, RadialLinearScale);
|
16382
|
-
|
16383
|
-
|
16384
|
-
|
16385
|
-
|
16386
|
-
|
16387
|
-
|
16388
|
-
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;
|
16389
16533
|
}
|
16390
16534
|
_inherits$1(RadialLinearScale, _LinearScaleBase2);
|
16391
16535
|
return _createClass$1(RadialLinearScale, [{
|
@@ -16416,13 +16560,13 @@
|
|
16416
16560
|
}, {
|
16417
16561
|
key: "generateTickLabels",
|
16418
16562
|
value: function generateTickLabels(ticks) {
|
16419
|
-
var
|
16563
|
+
var _this38 = this;
|
16420
16564
|
LinearScaleBase.prototype.generateTickLabels.call(this, ticks);
|
16421
16565
|
this._pointLabels = this.getLabels().map(function (value, index) {
|
16422
|
-
var label = callback(
|
16566
|
+
var label = callback(_this38.options.pointLabels.callback, [value, index], _this38);
|
16423
16567
|
return label || label === 0 ? label : '';
|
16424
16568
|
}).filter(function (v, i) {
|
16425
|
-
return
|
16569
|
+
return _this38.chart.getDataVisibility(i);
|
16426
16570
|
});
|
16427
16571
|
}
|
16428
16572
|
}, {
|
@@ -16518,9 +16662,9 @@
|
|
16518
16662
|
}, {
|
16519
16663
|
key: "drawBackground",
|
16520
16664
|
value: function drawBackground() {
|
16521
|
-
var _this$
|
16522
|
-
backgroundColor = _this$
|
16523
|
-
circular = _this$
|
16665
|
+
var _this$options14 = this.options,
|
16666
|
+
backgroundColor = _this$options14.backgroundColor,
|
16667
|
+
circular = _this$options14.grid.circular;
|
16524
16668
|
if (backgroundColor) {
|
16525
16669
|
var ctx = this.ctx;
|
16526
16670
|
ctx.save();
|
@@ -16535,7 +16679,7 @@
|
|
16535
16679
|
}, {
|
16536
16680
|
key: "drawGrid",
|
16537
16681
|
value: function drawGrid() {
|
16538
|
-
var
|
16682
|
+
var _this39 = this;
|
16539
16683
|
var ctx = this.ctx;
|
16540
16684
|
var opts = this.options;
|
16541
16685
|
var angleLines = opts.angleLines,
|
@@ -16548,12 +16692,12 @@
|
|
16548
16692
|
}
|
16549
16693
|
if (grid.display) {
|
16550
16694
|
this.ticks.forEach(function (tick, index) {
|
16551
|
-
if (index !== 0 || index === 0 &&
|
16552
|
-
offset =
|
16553
|
-
var context =
|
16695
|
+
if (index !== 0 || index === 0 && _this39.min < 0) {
|
16696
|
+
offset = _this39.getDistanceFromCenterForValue(tick.value);
|
16697
|
+
var context = _this39.getContext(index);
|
16554
16698
|
var optsAtIndex = grid.setContext(context);
|
16555
16699
|
var optsAtIndexBorder = border.setContext(context);
|
16556
|
-
drawRadiusLine(
|
16700
|
+
drawRadiusLine(_this39, optsAtIndex, offset, labelCount, optsAtIndexBorder);
|
16557
16701
|
}
|
16558
16702
|
});
|
16559
16703
|
}
|
@@ -16586,7 +16730,7 @@
|
|
16586
16730
|
}, {
|
16587
16731
|
key: "drawLabels",
|
16588
16732
|
value: function drawLabels() {
|
16589
|
-
var
|
16733
|
+
var _this40 = this;
|
16590
16734
|
var ctx = this.ctx;
|
16591
16735
|
var opts = this.options;
|
16592
16736
|
var tickOpts = opts.ticks;
|
@@ -16601,12 +16745,12 @@
|
|
16601
16745
|
ctx.textAlign = 'center';
|
16602
16746
|
ctx.textBaseline = 'middle';
|
16603
16747
|
this.ticks.forEach(function (tick, index) {
|
16604
|
-
if (index === 0 &&
|
16748
|
+
if (index === 0 && _this40.min >= 0 && !opts.reverse) {
|
16605
16749
|
return;
|
16606
16750
|
}
|
16607
|
-
var optsAtIndex = tickOpts.setContext(
|
16751
|
+
var optsAtIndex = tickOpts.setContext(_this40.getContext(index));
|
16608
16752
|
var tickFont = toFont(optsAtIndex.font);
|
16609
|
-
offset =
|
16753
|
+
offset = _this40.getDistanceFromCenterForValue(_this40.ticks[index].value);
|
16610
16754
|
if (optsAtIndex.showLabelBackdrop) {
|
16611
16755
|
ctx.font = tickFont.string;
|
16612
16756
|
width = ctx.measureText(tick.label).width;
|
@@ -16812,20 +16956,20 @@
|
|
16812
16956
|
}
|
16813
16957
|
var TimeScale = /*#__PURE__*/function (_Scale4) {
|
16814
16958
|
function TimeScale(props) {
|
16815
|
-
var
|
16959
|
+
var _this41;
|
16816
16960
|
_classCallCheck$1(this, TimeScale);
|
16817
|
-
|
16818
|
-
|
16961
|
+
_this41 = _callSuper(this, TimeScale, [props]);
|
16962
|
+
_this41._cache = {
|
16819
16963
|
data: [],
|
16820
16964
|
labels: [],
|
16821
16965
|
all: []
|
16822
16966
|
};
|
16823
|
-
|
16824
|
-
|
16825
|
-
|
16826
|
-
|
16827
|
-
|
16828
|
-
return
|
16967
|
+
_this41._unit = 'day';
|
16968
|
+
_this41._majorUnit = undefined;
|
16969
|
+
_this41._offsets = {};
|
16970
|
+
_this41._normalized = false;
|
16971
|
+
_this41._parseOpts = undefined;
|
16972
|
+
return _this41;
|
16829
16973
|
}
|
16830
16974
|
_inherits$1(TimeScale, _Scale4);
|
16831
16975
|
return _createClass$1(TimeScale, [{
|
@@ -17182,13 +17326,13 @@
|
|
17182
17326
|
}
|
17183
17327
|
var TimeSeriesScale = /*#__PURE__*/function (_TimeScale2) {
|
17184
17328
|
function TimeSeriesScale(props) {
|
17185
|
-
var
|
17329
|
+
var _this42;
|
17186
17330
|
_classCallCheck$1(this, TimeSeriesScale);
|
17187
|
-
|
17188
|
-
|
17189
|
-
|
17190
|
-
|
17191
|
-
return
|
17331
|
+
_this42 = _callSuper(this, TimeSeriesScale, [props]);
|
17332
|
+
_this42._table = [];
|
17333
|
+
_this42._minPos = undefined;
|
17334
|
+
_this42._tableRange = undefined;
|
17335
|
+
return _this42;
|
17192
17336
|
}
|
17193
17337
|
_inherits$1(TimeSeriesScale, _TimeScale2);
|
17194
17338
|
return _createClass$1(TimeSeriesScale, [{
|