chartkick 4.0.2 → 4.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/chartkick/version.rb +1 -1
- data/vendor/assets/javascripts/Chart.bundle.js +787 -420
- data/vendor/assets/javascripts/chartkick.js +205 -212
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0db2fe39f763929c498438dc88f75dd51dbc9ace5ede4819e9f4d88c0cad72f
|
4
|
+
data.tar.gz: a1dbaf6eddf2bccfdc1e6f4b9fc114eea952eb021dedb7775832d3d5c2b8a389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eccf48920536b5f4277cac070759d501ee77177805e06146db100e1818337de38e7c9ae45109362817da72425d3385993136012d57530266122deb09c670ea1
|
7
|
+
data.tar.gz: 55190f89407e99810198d82cda444c49f8877b86ea0148e8d408f06a4d3fc9935e07ec77414119f4d06ccd905bf9124b6678c044c2cd9d68e7de206b2901e3d3
|
data/CHANGELOG.md
CHANGED
data/lib/chartkick/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* Chart.js v3.0
|
2
|
+
* Chart.js v3.1.0
|
3
3
|
* https://www.chartjs.org
|
4
4
|
* (c) 2021 Chart.js Contributors
|
5
5
|
* Released under the MIT License
|
@@ -2051,7 +2051,24 @@
|
|
2051
2051
|
ctx.restore();
|
2052
2052
|
}
|
2053
2053
|
|
2054
|
+
function addRoundedRectPath(ctx, rect) {
|
2055
|
+
var x = rect.x,
|
2056
|
+
y = rect.y,
|
2057
|
+
w = rect.w,
|
2058
|
+
h = rect.h,
|
2059
|
+
radius = rect.radius;
|
2060
|
+
ctx.arc(x + radius.topLeft, y + radius.topLeft, radius.topLeft, -HALF_PI, PI, true);
|
2061
|
+
ctx.lineTo(x, y + h - radius.bottomLeft);
|
2062
|
+
ctx.arc(x + radius.bottomLeft, y + h - radius.bottomLeft, radius.bottomLeft, PI, HALF_PI, true);
|
2063
|
+
ctx.lineTo(x + w - radius.bottomRight, y + h);
|
2064
|
+
ctx.arc(x + w - radius.bottomRight, y + h - radius.bottomRight, radius.bottomRight, HALF_PI, 0, true);
|
2065
|
+
ctx.lineTo(x + w, y + radius.topRight);
|
2066
|
+
ctx.arc(x + w - radius.topRight, y + radius.topRight, radius.topRight, 0, -HALF_PI, true);
|
2067
|
+
ctx.lineTo(x + radius.topLeft, y);
|
2068
|
+
}
|
2069
|
+
|
2054
2070
|
var LINE_HEIGHT = new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
|
2071
|
+
var FONT_STYLE = new RegExp(/^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]deg)?))$/);
|
2055
2072
|
|
2056
2073
|
function toLineHeight(value, size) {
|
2057
2074
|
var matches = ('' + value).match(LINE_HEIGHT);
|
@@ -2078,7 +2095,7 @@
|
|
2078
2095
|
return +v || 0;
|
2079
2096
|
};
|
2080
2097
|
|
2081
|
-
function
|
2098
|
+
function _readValueToProps(value, props) {
|
2082
2099
|
var ret = {};
|
2083
2100
|
var objProps = isObject(props);
|
2084
2101
|
var keys = objProps ? Object.keys(props) : props;
|
@@ -2108,7 +2125,7 @@
|
|
2108
2125
|
}
|
2109
2126
|
|
2110
2127
|
function toTRBL(value) {
|
2111
|
-
return
|
2128
|
+
return _readValueToProps(value, {
|
2112
2129
|
top: 'y',
|
2113
2130
|
right: 'x',
|
2114
2131
|
bottom: 'y',
|
@@ -2117,7 +2134,7 @@
|
|
2117
2134
|
}
|
2118
2135
|
|
2119
2136
|
function toTRBLCorners(value) {
|
2120
|
-
return
|
2137
|
+
return _readValueToProps(value, ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']);
|
2121
2138
|
}
|
2122
2139
|
|
2123
2140
|
function toPadding(value) {
|
@@ -2136,11 +2153,18 @@
|
|
2136
2153
|
size = parseInt(size, 10);
|
2137
2154
|
}
|
2138
2155
|
|
2156
|
+
var style = valueOrDefault(options.style, fallback.style);
|
2157
|
+
|
2158
|
+
if (style && !('' + style).match(FONT_STYLE)) {
|
2159
|
+
console.warn('Invalid font style specified: "' + style + '"');
|
2160
|
+
style = '';
|
2161
|
+
}
|
2162
|
+
|
2139
2163
|
var font = {
|
2140
2164
|
family: valueOrDefault(options.family, fallback.family),
|
2141
2165
|
lineHeight: toLineHeight(valueOrDefault(options.lineHeight, fallback.lineHeight), size),
|
2142
2166
|
size: size,
|
2143
|
-
style:
|
2167
|
+
style: style,
|
2144
2168
|
weight: valueOrDefault(options.weight, fallback.weight),
|
2145
2169
|
string: ''
|
2146
2170
|
};
|
@@ -2331,12 +2355,15 @@
|
|
2331
2355
|
var prefixes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [''];
|
2332
2356
|
var rootScopes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : scopes;
|
2333
2357
|
var fallback = arguments.length > 3 ? arguments[3] : undefined;
|
2358
|
+
var getTarget = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : function () {
|
2359
|
+
return scopes[0];
|
2360
|
+
};
|
2334
2361
|
|
2335
2362
|
if (!defined(fallback)) {
|
2336
2363
|
fallback = _resolve('_fallback', scopes);
|
2337
2364
|
}
|
2338
2365
|
|
2339
|
-
var cache = (_cache = {}, _defineProperty(_cache, Symbol.toStringTag, 'Object'), _defineProperty(_cache, "_cacheable", true), _defineProperty(_cache, "_scopes", scopes), _defineProperty(_cache, "_rootScopes", rootScopes), _defineProperty(_cache, "_fallback", fallback), _defineProperty(_cache, "override", function override(scope) {
|
2366
|
+
var cache = (_cache = {}, _defineProperty(_cache, Symbol.toStringTag, 'Object'), _defineProperty(_cache, "_cacheable", true), _defineProperty(_cache, "_scopes", scopes), _defineProperty(_cache, "_rootScopes", rootScopes), _defineProperty(_cache, "_fallback", fallback), _defineProperty(_cache, "_getTarget", getTarget), _defineProperty(_cache, "override", function override(scope) {
|
2340
2367
|
return _createResolver([scope].concat(_toConsumableArray(scopes)), prefixes, rootScopes, fallback);
|
2341
2368
|
}), _cache);
|
2342
2369
|
return new Proxy(cache, {
|
@@ -2364,7 +2391,8 @@
|
|
2364
2391
|
return getKeysFromAllScopes(target);
|
2365
2392
|
},
|
2366
2393
|
set: function set(target, prop, value) {
|
2367
|
-
|
2394
|
+
var storage = target._storage || (target._storage = getTarget());
|
2395
|
+
storage[prop] = value;
|
2368
2396
|
delete target[prop];
|
2369
2397
|
delete target._keys;
|
2370
2398
|
return true;
|
@@ -2594,12 +2622,6 @@
|
|
2594
2622
|
var fallback = resolveFallback(resolver._fallback, prop, value);
|
2595
2623
|
var allScopes = [].concat(_toConsumableArray(parentScopes), _toConsumableArray(rootScopes));
|
2596
2624
|
var set = new Set();
|
2597
|
-
var firstParent = parentScopes[0];
|
2598
|
-
|
2599
|
-
if (isObject(firstParent) && !(prop in firstParent)) {
|
2600
|
-
set.add(firstParent[prop] = {});
|
2601
|
-
}
|
2602
|
-
|
2603
2625
|
set.add(value);
|
2604
2626
|
var key = addScopesFromKey(set, allScopes, prop, fallback || prop);
|
2605
2627
|
|
@@ -2615,7 +2637,15 @@
|
|
2615
2637
|
}
|
2616
2638
|
}
|
2617
2639
|
|
2618
|
-
return _createResolver(_toConsumableArray(set), [''], rootScopes, fallback)
|
2640
|
+
return _createResolver(_toConsumableArray(set), [''], rootScopes, fallback, function () {
|
2641
|
+
var parent = resolver._getTarget();
|
2642
|
+
|
2643
|
+
if (!(prop in parent)) {
|
2644
|
+
parent[prop] = {};
|
2645
|
+
}
|
2646
|
+
|
2647
|
+
return parent[prop];
|
2648
|
+
});
|
2619
2649
|
}
|
2620
2650
|
|
2621
2651
|
function addScopesFromKey(set, allScopes, key, fallback) {
|
@@ -3245,7 +3275,7 @@
|
|
3245
3275
|
|
3246
3276
|
return {
|
3247
3277
|
between: function between(n, s, e) {
|
3248
|
-
return n >= s && n <= e;
|
3278
|
+
return n >= Math.min(s, e) && n <= Math.max(e, s);
|
3249
3279
|
},
|
3250
3280
|
compare: function compare(a, b) {
|
3251
3281
|
return a - b;
|
@@ -3256,11 +3286,17 @@
|
|
3256
3286
|
};
|
3257
3287
|
}
|
3258
3288
|
|
3259
|
-
function
|
3289
|
+
function normalizeSegment(_ref) {
|
3290
|
+
var start = _ref.start,
|
3291
|
+
end = _ref.end,
|
3292
|
+
count = _ref.count,
|
3293
|
+
loop = _ref.loop,
|
3294
|
+
style = _ref.style;
|
3260
3295
|
return {
|
3261
3296
|
start: start % count,
|
3262
3297
|
end: end % count,
|
3263
|
-
loop: loop && (end - start + 1) % count === 0
|
3298
|
+
loop: loop && (end - start + 1) % count === 0,
|
3299
|
+
style: style
|
3264
3300
|
};
|
3265
3301
|
}
|
3266
3302
|
|
@@ -3303,7 +3339,8 @@
|
|
3303
3339
|
return {
|
3304
3340
|
start: start,
|
3305
3341
|
end: end,
|
3306
|
-
loop: loop
|
3342
|
+
loop: loop,
|
3343
|
+
style: segment.style
|
3307
3344
|
};
|
3308
3345
|
}
|
3309
3346
|
|
@@ -3325,7 +3362,8 @@
|
|
3325
3362
|
var _getSegment = getSegment(segment, points, bounds),
|
3326
3363
|
start = _getSegment.start,
|
3327
3364
|
end = _getSegment.end,
|
3328
|
-
loop = _getSegment.loop
|
3365
|
+
loop = _getSegment.loop,
|
3366
|
+
style = _getSegment.style;
|
3329
3367
|
|
3330
3368
|
var result = [];
|
3331
3369
|
var inside = false;
|
@@ -3363,7 +3401,13 @@
|
|
3363
3401
|
}
|
3364
3402
|
|
3365
3403
|
if (subStart !== null && shouldStop()) {
|
3366
|
-
result.push(
|
3404
|
+
result.push(normalizeSegment({
|
3405
|
+
start: subStart,
|
3406
|
+
end: i,
|
3407
|
+
loop: loop,
|
3408
|
+
count: count,
|
3409
|
+
style: style
|
3410
|
+
}));
|
3367
3411
|
subStart = null;
|
3368
3412
|
}
|
3369
3413
|
|
@@ -3372,7 +3416,13 @@
|
|
3372
3416
|
}
|
3373
3417
|
|
3374
3418
|
if (subStart !== null) {
|
3375
|
-
result.push(
|
3419
|
+
result.push(normalizeSegment({
|
3420
|
+
start: subStart,
|
3421
|
+
end: end,
|
3422
|
+
loop: loop,
|
3423
|
+
count: count,
|
3424
|
+
style: style
|
3425
|
+
}));
|
3376
3426
|
}
|
3377
3427
|
|
3378
3428
|
return result;
|
@@ -3466,7 +3516,7 @@
|
|
3466
3516
|
return result;
|
3467
3517
|
}
|
3468
3518
|
|
3469
|
-
function _computeSegments(line) {
|
3519
|
+
function _computeSegments(line, segmentOptions) {
|
3470
3520
|
var points = line.points;
|
3471
3521
|
var spanGaps = line.options.spanGaps;
|
3472
3522
|
var count = points.length;
|
@@ -3482,16 +3532,98 @@
|
|
3482
3532
|
end = _findStartAndEnd.end;
|
3483
3533
|
|
3484
3534
|
if (spanGaps === true) {
|
3485
|
-
return [{
|
3535
|
+
return splitByStyles([{
|
3486
3536
|
start: start,
|
3487
3537
|
end: end,
|
3488
3538
|
loop: loop
|
3489
|
-
}];
|
3539
|
+
}], points, segmentOptions);
|
3490
3540
|
}
|
3491
3541
|
|
3492
3542
|
var max = end < start ? end + count : end;
|
3493
3543
|
var completeLoop = !!line._fullLoop && start === 0 && end === count - 1;
|
3494
|
-
return solidSegments(points, start, max, completeLoop);
|
3544
|
+
return splitByStyles(solidSegments(points, start, max, completeLoop), points, segmentOptions);
|
3545
|
+
}
|
3546
|
+
|
3547
|
+
function splitByStyles(segments, points, segmentOptions) {
|
3548
|
+
if (!segmentOptions || !segmentOptions.setContext || !points) {
|
3549
|
+
return segments;
|
3550
|
+
}
|
3551
|
+
|
3552
|
+
return doSplitByStyles(segments, points, segmentOptions);
|
3553
|
+
}
|
3554
|
+
|
3555
|
+
function doSplitByStyles(segments, points, segmentOptions) {
|
3556
|
+
var count = points.length;
|
3557
|
+
var result = [];
|
3558
|
+
var start = segments[0].start;
|
3559
|
+
var i = start;
|
3560
|
+
|
3561
|
+
var _iterator8 = _createForOfIteratorHelper(segments),
|
3562
|
+
_step8;
|
3563
|
+
|
3564
|
+
try {
|
3565
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
3566
|
+
var segment = _step8.value;
|
3567
|
+
var prevStyle = void 0,
|
3568
|
+
style = void 0;
|
3569
|
+
var prev = points[start % count];
|
3570
|
+
|
3571
|
+
for (i = start + 1; i <= segment.end; i++) {
|
3572
|
+
var pt = points[i % count];
|
3573
|
+
style = readStyle(segmentOptions.setContext({
|
3574
|
+
type: 'segment',
|
3575
|
+
p0: prev,
|
3576
|
+
p1: pt
|
3577
|
+
}));
|
3578
|
+
|
3579
|
+
if (styleChanged(style, prevStyle)) {
|
3580
|
+
result.push({
|
3581
|
+
start: start,
|
3582
|
+
end: i - 1,
|
3583
|
+
loop: segment.loop,
|
3584
|
+
style: prevStyle
|
3585
|
+
});
|
3586
|
+
prevStyle = style;
|
3587
|
+
start = i - 1;
|
3588
|
+
}
|
3589
|
+
|
3590
|
+
prev = pt;
|
3591
|
+
prevStyle = style;
|
3592
|
+
}
|
3593
|
+
|
3594
|
+
if (start < i - 1) {
|
3595
|
+
result.push({
|
3596
|
+
start: start,
|
3597
|
+
end: i - 1,
|
3598
|
+
loop: segment.loop,
|
3599
|
+
style: style
|
3600
|
+
});
|
3601
|
+
start = i - 1;
|
3602
|
+
}
|
3603
|
+
}
|
3604
|
+
} catch (err) {
|
3605
|
+
_iterator8.e(err);
|
3606
|
+
} finally {
|
3607
|
+
_iterator8.f();
|
3608
|
+
}
|
3609
|
+
|
3610
|
+
return result;
|
3611
|
+
}
|
3612
|
+
|
3613
|
+
function readStyle(options) {
|
3614
|
+
return {
|
3615
|
+
backgroundColor: options.backgroundColor,
|
3616
|
+
borderCapStyle: options.borderCapStyle,
|
3617
|
+
borderDash: options.borderDash,
|
3618
|
+
borderDashOffset: options.borderDashOffset,
|
3619
|
+
borderJoinStyle: options.borderJoinStyle,
|
3620
|
+
borderWidth: options.borderWidth,
|
3621
|
+
borderColor: options.borderColor
|
3622
|
+
};
|
3623
|
+
}
|
3624
|
+
|
3625
|
+
function styleChanged(style, prevStyle) {
|
3626
|
+
return prevStyle && JSON.stringify(style) !== JSON.stringify(prevStyle);
|
3495
3627
|
}
|
3496
3628
|
|
3497
3629
|
var Animator = /*#__PURE__*/function () {
|
@@ -4178,7 +4310,7 @@
|
|
4178
4310
|
}
|
4179
4311
|
|
4180
4312
|
function getStackKey(indexScale, valueScale, meta) {
|
4181
|
-
return indexScale.id
|
4313
|
+
return "".concat(indexScale.id, ".").concat(valueScale.id, ".").concat(meta.stack || meta.type);
|
4182
4314
|
}
|
4183
4315
|
|
4184
4316
|
function getUserBounds(scale) {
|
@@ -5272,7 +5404,8 @@
|
|
5272
5404
|
me.updateSharedOptions(sharedOptions, mode, firstOpts);
|
5273
5405
|
|
5274
5406
|
for (var i = start; i < start + count; i++) {
|
5275
|
-
var
|
5407
|
+
var parsed = me.getParsed(i);
|
5408
|
+
var vpixels = reset || isNullOrUndef(parsed[vScale.axis]) ? {
|
5276
5409
|
base: base,
|
5277
5410
|
head: base
|
5278
5411
|
} : me._calculateBarValuePixels(i);
|
@@ -6158,20 +6291,17 @@
|
|
6158
6291
|
|
6159
6292
|
line._decimated = !!_dataset._decimated;
|
6160
6293
|
line.points = points;
|
6294
|
+
var options = me.resolveDatasetElementOptions(mode);
|
6161
6295
|
|
6162
|
-
if (
|
6163
|
-
|
6164
|
-
|
6165
|
-
if (!me.options.showLine) {
|
6166
|
-
options.borderWidth = 0;
|
6167
|
-
}
|
6168
|
-
|
6169
|
-
me.updateElement(line, undefined, {
|
6170
|
-
animated: !animationsDisabled,
|
6171
|
-
options: options
|
6172
|
-
}, mode);
|
6296
|
+
if (!me.options.showLine) {
|
6297
|
+
options.borderWidth = 0;
|
6173
6298
|
}
|
6174
6299
|
|
6300
|
+
options.segment = me.options.segment;
|
6301
|
+
me.updateElement(line, undefined, {
|
6302
|
+
animated: !animationsDisabled,
|
6303
|
+
options: options
|
6304
|
+
}, mode);
|
6175
6305
|
me.updateElements(points, start, count, mode);
|
6176
6306
|
}
|
6177
6307
|
}, {
|
@@ -6195,10 +6325,12 @@
|
|
6195
6325
|
var point = points[i];
|
6196
6326
|
var parsed = me.getParsed(i);
|
6197
6327
|
var properties = directUpdate ? point : {};
|
6328
|
+
var nullData = isNullOrUndef(parsed.y);
|
6198
6329
|
var x = properties.x = xScale.getPixelForValue(parsed.x, i);
|
6199
|
-
var y = properties.y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(_stacked ? me.applyStack(yScale, parsed, _stacked) : parsed.y, i);
|
6200
|
-
properties.skip = isNaN(x) || isNaN(y);
|
6330
|
+
var y = properties.y = reset || nullData ? yScale.getBasePixel() : yScale.getPixelForValue(_stacked ? me.applyStack(yScale, parsed, _stacked) : parsed.y, i);
|
6331
|
+
properties.skip = isNaN(x) || isNaN(y) || nullData;
|
6201
6332
|
properties.stop = i > 0 && parsed.x - prevParsed.x > maxGapLength;
|
6333
|
+
properties.parsed = parsed;
|
6202
6334
|
|
6203
6335
|
if (includeOptions) {
|
6204
6336
|
properties.options = sharedOptions || me.resolveDataElementOptions(i, mode);
|
@@ -7081,20 +7213,15 @@
|
|
7081
7213
|
var box = layout.box;
|
7082
7214
|
var maxPadding = chartArea.maxPadding;
|
7083
7215
|
|
7084
|
-
if (isObject(layout.pos)) {
|
7085
|
-
|
7086
|
-
|
7087
|
-
|
7088
|
-
};
|
7089
|
-
}
|
7216
|
+
if (!isObject(layout.pos)) {
|
7217
|
+
if (layout.size) {
|
7218
|
+
chartArea[layout.pos] -= layout.size;
|
7219
|
+
}
|
7090
7220
|
|
7091
|
-
|
7092
|
-
chartArea[layout.pos]
|
7221
|
+
layout.size = layout.horizontal ? box.height : box.width;
|
7222
|
+
chartArea[layout.pos] += layout.size;
|
7093
7223
|
}
|
7094
7224
|
|
7095
|
-
layout.size = layout.horizontal ? box.height : box.width;
|
7096
|
-
chartArea[layout.pos] += layout.size;
|
7097
|
-
|
7098
7225
|
if (box.getPadding) {
|
7099
7226
|
updateMaxPadding(maxPadding, box.getPadding());
|
7100
7227
|
}
|
@@ -7842,12 +7969,7 @@
|
|
7842
7969
|
offset: false,
|
7843
7970
|
borderDash: [],
|
7844
7971
|
borderDashOffset: 0.0,
|
7845
|
-
|
7846
|
-
return options.color;
|
7847
|
-
},
|
7848
|
-
borderWidth: function borderWidth(_ctx, options) {
|
7849
|
-
return options.lineWidth;
|
7850
|
-
}
|
7972
|
+
borderWidth: 1
|
7851
7973
|
},
|
7852
7974
|
title: {
|
7853
7975
|
display: false,
|
@@ -7877,6 +7999,7 @@
|
|
7877
7999
|
});
|
7878
8000
|
defaults.route('scale.ticks', 'color', '', 'color');
|
7879
8001
|
defaults.route('scale.grid', 'color', '', 'borderColor');
|
8002
|
+
defaults.route('scale.grid', 'borderColor', '', 'borderColor');
|
7880
8003
|
defaults.route('scale.title', 'color', '', 'color');
|
7881
8004
|
defaults.describe('scale', {
|
7882
8005
|
_fallback: false,
|
@@ -8223,7 +8346,7 @@
|
|
8223
8346
|
key: "init",
|
8224
8347
|
value: function init(options) {
|
8225
8348
|
var me = this;
|
8226
|
-
me.options = options;
|
8349
|
+
me.options = options.setContext(me.getContext());
|
8227
8350
|
me.axis = options.axis;
|
8228
8351
|
me._userMin = me.parse(options.min);
|
8229
8352
|
me._userMax = me.parse(options.max);
|
@@ -8589,7 +8712,7 @@
|
|
8589
8712
|
var sin = Math.sin(angleRadians);
|
8590
8713
|
|
8591
8714
|
if (isHorizontal) {
|
8592
|
-
var labelHeight = sin * widest.width + cos * highest.height;
|
8715
|
+
var labelHeight = tickOpts.mirror ? 0 : sin * widest.width + cos * highest.height;
|
8593
8716
|
minSize.height = Math.min(me.maxHeight, minSize.height + labelHeight + tickPadding);
|
8594
8717
|
} else {
|
8595
8718
|
var labelWidth = tickOpts.mirror ? 0 : cos * widest.width + sin * highest.height;
|
@@ -9012,27 +9135,29 @@
|
|
9012
9135
|
var ticks = me.ticks;
|
9013
9136
|
var align = optionTicks.align,
|
9014
9137
|
crossAlign = optionTicks.crossAlign,
|
9015
|
-
padding = optionTicks.padding
|
9138
|
+
padding = optionTicks.padding,
|
9139
|
+
mirror = optionTicks.mirror;
|
9016
9140
|
var tl = getTickMarkLength(options.grid);
|
9017
9141
|
var tickAndPadding = tl + padding;
|
9142
|
+
var hTickAndPadding = mirror ? -padding : tickAndPadding;
|
9018
9143
|
var rotation = -toRadians(me.labelRotation);
|
9019
9144
|
var items = [];
|
9020
9145
|
var i, ilen, tick, label, x, y, textAlign, pixel, font, lineHeight, lineCount, textOffset;
|
9021
9146
|
var textBaseline = 'middle';
|
9022
9147
|
|
9023
9148
|
if (position === 'top') {
|
9024
|
-
y = me.bottom -
|
9149
|
+
y = me.bottom - hTickAndPadding;
|
9025
9150
|
textAlign = me._getXAxisLabelAlignment();
|
9026
9151
|
} else if (position === 'bottom') {
|
9027
|
-
y = me.top +
|
9152
|
+
y = me.top + hTickAndPadding;
|
9028
9153
|
textAlign = me._getXAxisLabelAlignment();
|
9029
9154
|
} else if (position === 'left') {
|
9030
|
-
var ret =
|
9155
|
+
var ret = me._getYAxisLabelAlignment(tl);
|
9031
9156
|
|
9032
9157
|
textAlign = ret.textAlign;
|
9033
9158
|
x = ret.x;
|
9034
9159
|
} else if (position === 'right') {
|
9035
|
-
var _ret =
|
9160
|
+
var _ret = me._getYAxisLabelAlignment(tl);
|
9036
9161
|
|
9037
9162
|
textAlign = _ret.textAlign;
|
9038
9163
|
x = _ret.x;
|
@@ -9055,7 +9180,7 @@
|
|
9055
9180
|
x = me.chart.scales[_positionAxisID2].getPixelForValue(_value2);
|
9056
9181
|
}
|
9057
9182
|
|
9058
|
-
textAlign =
|
9183
|
+
textAlign = me._getYAxisLabelAlignment(tl).textAlign;
|
9059
9184
|
}
|
9060
9185
|
|
9061
9186
|
if (axis === 'y') {
|
@@ -9101,6 +9226,10 @@
|
|
9101
9226
|
textOffset = labelSizes.highest.height - lineCount * lineHeight;
|
9102
9227
|
}
|
9103
9228
|
}
|
9229
|
+
|
9230
|
+
if (mirror) {
|
9231
|
+
textOffset *= -1;
|
9232
|
+
}
|
9104
9233
|
} else {
|
9105
9234
|
y = pixel;
|
9106
9235
|
textOffset = (1 - lineCount) * lineHeight / 2;
|
@@ -9166,7 +9295,7 @@
|
|
9166
9295
|
if (position === 'left') {
|
9167
9296
|
if (mirror) {
|
9168
9297
|
textAlign = 'left';
|
9169
|
-
x = me.right
|
9298
|
+
x = me.right + padding;
|
9170
9299
|
} else {
|
9171
9300
|
x = me.right - tickAndPadding;
|
9172
9301
|
|
@@ -9282,7 +9411,7 @@
|
|
9282
9411
|
var grid = me.options.grid;
|
9283
9412
|
var ctx = me.ctx;
|
9284
9413
|
var chart = me.chart;
|
9285
|
-
var borderOpts = grid.setContext(me.getContext(
|
9414
|
+
var borderOpts = grid.setContext(me.getContext());
|
9286
9415
|
var axisWidth = grid.drawBorder ? borderOpts.borderWidth : 0;
|
9287
9416
|
|
9288
9417
|
var items = me._gridLineItems || (me._gridLineItems = me._computeGridLineItems(chartArea));
|
@@ -9338,8 +9467,7 @@
|
|
9338
9467
|
}
|
9339
9468
|
|
9340
9469
|
if (axisWidth) {
|
9341
|
-
var
|
9342
|
-
var lastLineWidth = edgeOpts.lineWidth;
|
9470
|
+
var lastLineWidth = borderOpts.lineWidth;
|
9343
9471
|
var borderValue = me._borderValue;
|
9344
9472
|
var x1, x2, y1, y2;
|
9345
9473
|
|
@@ -9361,7 +9489,7 @@
|
|
9361
9489
|
y: y2
|
9362
9490
|
}, {
|
9363
9491
|
width: axisWidth,
|
9364
|
-
color:
|
9492
|
+
color: borderOpts.borderColor
|
9365
9493
|
});
|
9366
9494
|
}
|
9367
9495
|
}
|
@@ -9811,7 +9939,7 @@
|
|
9811
9939
|
|
9812
9940
|
_createClass(PluginService, [{
|
9813
9941
|
key: "notify",
|
9814
|
-
value: function notify(chart, hook, args) {
|
9942
|
+
value: function notify(chart, hook, args, filter) {
|
9815
9943
|
var me = this;
|
9816
9944
|
|
9817
9945
|
if (hook === 'beforeInit') {
|
@@ -9820,7 +9948,7 @@
|
|
9820
9948
|
me._notify(me._init, chart, 'install');
|
9821
9949
|
}
|
9822
9950
|
|
9823
|
-
var descriptors = me._descriptors(chart);
|
9951
|
+
var descriptors = filter ? me._descriptors(chart).filter(filter) : me._descriptors(chart);
|
9824
9952
|
|
9825
9953
|
var result = me._notify(descriptors, chart, hook, args);
|
9826
9954
|
|
@@ -10351,7 +10479,7 @@
|
|
10351
10479
|
return false;
|
10352
10480
|
}
|
10353
10481
|
|
10354
|
-
var version = "3.0
|
10482
|
+
var version = "3.1.0";
|
10355
10483
|
var KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
|
10356
10484
|
|
10357
10485
|
function positionIsHorizontal(position, axis) {
|
@@ -11340,8 +11468,8 @@
|
|
11340
11468
|
}
|
11341
11469
|
}, {
|
11342
11470
|
key: "notifyPlugins",
|
11343
|
-
value: function notifyPlugins(hook, args) {
|
11344
|
-
return this._plugins.notify(this, hook, args);
|
11471
|
+
value: function notifyPlugins(hook, args, filter) {
|
11472
|
+
return this._plugins.notify(this, hook, args, filter);
|
11345
11473
|
}
|
11346
11474
|
}, {
|
11347
11475
|
key: "_updateHoverStyles",
|
@@ -11371,6 +11499,8 @@
|
|
11371
11499
|
}, {
|
11372
11500
|
key: "_eventHandler",
|
11373
11501
|
value: function _eventHandler(e, replay) {
|
11502
|
+
var _this6 = this;
|
11503
|
+
|
11374
11504
|
var me = this;
|
11375
11505
|
var args = {
|
11376
11506
|
event: e,
|
@@ -11378,14 +11508,18 @@
|
|
11378
11508
|
cancelable: true
|
11379
11509
|
};
|
11380
11510
|
|
11381
|
-
|
11511
|
+
var eventFilter = function eventFilter(plugin) {
|
11512
|
+
return (plugin.options.events || _this6.options.events).includes(e.type);
|
11513
|
+
};
|
11514
|
+
|
11515
|
+
if (me.notifyPlugins('beforeEvent', args, eventFilter) === false) {
|
11382
11516
|
return;
|
11383
11517
|
}
|
11384
11518
|
|
11385
11519
|
var changed = me._handleEvent(e, replay);
|
11386
11520
|
|
11387
11521
|
args.cancelable = false;
|
11388
|
-
me.notifyPlugins('afterEvent', args);
|
11522
|
+
me.notifyPlugins('afterEvent', args, eventFilter);
|
11389
11523
|
|
11390
11524
|
if (changed || args.changed) {
|
11391
11525
|
me.render();
|
@@ -11412,10 +11546,11 @@
|
|
11412
11546
|
}
|
11413
11547
|
|
11414
11548
|
me._lastEvent = null;
|
11415
|
-
callback(options.onHover, [e, active, me], me);
|
11416
11549
|
|
11417
|
-
if (e
|
11418
|
-
|
11550
|
+
if (_isPointInArea(e, me.chartArea, me._minPadding)) {
|
11551
|
+
callback(options.onHover, [e, active, me], me);
|
11552
|
+
|
11553
|
+
if (e.type === 'mouseup' || e.type === 'click' || e.type === 'contextmenu') {
|
11419
11554
|
callback(options.onClick, [e, active, me], me);
|
11420
11555
|
}
|
11421
11556
|
}
|
@@ -11507,6 +11642,35 @@
|
|
11507
11642
|
ctx.clip();
|
11508
11643
|
}
|
11509
11644
|
|
11645
|
+
function toRadiusCorners(value) {
|
11646
|
+
return _readValueToProps(value, ['outerStart', 'outerEnd', 'innerStart', 'innerEnd']);
|
11647
|
+
}
|
11648
|
+
|
11649
|
+
function parseBorderRadius$1(arc, innerRadius, outerRadius, angleDelta) {
|
11650
|
+
var o = toRadiusCorners(arc.options.borderRadius);
|
11651
|
+
var halfThickness = (outerRadius - innerRadius) / 2;
|
11652
|
+
var innerLimit = Math.min(halfThickness, angleDelta * innerRadius / 2);
|
11653
|
+
|
11654
|
+
var computeOuterLimit = function computeOuterLimit(val) {
|
11655
|
+
var outerArcLimit = (outerRadius - Math.min(halfThickness, val)) * angleDelta / 2;
|
11656
|
+
return _limitValue(val, 0, Math.min(halfThickness, outerArcLimit));
|
11657
|
+
};
|
11658
|
+
|
11659
|
+
return {
|
11660
|
+
outerStart: computeOuterLimit(o.outerStart),
|
11661
|
+
outerEnd: computeOuterLimit(o.outerEnd),
|
11662
|
+
innerStart: _limitValue(o.innerStart, 0, innerLimit),
|
11663
|
+
innerEnd: _limitValue(o.innerEnd, 0, innerLimit)
|
11664
|
+
};
|
11665
|
+
}
|
11666
|
+
|
11667
|
+
function rThetaToXY(r, theta, x, y) {
|
11668
|
+
return {
|
11669
|
+
x: x + r * Math.cos(theta),
|
11670
|
+
y: y + r * Math.sin(theta)
|
11671
|
+
};
|
11672
|
+
}
|
11673
|
+
|
11510
11674
|
function pathArc(ctx, element) {
|
11511
11675
|
var x = element.x,
|
11512
11676
|
y = element.y,
|
@@ -11515,9 +11679,55 @@
|
|
11515
11679
|
pixelMargin = element.pixelMargin;
|
11516
11680
|
var outerRadius = Math.max(element.outerRadius - pixelMargin, 0);
|
11517
11681
|
var innerRadius = element.innerRadius + pixelMargin;
|
11682
|
+
|
11683
|
+
var _parseBorderRadius$ = parseBorderRadius$1(element, innerRadius, outerRadius, endAngle - startAngle),
|
11684
|
+
outerStart = _parseBorderRadius$.outerStart,
|
11685
|
+
outerEnd = _parseBorderRadius$.outerEnd,
|
11686
|
+
innerStart = _parseBorderRadius$.innerStart,
|
11687
|
+
innerEnd = _parseBorderRadius$.innerEnd;
|
11688
|
+
|
11689
|
+
var outerStartAdjustedRadius = outerRadius - outerStart;
|
11690
|
+
var outerEndAdjustedRadius = outerRadius - outerEnd;
|
11691
|
+
var outerStartAdjustedAngle = startAngle + outerStart / outerStartAdjustedRadius;
|
11692
|
+
var outerEndAdjustedAngle = endAngle - outerEnd / outerEndAdjustedRadius;
|
11693
|
+
var innerStartAdjustedRadius = innerRadius + innerStart;
|
11694
|
+
var innerEndAdjustedRadius = innerRadius + innerEnd;
|
11695
|
+
var innerStartAdjustedAngle = startAngle + innerStart / innerStartAdjustedRadius;
|
11696
|
+
var innerEndAdjustedAngle = endAngle - innerEnd / innerEndAdjustedRadius;
|
11518
11697
|
ctx.beginPath();
|
11519
|
-
ctx.arc(x, y, outerRadius,
|
11520
|
-
|
11698
|
+
ctx.arc(x, y, outerRadius, outerStartAdjustedAngle, outerEndAdjustedAngle);
|
11699
|
+
|
11700
|
+
if (outerEnd > 0) {
|
11701
|
+
var pCenter = rThetaToXY(outerEndAdjustedRadius, outerEndAdjustedAngle, x, y);
|
11702
|
+
ctx.arc(pCenter.x, pCenter.y, outerEnd, outerEndAdjustedAngle, endAngle + HALF_PI);
|
11703
|
+
}
|
11704
|
+
|
11705
|
+
var p4 = rThetaToXY(innerEndAdjustedRadius, endAngle, x, y);
|
11706
|
+
ctx.lineTo(p4.x, p4.y);
|
11707
|
+
|
11708
|
+
if (innerEnd > 0) {
|
11709
|
+
var _pCenter = rThetaToXY(innerEndAdjustedRadius, innerEndAdjustedAngle, x, y);
|
11710
|
+
|
11711
|
+
ctx.arc(_pCenter.x, _pCenter.y, innerEnd, endAngle + HALF_PI, innerEndAdjustedAngle + Math.PI);
|
11712
|
+
}
|
11713
|
+
|
11714
|
+
ctx.arc(x, y, innerRadius, endAngle - innerEnd / innerRadius, startAngle + innerStart / innerRadius, true);
|
11715
|
+
|
11716
|
+
if (innerStart > 0) {
|
11717
|
+
var _pCenter2 = rThetaToXY(innerStartAdjustedRadius, innerStartAdjustedAngle, x, y);
|
11718
|
+
|
11719
|
+
ctx.arc(_pCenter2.x, _pCenter2.y, innerStart, innerStartAdjustedAngle + Math.PI, startAngle - HALF_PI);
|
11720
|
+
}
|
11721
|
+
|
11722
|
+
var p8 = rThetaToXY(outerStartAdjustedRadius, startAngle, x, y);
|
11723
|
+
ctx.lineTo(p8.x, p8.y);
|
11724
|
+
|
11725
|
+
if (outerStart > 0) {
|
11726
|
+
var _pCenter3 = rThetaToXY(outerStartAdjustedRadius, outerStartAdjustedAngle, x, y);
|
11727
|
+
|
11728
|
+
ctx.arc(_pCenter3.x, _pCenter3.y, outerStart, startAngle - HALF_PI, outerStartAdjustedAngle);
|
11729
|
+
}
|
11730
|
+
|
11521
11731
|
ctx.closePath();
|
11522
11732
|
}
|
11523
11733
|
|
@@ -11576,14 +11786,7 @@
|
|
11576
11786
|
}
|
11577
11787
|
|
11578
11788
|
function drawBorder(ctx, element) {
|
11579
|
-
var
|
11580
|
-
y = element.y,
|
11581
|
-
startAngle = element.startAngle,
|
11582
|
-
endAngle = element.endAngle,
|
11583
|
-
pixelMargin = element.pixelMargin,
|
11584
|
-
options = element.options;
|
11585
|
-
var outerRadius = element.outerRadius;
|
11586
|
-
var innerRadius = element.innerRadius + pixelMargin;
|
11789
|
+
var options = element.options;
|
11587
11790
|
var inner = options.borderAlign === 'inner';
|
11588
11791
|
|
11589
11792
|
if (!options.borderWidth) {
|
@@ -11606,10 +11809,7 @@
|
|
11606
11809
|
clipArc(ctx, element);
|
11607
11810
|
}
|
11608
11811
|
|
11609
|
-
ctx
|
11610
|
-
ctx.arc(x, y, outerRadius, startAngle, endAngle);
|
11611
|
-
ctx.arc(x, y, innerRadius, endAngle, startAngle, true);
|
11612
|
-
ctx.closePath();
|
11812
|
+
pathArc(ctx, element);
|
11613
11813
|
ctx.stroke();
|
11614
11814
|
}
|
11615
11815
|
|
@@ -11619,25 +11819,25 @@
|
|
11619
11819
|
var _super12 = _createSuper(ArcElement);
|
11620
11820
|
|
11621
11821
|
function ArcElement(cfg) {
|
11622
|
-
var
|
11822
|
+
var _this7;
|
11623
11823
|
|
11624
11824
|
_classCallCheck(this, ArcElement);
|
11625
11825
|
|
11626
|
-
|
11627
|
-
|
11628
|
-
|
11629
|
-
|
11630
|
-
|
11631
|
-
|
11632
|
-
|
11633
|
-
|
11634
|
-
|
11826
|
+
_this7 = _super12.call(this);
|
11827
|
+
_this7.options = undefined;
|
11828
|
+
_this7.circumference = undefined;
|
11829
|
+
_this7.startAngle = undefined;
|
11830
|
+
_this7.endAngle = undefined;
|
11831
|
+
_this7.innerRadius = undefined;
|
11832
|
+
_this7.outerRadius = undefined;
|
11833
|
+
_this7.pixelMargin = 0;
|
11834
|
+
_this7.fullCircles = 0;
|
11635
11835
|
|
11636
11836
|
if (cfg) {
|
11637
|
-
Object.assign(_assertThisInitialized(
|
11837
|
+
Object.assign(_assertThisInitialized(_this7), cfg);
|
11638
11838
|
}
|
11639
11839
|
|
11640
|
-
return
|
11840
|
+
return _this7;
|
11641
11841
|
}
|
11642
11842
|
|
11643
11843
|
_createClass(ArcElement, [{
|
@@ -11722,6 +11922,7 @@
|
|
11722
11922
|
ArcElement.defaults = {
|
11723
11923
|
borderAlign: 'center',
|
11724
11924
|
borderColor: '#fff',
|
11925
|
+
borderRadius: 0,
|
11725
11926
|
borderWidth: 2,
|
11726
11927
|
offset: 0,
|
11727
11928
|
angle: undefined
|
@@ -11730,13 +11931,14 @@
|
|
11730
11931
|
backgroundColor: 'backgroundColor'
|
11731
11932
|
};
|
11732
11933
|
|
11733
|
-
function setStyle(ctx,
|
11734
|
-
|
11735
|
-
ctx.
|
11736
|
-
ctx.
|
11737
|
-
ctx.
|
11738
|
-
ctx.
|
11739
|
-
ctx.
|
11934
|
+
function setStyle(ctx, options) {
|
11935
|
+
var style = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : options;
|
11936
|
+
ctx.lineCap = valueOrDefault(style.borderCapStyle, options.borderCapStyle);
|
11937
|
+
ctx.setLineDash(valueOrDefault(style.borderDash, options.borderDash));
|
11938
|
+
ctx.lineDashOffset = valueOrDefault(style.borderDashOffset, options.borderDashOffset);
|
11939
|
+
ctx.lineJoin = valueOrDefault(style.borderJoinStyle, options.borderJoinStyle);
|
11940
|
+
ctx.lineWidth = valueOrDefault(style.borderWidth, options.borderWidth);
|
11941
|
+
ctx.strokeStyle = valueOrDefault(style.borderColor, options.borderColor);
|
11740
11942
|
}
|
11741
11943
|
|
11742
11944
|
function lineTo(ctx, previous, target) {
|
@@ -11907,21 +12109,50 @@
|
|
11907
12109
|
}
|
11908
12110
|
}
|
11909
12111
|
|
12112
|
+
setStyle(ctx, line.options);
|
11910
12113
|
ctx.stroke(path);
|
11911
12114
|
}
|
11912
12115
|
|
11913
12116
|
function strokePathDirect(ctx, line, start, count) {
|
11914
|
-
|
12117
|
+
var segments = line.segments,
|
12118
|
+
options = line.options;
|
11915
12119
|
|
11916
|
-
|
11917
|
-
ctx.closePath();
|
11918
|
-
}
|
12120
|
+
var segmentMethod = _getSegmentMethod(line);
|
11919
12121
|
|
11920
|
-
|
12122
|
+
var _iterator6 = _createForOfIteratorHelper(segments),
|
12123
|
+
_step6;
|
12124
|
+
|
12125
|
+
try {
|
12126
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
12127
|
+
var segment = _step6.value;
|
12128
|
+
setStyle(ctx, options, segment.style);
|
12129
|
+
ctx.beginPath();
|
12130
|
+
|
12131
|
+
if (segmentMethod(ctx, line, segment, {
|
12132
|
+
start: start,
|
12133
|
+
end: start + count - 1
|
12134
|
+
})) {
|
12135
|
+
ctx.closePath();
|
12136
|
+
}
|
12137
|
+
|
12138
|
+
ctx.stroke();
|
12139
|
+
}
|
12140
|
+
} catch (err) {
|
12141
|
+
_iterator6.e(err);
|
12142
|
+
} finally {
|
12143
|
+
_iterator6.f();
|
12144
|
+
}
|
11921
12145
|
}
|
11922
12146
|
|
11923
12147
|
var usePath2D = typeof Path2D === 'function';
|
11924
|
-
|
12148
|
+
|
12149
|
+
function _draw(ctx, line, start, count) {
|
12150
|
+
if (usePath2D && line.segments.length === 1) {
|
12151
|
+
strokePathWithCache(ctx, line, start, count);
|
12152
|
+
} else {
|
12153
|
+
strokePathDirect(ctx, line, start, count);
|
12154
|
+
}
|
12155
|
+
}
|
11925
12156
|
|
11926
12157
|
var LineElement = /*#__PURE__*/function (_Element3) {
|
11927
12158
|
_inherits(LineElement, _Element3);
|
@@ -11929,26 +12160,26 @@
|
|
11929
12160
|
var _super13 = _createSuper(LineElement);
|
11930
12161
|
|
11931
12162
|
function LineElement(cfg) {
|
11932
|
-
var
|
12163
|
+
var _this8;
|
11933
12164
|
|
11934
12165
|
_classCallCheck(this, LineElement);
|
11935
12166
|
|
11936
|
-
|
11937
|
-
|
11938
|
-
|
11939
|
-
|
11940
|
-
|
11941
|
-
|
11942
|
-
|
11943
|
-
|
11944
|
-
|
11945
|
-
|
12167
|
+
_this8 = _super13.call(this);
|
12168
|
+
_this8.animated = true;
|
12169
|
+
_this8.options = undefined;
|
12170
|
+
_this8._loop = undefined;
|
12171
|
+
_this8._fullLoop = undefined;
|
12172
|
+
_this8._path = undefined;
|
12173
|
+
_this8._points = undefined;
|
12174
|
+
_this8._segments = undefined;
|
12175
|
+
_this8._decimated = false;
|
12176
|
+
_this8._pointsUpdated = false;
|
11946
12177
|
|
11947
12178
|
if (cfg) {
|
11948
|
-
Object.assign(_assertThisInitialized(
|
12179
|
+
Object.assign(_assertThisInitialized(_this8), cfg);
|
11949
12180
|
}
|
11950
12181
|
|
11951
|
-
return
|
12182
|
+
return _this8;
|
11952
12183
|
}
|
11953
12184
|
|
11954
12185
|
_createClass(LineElement, [{
|
@@ -11980,7 +12211,7 @@
|
|
11980
12211
|
}, {
|
11981
12212
|
key: "segments",
|
11982
12213
|
get: function get() {
|
11983
|
-
return this._segments || (this._segments = _computeSegments(this));
|
12214
|
+
return this._segments || (this._segments = _computeSegments(this, this.options.segment));
|
11984
12215
|
}
|
11985
12216
|
}, {
|
11986
12217
|
key: "first",
|
@@ -12055,7 +12286,6 @@
|
|
12055
12286
|
value: function path(ctx, start, count) {
|
12056
12287
|
var me = this;
|
12057
12288
|
var segments = me.segments;
|
12058
|
-
var ilen = segments.length;
|
12059
12289
|
|
12060
12290
|
var segmentMethod = _getSegmentMethod(me);
|
12061
12291
|
|
@@ -12063,11 +12293,21 @@
|
|
12063
12293
|
start = start || 0;
|
12064
12294
|
count = count || me.points.length - start;
|
12065
12295
|
|
12066
|
-
|
12067
|
-
|
12068
|
-
|
12069
|
-
|
12070
|
-
|
12296
|
+
var _iterator7 = _createForOfIteratorHelper(segments),
|
12297
|
+
_step7;
|
12298
|
+
|
12299
|
+
try {
|
12300
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
12301
|
+
var segment = _step7.value;
|
12302
|
+
loop &= segmentMethod(ctx, me, segment, {
|
12303
|
+
start: start,
|
12304
|
+
end: start + count - 1
|
12305
|
+
});
|
12306
|
+
}
|
12307
|
+
} catch (err) {
|
12308
|
+
_iterator7.e(err);
|
12309
|
+
} finally {
|
12310
|
+
_iterator7.f();
|
12071
12311
|
}
|
12072
12312
|
|
12073
12313
|
return !!loop;
|
@@ -12084,8 +12324,9 @@
|
|
12084
12324
|
}
|
12085
12325
|
|
12086
12326
|
ctx.save();
|
12087
|
-
|
12088
|
-
|
12327
|
+
|
12328
|
+
_draw(ctx, me, start, count);
|
12329
|
+
|
12089
12330
|
ctx.restore();
|
12090
12331
|
|
12091
12332
|
if (me.animated) {
|
@@ -12138,20 +12379,21 @@
|
|
12138
12379
|
var _super14 = _createSuper(PointElement);
|
12139
12380
|
|
12140
12381
|
function PointElement(cfg) {
|
12141
|
-
var
|
12382
|
+
var _this9;
|
12142
12383
|
|
12143
12384
|
_classCallCheck(this, PointElement);
|
12144
12385
|
|
12145
|
-
|
12146
|
-
|
12147
|
-
|
12148
|
-
|
12386
|
+
_this9 = _super14.call(this);
|
12387
|
+
_this9.options = undefined;
|
12388
|
+
_this9.parsed = undefined;
|
12389
|
+
_this9.skip = undefined;
|
12390
|
+
_this9.stop = undefined;
|
12149
12391
|
|
12150
12392
|
if (cfg) {
|
12151
|
-
Object.assign(_assertThisInitialized(
|
12393
|
+
Object.assign(_assertThisInitialized(_this9), cfg);
|
12152
12394
|
}
|
12153
12395
|
|
12154
|
-
return
|
12396
|
+
return _this9;
|
12155
12397
|
}
|
12156
12398
|
|
12157
12399
|
_createClass(PointElement, [{
|
@@ -12371,22 +12613,6 @@
|
|
12371
12613
|
return radius.topLeft || radius.topRight || radius.bottomLeft || radius.bottomRight;
|
12372
12614
|
}
|
12373
12615
|
|
12374
|
-
function addRoundedRectPath(ctx, rect) {
|
12375
|
-
var x = rect.x,
|
12376
|
-
y = rect.y,
|
12377
|
-
w = rect.w,
|
12378
|
-
h = rect.h,
|
12379
|
-
radius = rect.radius;
|
12380
|
-
ctx.arc(x + radius.topLeft, y + radius.topLeft, radius.topLeft, -HALF_PI, PI, true);
|
12381
|
-
ctx.lineTo(x, y + h - radius.bottomLeft);
|
12382
|
-
ctx.arc(x + radius.bottomLeft, y + h - radius.bottomLeft, radius.bottomLeft, PI, HALF_PI, true);
|
12383
|
-
ctx.lineTo(x + w - radius.bottomRight, y + h);
|
12384
|
-
ctx.arc(x + w - radius.bottomRight, y + h - radius.bottomRight, radius.bottomRight, HALF_PI, 0, true);
|
12385
|
-
ctx.lineTo(x + w, y + radius.topRight);
|
12386
|
-
ctx.arc(x + w - radius.topRight, y + radius.topRight, radius.topRight, 0, -HALF_PI, true);
|
12387
|
-
ctx.lineTo(x + radius.topLeft, y);
|
12388
|
-
}
|
12389
|
-
|
12390
12616
|
function addNormalRectPath(ctx, rect) {
|
12391
12617
|
ctx.rect(rect.x, rect.y, rect.w, rect.h);
|
12392
12618
|
}
|
@@ -12397,22 +12623,22 @@
|
|
12397
12623
|
var _super15 = _createSuper(BarElement);
|
12398
12624
|
|
12399
12625
|
function BarElement(cfg) {
|
12400
|
-
var
|
12626
|
+
var _this10;
|
12401
12627
|
|
12402
12628
|
_classCallCheck(this, BarElement);
|
12403
12629
|
|
12404
|
-
|
12405
|
-
|
12406
|
-
|
12407
|
-
|
12408
|
-
|
12409
|
-
|
12630
|
+
_this10 = _super15.call(this);
|
12631
|
+
_this10.options = undefined;
|
12632
|
+
_this10.horizontal = undefined;
|
12633
|
+
_this10.base = undefined;
|
12634
|
+
_this10.width = undefined;
|
12635
|
+
_this10.height = undefined;
|
12410
12636
|
|
12411
12637
|
if (cfg) {
|
12412
|
-
Object.assign(_assertThisInitialized(
|
12638
|
+
Object.assign(_assertThisInitialized(_this10), cfg);
|
12413
12639
|
}
|
12414
12640
|
|
12415
|
-
return
|
12641
|
+
return _this10;
|
12416
12642
|
}
|
12417
12643
|
|
12418
12644
|
_createClass(BarElement, [{
|
@@ -12500,12 +12726,18 @@
|
|
12500
12726
|
BarElement: BarElement
|
12501
12727
|
});
|
12502
12728
|
|
12503
|
-
function lttbDecimation(data, availableWidth, options) {
|
12729
|
+
function lttbDecimation(data, start, count, availableWidth, options) {
|
12504
12730
|
var samples = options.samples || availableWidth;
|
12731
|
+
|
12732
|
+
if (samples >= count) {
|
12733
|
+
return data.slice(start, start + count);
|
12734
|
+
}
|
12735
|
+
|
12505
12736
|
var decimated = [];
|
12506
|
-
var bucketWidth = (
|
12737
|
+
var bucketWidth = (count - 2) / (samples - 2);
|
12507
12738
|
var sampledIndex = 0;
|
12508
|
-
var
|
12739
|
+
var endIndex = start + count - 1;
|
12740
|
+
var a = start;
|
12509
12741
|
var i, maxAreaPoint, maxArea, area, nextA;
|
12510
12742
|
decimated[sampledIndex++] = data[a];
|
12511
12743
|
|
@@ -12513,19 +12745,19 @@
|
|
12513
12745
|
var avgX = 0;
|
12514
12746
|
var avgY = 0;
|
12515
12747
|
var j = void 0;
|
12516
|
-
var avgRangeStart = Math.floor((i + 1) * bucketWidth) + 1;
|
12517
|
-
var avgRangeEnd = Math.min(Math.floor((i + 2) * bucketWidth) + 1,
|
12748
|
+
var avgRangeStart = Math.floor((i + 1) * bucketWidth) + 1 + start;
|
12749
|
+
var avgRangeEnd = Math.min(Math.floor((i + 2) * bucketWidth) + 1, count) + start;
|
12518
12750
|
var avgRangeLength = avgRangeEnd - avgRangeStart;
|
12519
12751
|
|
12520
12752
|
for (j = avgRangeStart; j < avgRangeEnd; j++) {
|
12521
|
-
avgX
|
12522
|
-
avgY
|
12753
|
+
avgX += data[j].x;
|
12754
|
+
avgY += data[j].y;
|
12523
12755
|
}
|
12524
12756
|
|
12525
12757
|
avgX /= avgRangeLength;
|
12526
12758
|
avgY /= avgRangeLength;
|
12527
|
-
var rangeOffs = Math.floor(i * bucketWidth) + 1;
|
12528
|
-
var rangeTo = Math.floor((i + 1) * bucketWidth) + 1;
|
12759
|
+
var rangeOffs = Math.floor(i * bucketWidth) + 1 + start;
|
12760
|
+
var rangeTo = Math.floor((i + 1) * bucketWidth) + 1 + start;
|
12529
12761
|
var _data$a = data[a],
|
12530
12762
|
pointAx = _data$a.x,
|
12531
12763
|
pointAy = _data$a.y;
|
@@ -12545,20 +12777,21 @@
|
|
12545
12777
|
a = nextA;
|
12546
12778
|
}
|
12547
12779
|
|
12548
|
-
decimated[sampledIndex++] = data[
|
12780
|
+
decimated[sampledIndex++] = data[endIndex];
|
12549
12781
|
return decimated;
|
12550
12782
|
}
|
12551
12783
|
|
12552
|
-
function minMaxDecimation(data, availableWidth) {
|
12784
|
+
function minMaxDecimation(data, start, count, availableWidth) {
|
12553
12785
|
var avgX = 0;
|
12554
12786
|
var countX = 0;
|
12555
12787
|
var i, point, x, y, prevX, minIndex, maxIndex, startIndex, minY, maxY;
|
12556
12788
|
var decimated = [];
|
12557
|
-
var
|
12558
|
-
var
|
12789
|
+
var endIndex = start + count - 1;
|
12790
|
+
var xMin = data[start].x;
|
12791
|
+
var xMax = data[endIndex].x;
|
12559
12792
|
var dx = xMax - xMin;
|
12560
12793
|
|
12561
|
-
for (i =
|
12794
|
+
for (i = start; i < start + count; ++i) {
|
12562
12795
|
point = data[i];
|
12563
12796
|
x = (point.x - xMin) / dx * availableWidth;
|
12564
12797
|
y = point.y;
|
@@ -12622,6 +12855,34 @@
|
|
12622
12855
|
});
|
12623
12856
|
}
|
12624
12857
|
|
12858
|
+
function getStartAndCountOfVisiblePointsSimplified(meta, points) {
|
12859
|
+
var pointCount = points.length;
|
12860
|
+
var start = 0;
|
12861
|
+
var count;
|
12862
|
+
var iScale = meta.iScale;
|
12863
|
+
|
12864
|
+
var _iScale$getUserBounds2 = iScale.getUserBounds(),
|
12865
|
+
min = _iScale$getUserBounds2.min,
|
12866
|
+
max = _iScale$getUserBounds2.max,
|
12867
|
+
minDefined = _iScale$getUserBounds2.minDefined,
|
12868
|
+
maxDefined = _iScale$getUserBounds2.maxDefined;
|
12869
|
+
|
12870
|
+
if (minDefined) {
|
12871
|
+
start = _limitValue(_lookupByKey(points, iScale.axis, min).lo, 0, pointCount - 1);
|
12872
|
+
}
|
12873
|
+
|
12874
|
+
if (maxDefined) {
|
12875
|
+
count = _limitValue(_lookupByKey(points, iScale.axis, max).hi + 1, start, pointCount) - start;
|
12876
|
+
} else {
|
12877
|
+
count = pointCount - start;
|
12878
|
+
}
|
12879
|
+
|
12880
|
+
return {
|
12881
|
+
start: start,
|
12882
|
+
count: count
|
12883
|
+
};
|
12884
|
+
}
|
12885
|
+
|
12625
12886
|
var plugin_decimation = {
|
12626
12887
|
id: 'decimation',
|
12627
12888
|
defaults: {
|
@@ -12659,7 +12920,11 @@
|
|
12659
12920
|
return;
|
12660
12921
|
}
|
12661
12922
|
|
12662
|
-
|
12923
|
+
var _getStartAndCountOfVi2 = getStartAndCountOfVisiblePointsSimplified(meta, data),
|
12924
|
+
start = _getStartAndCountOfVi2.start,
|
12925
|
+
count = _getStartAndCountOfVi2.count;
|
12926
|
+
|
12927
|
+
if (count <= 4 * availableWidth) {
|
12663
12928
|
return;
|
12664
12929
|
}
|
12665
12930
|
|
@@ -12682,11 +12947,11 @@
|
|
12682
12947
|
|
12683
12948
|
switch (options.algorithm) {
|
12684
12949
|
case 'lttb':
|
12685
|
-
decimated = lttbDecimation(data, availableWidth, options);
|
12950
|
+
decimated = lttbDecimation(data, start, count, availableWidth, options);
|
12686
12951
|
break;
|
12687
12952
|
|
12688
12953
|
case 'min-max':
|
12689
|
-
decimated = minMaxDecimation(data, availableWidth);
|
12954
|
+
decimated = minMaxDecimation(data, start, count, availableWidth);
|
12690
12955
|
break;
|
12691
12956
|
|
12692
12957
|
default:
|
@@ -13131,37 +13396,65 @@
|
|
13131
13396
|
var tpoints = target.points;
|
13132
13397
|
var parts = [];
|
13133
13398
|
|
13134
|
-
|
13135
|
-
|
13136
|
-
var bounds = getBounds(property, points[segment.start], points[segment.end], segment.loop);
|
13137
|
-
|
13138
|
-
if (!target.segments) {
|
13139
|
-
parts.push({
|
13140
|
-
source: segment,
|
13141
|
-
target: bounds,
|
13142
|
-
start: points[segment.start],
|
13143
|
-
end: points[segment.end]
|
13144
|
-
});
|
13145
|
-
continue;
|
13146
|
-
}
|
13147
|
-
|
13148
|
-
var subs = _boundSegments(target, bounds);
|
13149
|
-
|
13150
|
-
for (var j = 0; j < subs.length; ++j) {
|
13151
|
-
var sub = subs[j];
|
13152
|
-
var subBounds = getBounds(property, tpoints[sub.start], tpoints[sub.end], sub.loop);
|
13399
|
+
var _iterator8 = _createForOfIteratorHelper(segments),
|
13400
|
+
_step8;
|
13153
13401
|
|
13154
|
-
|
13402
|
+
try {
|
13403
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
13404
|
+
var segment = _step8.value;
|
13405
|
+
var bounds = getBounds(property, points[segment.start], points[segment.end], segment.loop);
|
13155
13406
|
|
13156
|
-
|
13407
|
+
if (!target.segments) {
|
13157
13408
|
parts.push({
|
13158
|
-
source:
|
13159
|
-
target:
|
13160
|
-
start:
|
13161
|
-
end:
|
13409
|
+
source: segment,
|
13410
|
+
target: bounds,
|
13411
|
+
start: points[segment.start],
|
13412
|
+
end: points[segment.end]
|
13162
13413
|
});
|
13414
|
+
continue;
|
13415
|
+
}
|
13416
|
+
|
13417
|
+
var targetSegments = _boundSegments(target, bounds);
|
13418
|
+
|
13419
|
+
var _iterator9 = _createForOfIteratorHelper(targetSegments),
|
13420
|
+
_step9;
|
13421
|
+
|
13422
|
+
try {
|
13423
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
13424
|
+
var tgt = _step9.value;
|
13425
|
+
var subBounds = getBounds(property, tpoints[tgt.start], tpoints[tgt.end], tgt.loop);
|
13426
|
+
|
13427
|
+
var fillSources = _boundSegment(segment, points, subBounds);
|
13428
|
+
|
13429
|
+
var _iterator10 = _createForOfIteratorHelper(fillSources),
|
13430
|
+
_step10;
|
13431
|
+
|
13432
|
+
try {
|
13433
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
13434
|
+
var fillSource = _step10.value;
|
13435
|
+
parts.push({
|
13436
|
+
source: fillSource,
|
13437
|
+
target: tgt,
|
13438
|
+
start: _defineProperty({}, property, _getEdge(bounds, subBounds, 'start', Math.max)),
|
13439
|
+
end: _defineProperty({}, property, _getEdge(bounds, subBounds, 'end', Math.min))
|
13440
|
+
});
|
13441
|
+
}
|
13442
|
+
} catch (err) {
|
13443
|
+
_iterator10.e(err);
|
13444
|
+
} finally {
|
13445
|
+
_iterator10.f();
|
13446
|
+
}
|
13447
|
+
}
|
13448
|
+
} catch (err) {
|
13449
|
+
_iterator9.e(err);
|
13450
|
+
} finally {
|
13451
|
+
_iterator9.f();
|
13163
13452
|
}
|
13164
13453
|
}
|
13454
|
+
} catch (err) {
|
13455
|
+
_iterator8.e(err);
|
13456
|
+
} finally {
|
13457
|
+
_iterator8.f();
|
13165
13458
|
}
|
13166
13459
|
|
13167
13460
|
return parts;
|
@@ -13201,38 +13494,50 @@
|
|
13201
13494
|
|
13202
13495
|
var segments = _segments(line, target, property);
|
13203
13496
|
|
13204
|
-
|
13497
|
+
var _iterator11 = _createForOfIteratorHelper(segments),
|
13498
|
+
_step11;
|
13205
13499
|
|
13206
|
-
|
13207
|
-
|
13208
|
-
|
13209
|
-
|
13210
|
-
|
13211
|
-
|
13212
|
-
|
13213
|
-
|
13214
|
-
|
13215
|
-
|
13500
|
+
try {
|
13501
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
13502
|
+
var _step11$value = _step11.value,
|
13503
|
+
src = _step11$value.source,
|
13504
|
+
tgt = _step11$value.target,
|
13505
|
+
start = _step11$value.start,
|
13506
|
+
end = _step11$value.end;
|
13507
|
+
var _src$style = src.style;
|
13508
|
+
_src$style = _src$style === void 0 ? {} : _src$style;
|
13509
|
+
var _src$style$background = _src$style.backgroundColor,
|
13510
|
+
backgroundColor = _src$style$background === void 0 ? color : _src$style$background;
|
13511
|
+
ctx.save();
|
13512
|
+
ctx.fillStyle = backgroundColor;
|
13513
|
+
clipBounds(ctx, scale, getBounds(property, start, end));
|
13514
|
+
ctx.beginPath();
|
13515
|
+
var lineLoop = !!line.pathSegment(ctx, src);
|
13216
13516
|
|
13217
|
-
|
13218
|
-
|
13219
|
-
|
13220
|
-
|
13221
|
-
|
13517
|
+
if (lineLoop) {
|
13518
|
+
ctx.closePath();
|
13519
|
+
} else {
|
13520
|
+
interpolatedLineTo(ctx, target, end, property);
|
13521
|
+
}
|
13222
13522
|
|
13223
|
-
|
13224
|
-
|
13225
|
-
|
13226
|
-
|
13227
|
-
|
13523
|
+
var targetLoop = !!target.pathSegment(ctx, tgt, {
|
13524
|
+
move: lineLoop,
|
13525
|
+
reverse: true
|
13526
|
+
});
|
13527
|
+
var loop = lineLoop && targetLoop;
|
13228
13528
|
|
13229
|
-
|
13230
|
-
|
13231
|
-
|
13529
|
+
if (!loop) {
|
13530
|
+
interpolatedLineTo(ctx, target, start, property);
|
13531
|
+
}
|
13232
13532
|
|
13233
|
-
|
13234
|
-
|
13235
|
-
|
13533
|
+
ctx.closePath();
|
13534
|
+
ctx.fill(loop ? 'evenodd' : 'nonzero');
|
13535
|
+
ctx.restore();
|
13536
|
+
}
|
13537
|
+
} catch (err) {
|
13538
|
+
_iterator11.e(err);
|
13539
|
+
} finally {
|
13540
|
+
_iterator11.f();
|
13236
13541
|
}
|
13237
13542
|
}
|
13238
13543
|
|
@@ -13274,11 +13579,38 @@
|
|
13274
13579
|
ctx.restore();
|
13275
13580
|
}
|
13276
13581
|
|
13582
|
+
function drawfill(ctx, source, area) {
|
13583
|
+
var target = getTarget(source);
|
13584
|
+
var line = source.line,
|
13585
|
+
scale = source.scale;
|
13586
|
+
var lineOpts = line.options;
|
13587
|
+
var fillOption = lineOpts.fill;
|
13588
|
+
var color = lineOpts.backgroundColor;
|
13589
|
+
|
13590
|
+
var _ref6 = fillOption || {},
|
13591
|
+
_ref6$above = _ref6.above,
|
13592
|
+
above = _ref6$above === void 0 ? color : _ref6$above,
|
13593
|
+
_ref6$below = _ref6.below,
|
13594
|
+
below = _ref6$below === void 0 ? color : _ref6$below;
|
13595
|
+
|
13596
|
+
if (target && line.points.length) {
|
13597
|
+
clipArea(ctx, area);
|
13598
|
+
doFill(ctx, {
|
13599
|
+
line: line,
|
13600
|
+
target: target,
|
13601
|
+
above: above,
|
13602
|
+
below: below,
|
13603
|
+
area: area,
|
13604
|
+
scale: scale
|
13605
|
+
});
|
13606
|
+
unclipArea(ctx);
|
13607
|
+
}
|
13608
|
+
}
|
13609
|
+
|
13277
13610
|
var plugin_filler = {
|
13278
13611
|
id: 'filler',
|
13279
13612
|
afterDatasetsUpdate: function afterDatasetsUpdate(chart, _args, options) {
|
13280
13613
|
var count = (chart.data.datasets || []).length;
|
13281
|
-
var propagate = options.propagate;
|
13282
13614
|
var sources = [];
|
13283
13615
|
var meta, i, line, source;
|
13284
13616
|
|
@@ -13309,59 +13641,37 @@
|
|
13309
13641
|
continue;
|
13310
13642
|
}
|
13311
13643
|
|
13312
|
-
source.fill = resolveTarget(sources, i, propagate);
|
13644
|
+
source.fill = resolveTarget(sources, i, options.propagate);
|
13313
13645
|
}
|
13314
13646
|
},
|
13315
|
-
beforeDatasetsDraw: function beforeDatasetsDraw(chart) {
|
13647
|
+
beforeDatasetsDraw: function beforeDatasetsDraw(chart, _args, options) {
|
13316
13648
|
var metasets = chart.getSortedVisibleDatasetMetas();
|
13317
13649
|
var area = chart.chartArea;
|
13318
|
-
var i, meta;
|
13319
13650
|
|
13320
|
-
for (i = metasets.length - 1; i >= 0; --i) {
|
13321
|
-
|
13651
|
+
for (var i = metasets.length - 1; i >= 0; --i) {
|
13652
|
+
var source = metasets[i].$filler;
|
13322
13653
|
|
13323
|
-
if (
|
13324
|
-
|
13654
|
+
if (source) {
|
13655
|
+
source.line.updateControlPoints(area);
|
13656
|
+
|
13657
|
+
if (options.drawTime === 'beforeDatasetsDraw') {
|
13658
|
+
drawfill(chart.ctx, source, area);
|
13659
|
+
}
|
13325
13660
|
}
|
13326
13661
|
}
|
13327
13662
|
},
|
13328
|
-
beforeDatasetDraw: function beforeDatasetDraw(chart, args) {
|
13329
|
-
var area = chart.chartArea;
|
13330
|
-
var ctx = chart.ctx;
|
13663
|
+
beforeDatasetDraw: function beforeDatasetDraw(chart, args, options) {
|
13331
13664
|
var source = args.meta.$filler;
|
13332
13665
|
|
13333
|
-
if (!source || source.fill === false) {
|
13666
|
+
if (!source || source.fill === false || options.drawTime !== 'beforeDatasetDraw') {
|
13334
13667
|
return;
|
13335
13668
|
}
|
13336
13669
|
|
13337
|
-
|
13338
|
-
var line = source.line,
|
13339
|
-
scale = source.scale;
|
13340
|
-
var lineOpts = line.options;
|
13341
|
-
var fillOption = lineOpts.fill;
|
13342
|
-
var color = lineOpts.backgroundColor;
|
13343
|
-
|
13344
|
-
var _ref6 = fillOption || {},
|
13345
|
-
_ref6$above = _ref6.above,
|
13346
|
-
above = _ref6$above === void 0 ? color : _ref6$above,
|
13347
|
-
_ref6$below = _ref6.below,
|
13348
|
-
below = _ref6$below === void 0 ? color : _ref6$below;
|
13349
|
-
|
13350
|
-
if (target && line.points.length) {
|
13351
|
-
clipArea(ctx, area);
|
13352
|
-
doFill(ctx, {
|
13353
|
-
line: line,
|
13354
|
-
target: target,
|
13355
|
-
above: above,
|
13356
|
-
below: below,
|
13357
|
-
area: area,
|
13358
|
-
scale: scale
|
13359
|
-
});
|
13360
|
-
unclipArea(ctx);
|
13361
|
-
}
|
13670
|
+
drawfill(chart.ctx, source, chart.chartArea);
|
13362
13671
|
},
|
13363
13672
|
defaults: {
|
13364
|
-
propagate: true
|
13673
|
+
propagate: true,
|
13674
|
+
drawTime: 'beforeDatasetDraw'
|
13365
13675
|
}
|
13366
13676
|
};
|
13367
13677
|
|
@@ -13393,34 +13703,34 @@
|
|
13393
13703
|
var _super16 = _createSuper(Legend);
|
13394
13704
|
|
13395
13705
|
function Legend(config) {
|
13396
|
-
var
|
13706
|
+
var _this11;
|
13397
13707
|
|
13398
13708
|
_classCallCheck(this, Legend);
|
13399
13709
|
|
13400
|
-
|
13401
|
-
|
13402
|
-
|
13403
|
-
|
13404
|
-
|
13405
|
-
|
13406
|
-
|
13407
|
-
|
13408
|
-
|
13409
|
-
|
13410
|
-
|
13411
|
-
|
13412
|
-
|
13413
|
-
|
13414
|
-
|
13415
|
-
|
13416
|
-
|
13417
|
-
|
13418
|
-
|
13419
|
-
|
13420
|
-
|
13421
|
-
|
13422
|
-
|
13423
|
-
return
|
13710
|
+
_this11 = _super16.call(this);
|
13711
|
+
_this11._added = false;
|
13712
|
+
_this11.legendHitBoxes = [];
|
13713
|
+
_this11._hoveredItem = null;
|
13714
|
+
_this11.doughnutMode = false;
|
13715
|
+
_this11.chart = config.chart;
|
13716
|
+
_this11.options = config.options;
|
13717
|
+
_this11.ctx = config.ctx;
|
13718
|
+
_this11.legendItems = undefined;
|
13719
|
+
_this11.columnSizes = undefined;
|
13720
|
+
_this11.lineWidths = undefined;
|
13721
|
+
_this11.maxHeight = undefined;
|
13722
|
+
_this11.maxWidth = undefined;
|
13723
|
+
_this11.top = undefined;
|
13724
|
+
_this11.bottom = undefined;
|
13725
|
+
_this11.left = undefined;
|
13726
|
+
_this11.right = undefined;
|
13727
|
+
_this11.height = undefined;
|
13728
|
+
_this11.width = undefined;
|
13729
|
+
_this11._margins = undefined;
|
13730
|
+
_this11.position = undefined;
|
13731
|
+
_this11.weight = undefined;
|
13732
|
+
_this11.fullSize = undefined;
|
13733
|
+
return _this11;
|
13424
13734
|
}
|
13425
13735
|
|
13426
13736
|
_createClass(Legend, [{
|
@@ -13616,12 +13926,12 @@
|
|
13616
13926
|
|
13617
13927
|
var left = _alignStartEnd(align, me.left + padding, me.right - me.lineWidths[row]);
|
13618
13928
|
|
13619
|
-
var
|
13620
|
-
|
13929
|
+
var _iterator12 = _createForOfIteratorHelper(hitboxes),
|
13930
|
+
_step12;
|
13621
13931
|
|
13622
13932
|
try {
|
13623
|
-
for (
|
13624
|
-
var hitbox =
|
13933
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
13934
|
+
var hitbox = _step12.value;
|
13625
13935
|
|
13626
13936
|
if (row !== hitbox.row) {
|
13627
13937
|
row = hitbox.row;
|
@@ -13633,21 +13943,21 @@
|
|
13633
13943
|
left += hitbox.width + padding;
|
13634
13944
|
}
|
13635
13945
|
} catch (err) {
|
13636
|
-
|
13946
|
+
_iterator12.e(err);
|
13637
13947
|
} finally {
|
13638
|
-
|
13948
|
+
_iterator12.f();
|
13639
13949
|
}
|
13640
13950
|
} else {
|
13641
13951
|
var col = 0;
|
13642
13952
|
|
13643
13953
|
var top = _alignStartEnd(align, me.top + titleHeight + padding, me.bottom - me.columnSizes[col].height);
|
13644
13954
|
|
13645
|
-
var
|
13646
|
-
|
13955
|
+
var _iterator13 = _createForOfIteratorHelper(hitboxes),
|
13956
|
+
_step13;
|
13647
13957
|
|
13648
13958
|
try {
|
13649
|
-
for (
|
13650
|
-
var _hitbox =
|
13959
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
13960
|
+
var _hitbox = _step13.value;
|
13651
13961
|
|
13652
13962
|
if (_hitbox.col !== col) {
|
13653
13963
|
col = _hitbox.col;
|
@@ -13659,9 +13969,9 @@
|
|
13659
13969
|
top += _hitbox.height + padding;
|
13660
13970
|
}
|
13661
13971
|
} catch (err) {
|
13662
|
-
|
13972
|
+
_iterator13.e(err);
|
13663
13973
|
} finally {
|
13664
|
-
|
13974
|
+
_iterator13.f();
|
13665
13975
|
}
|
13666
13976
|
}
|
13667
13977
|
}
|
@@ -13706,8 +14016,6 @@
|
|
13706
14016
|
ctx.textAlign = rtlHelper.textAlign('left');
|
13707
14017
|
ctx.textBaseline = 'middle';
|
13708
14018
|
ctx.lineWidth = 0.5;
|
13709
|
-
ctx.strokeStyle = fontColor;
|
13710
|
-
ctx.fillStyle = fontColor;
|
13711
14019
|
ctx.font = labelFont.string;
|
13712
14020
|
|
13713
14021
|
var _getBoxSize2 = getBoxSize(labelOpts, fontSize),
|
@@ -13742,10 +14050,28 @@
|
|
13742
14050
|
drawPoint(ctx, drawOptions, centerX, centerY);
|
13743
14051
|
} else {
|
13744
14052
|
var yBoxTop = y + Math.max((fontSize - boxHeight) / 2, 0);
|
13745
|
-
|
14053
|
+
var xBoxLeft = rtlHelper.leftForLtr(x, boxWidth);
|
14054
|
+
var borderRadius = toTRBLCorners(legendItem.borderRadius);
|
14055
|
+
ctx.beginPath();
|
14056
|
+
|
14057
|
+
if (Object.values(borderRadius).some(function (v) {
|
14058
|
+
return v !== 0;
|
14059
|
+
})) {
|
14060
|
+
addRoundedRectPath(ctx, {
|
14061
|
+
x: xBoxLeft,
|
14062
|
+
y: yBoxTop,
|
14063
|
+
w: boxWidth,
|
14064
|
+
h: boxHeight,
|
14065
|
+
radius: borderRadius
|
14066
|
+
});
|
14067
|
+
} else {
|
14068
|
+
ctx.rect(xBoxLeft, yBoxTop, boxWidth, boxHeight);
|
14069
|
+
}
|
14070
|
+
|
14071
|
+
ctx.fill();
|
13746
14072
|
|
13747
14073
|
if (lineWidth !== 0) {
|
13748
|
-
ctx.
|
14074
|
+
ctx.stroke();
|
13749
14075
|
}
|
13750
14076
|
}
|
13751
14077
|
|
@@ -13780,6 +14106,8 @@
|
|
13780
14106
|
overrideTextDirection(me.ctx, opts.textDirection);
|
13781
14107
|
var lineHeight = itemHeight + padding;
|
13782
14108
|
me.legendItems.forEach(function (legendItem, i) {
|
14109
|
+
ctx.strokeStyle = legendItem.fontColor || fontColor;
|
14110
|
+
ctx.fillStyle = legendItem.fontColor || fontColor;
|
13783
14111
|
var textWidth = ctx.measureText(legendItem.text).width;
|
13784
14112
|
var textAlign = rtlHelper.textAlign(legendItem.textAlign || (legendItem.textAlign = labelOpts.textAlign));
|
13785
14113
|
var width = boxWidth + fontSize / 2 + textWidth;
|
@@ -13991,13 +14319,15 @@
|
|
13991
14319
|
var _chart$legend$options = chart.legend.options.labels,
|
13992
14320
|
usePointStyle = _chart$legend$options.usePointStyle,
|
13993
14321
|
pointStyle = _chart$legend$options.pointStyle,
|
13994
|
-
textAlign = _chart$legend$options.textAlign
|
14322
|
+
textAlign = _chart$legend$options.textAlign,
|
14323
|
+
color = _chart$legend$options.color;
|
13995
14324
|
return chart._getSortedDatasetMetas().map(function (meta) {
|
13996
14325
|
var style = meta.controller.getStyle(usePointStyle ? 0 : undefined);
|
13997
14326
|
var borderWidth = toPadding(style.borderWidth);
|
13998
14327
|
return {
|
13999
14328
|
text: datasets[meta.index].label,
|
14000
14329
|
fillStyle: style.backgroundColor,
|
14330
|
+
fontColor: color,
|
14001
14331
|
hidden: !meta.visible,
|
14002
14332
|
lineCap: style.borderCapStyle,
|
14003
14333
|
lineDash: style.borderDash,
|
@@ -14008,6 +14338,7 @@
|
|
14008
14338
|
pointStyle: pointStyle || style.pointStyle,
|
14009
14339
|
rotation: style.rotation,
|
14010
14340
|
textAlign: textAlign || style.textAlign,
|
14341
|
+
borderRadius: 0,
|
14011
14342
|
datasetIndex: meta.index
|
14012
14343
|
};
|
14013
14344
|
}, this);
|
@@ -14040,25 +14371,25 @@
|
|
14040
14371
|
var _super17 = _createSuper(Title);
|
14041
14372
|
|
14042
14373
|
function Title(config) {
|
14043
|
-
var
|
14374
|
+
var _this12;
|
14044
14375
|
|
14045
14376
|
_classCallCheck(this, Title);
|
14046
14377
|
|
14047
|
-
|
14048
|
-
|
14049
|
-
|
14050
|
-
|
14051
|
-
|
14052
|
-
|
14053
|
-
|
14054
|
-
|
14055
|
-
|
14056
|
-
|
14057
|
-
|
14058
|
-
|
14059
|
-
|
14060
|
-
|
14061
|
-
return
|
14378
|
+
_this12 = _super17.call(this);
|
14379
|
+
_this12.chart = config.chart;
|
14380
|
+
_this12.options = config.options;
|
14381
|
+
_this12.ctx = config.ctx;
|
14382
|
+
_this12._padding = undefined;
|
14383
|
+
_this12.top = undefined;
|
14384
|
+
_this12.bottom = undefined;
|
14385
|
+
_this12.left = undefined;
|
14386
|
+
_this12.right = undefined;
|
14387
|
+
_this12.width = undefined;
|
14388
|
+
_this12.height = undefined;
|
14389
|
+
_this12.position = undefined;
|
14390
|
+
_this12.weight = undefined;
|
14391
|
+
_this12.fullSize = undefined;
|
14392
|
+
return _this12;
|
14062
14393
|
}
|
14063
14394
|
|
14064
14395
|
_createClass(Title, [{
|
@@ -14196,7 +14527,7 @@
|
|
14196
14527
|
align: 'center',
|
14197
14528
|
display: false,
|
14198
14529
|
font: {
|
14199
|
-
|
14530
|
+
weight: 'bold'
|
14200
14531
|
},
|
14201
14532
|
fullSize: true,
|
14202
14533
|
padding: 10,
|
@@ -14521,39 +14852,39 @@
|
|
14521
14852
|
var _super18 = _createSuper(Tooltip);
|
14522
14853
|
|
14523
14854
|
function Tooltip(config) {
|
14524
|
-
var
|
14855
|
+
var _this13;
|
14525
14856
|
|
14526
14857
|
_classCallCheck(this, Tooltip);
|
14527
14858
|
|
14528
|
-
|
14529
|
-
|
14530
|
-
|
14531
|
-
|
14532
|
-
|
14533
|
-
|
14534
|
-
|
14535
|
-
|
14536
|
-
|
14537
|
-
|
14538
|
-
|
14539
|
-
|
14540
|
-
|
14541
|
-
|
14542
|
-
|
14543
|
-
|
14544
|
-
|
14545
|
-
|
14546
|
-
|
14547
|
-
|
14548
|
-
|
14549
|
-
|
14550
|
-
|
14551
|
-
|
14552
|
-
|
14553
|
-
|
14554
|
-
|
14555
|
-
|
14556
|
-
return
|
14859
|
+
_this13 = _super18.call(this);
|
14860
|
+
_this13.opacity = 0;
|
14861
|
+
_this13._active = [];
|
14862
|
+
_this13._chart = config._chart;
|
14863
|
+
_this13._eventPosition = undefined;
|
14864
|
+
_this13._size = undefined;
|
14865
|
+
_this13._cachedAnimations = undefined;
|
14866
|
+
_this13._tooltipItems = [];
|
14867
|
+
_this13.$animations = undefined;
|
14868
|
+
_this13.$context = undefined;
|
14869
|
+
_this13.options = config.options;
|
14870
|
+
_this13.dataPoints = undefined;
|
14871
|
+
_this13.title = undefined;
|
14872
|
+
_this13.beforeBody = undefined;
|
14873
|
+
_this13.body = undefined;
|
14874
|
+
_this13.afterBody = undefined;
|
14875
|
+
_this13.footer = undefined;
|
14876
|
+
_this13.xAlign = undefined;
|
14877
|
+
_this13.yAlign = undefined;
|
14878
|
+
_this13.x = undefined;
|
14879
|
+
_this13.y = undefined;
|
14880
|
+
_this13.height = undefined;
|
14881
|
+
_this13.width = undefined;
|
14882
|
+
_this13.caretX = undefined;
|
14883
|
+
_this13.caretY = undefined;
|
14884
|
+
_this13.labelColors = undefined;
|
14885
|
+
_this13.labelPointStyles = undefined;
|
14886
|
+
_this13.labelTextColors = undefined;
|
14887
|
+
return _this13;
|
14557
14888
|
}
|
14558
14889
|
|
14559
14890
|
_createClass(Tooltip, [{
|
@@ -14871,13 +15202,45 @@
|
|
14871
15202
|
ctx.fillStyle = labelColors.backgroundColor;
|
14872
15203
|
drawPoint(ctx, drawOptions, centerX, centerY);
|
14873
15204
|
} else {
|
14874
|
-
ctx.
|
14875
|
-
ctx.fillRect(rtlHelper.leftForLtr(rtlColorX, boxWidth), colorY, boxWidth, boxHeight);
|
14876
|
-
ctx.lineWidth = 1;
|
15205
|
+
ctx.lineWidth = labelColors.borderWidth || 1;
|
14877
15206
|
ctx.strokeStyle = labelColors.borderColor;
|
14878
|
-
ctx.
|
14879
|
-
ctx.
|
14880
|
-
|
15207
|
+
ctx.setLineDash(labelColors.borderDash || []);
|
15208
|
+
ctx.lineDashOffset = labelColors.borderDashOffset || 0;
|
15209
|
+
var outerX = rtlHelper.leftForLtr(rtlColorX, boxWidth);
|
15210
|
+
var innerX = rtlHelper.leftForLtr(rtlHelper.xPlus(rtlColorX, 1), boxWidth - 2);
|
15211
|
+
var borderRadius = toTRBLCorners(labelColors.borderRadius);
|
15212
|
+
|
15213
|
+
if (Object.values(borderRadius).some(function (v) {
|
15214
|
+
return v !== 0;
|
15215
|
+
})) {
|
15216
|
+
ctx.beginPath();
|
15217
|
+
ctx.fillStyle = options.multiKeyBackground;
|
15218
|
+
addRoundedRectPath(ctx, {
|
15219
|
+
x: outerX,
|
15220
|
+
y: colorY,
|
15221
|
+
w: boxWidth,
|
15222
|
+
h: boxHeight,
|
15223
|
+
radius: borderRadius
|
15224
|
+
});
|
15225
|
+
ctx.fill();
|
15226
|
+
ctx.stroke();
|
15227
|
+
ctx.fillStyle = labelColors.backgroundColor;
|
15228
|
+
ctx.beginPath();
|
15229
|
+
addRoundedRectPath(ctx, {
|
15230
|
+
x: innerX,
|
15231
|
+
y: colorY + 1,
|
15232
|
+
w: boxWidth - 2,
|
15233
|
+
h: boxHeight - 2,
|
15234
|
+
radius: borderRadius
|
15235
|
+
});
|
15236
|
+
ctx.fill();
|
15237
|
+
} else {
|
15238
|
+
ctx.fillStyle = options.multiKeyBackground;
|
15239
|
+
ctx.fillRect(outerX, colorY, boxWidth, boxHeight);
|
15240
|
+
ctx.strokeRect(outerX, colorY, boxWidth, boxHeight);
|
15241
|
+
ctx.fillStyle = labelColors.backgroundColor;
|
15242
|
+
ctx.fillRect(innerX, colorY + 1, boxWidth - 2, boxHeight - 2);
|
15243
|
+
}
|
14881
15244
|
}
|
14882
15245
|
|
14883
15246
|
ctx.fillStyle = me.labelTextColors[i];
|
@@ -15221,7 +15584,7 @@
|
|
15221
15584
|
backgroundColor: 'rgba(0,0,0,0.8)',
|
15222
15585
|
titleColor: '#fff',
|
15223
15586
|
titleFont: {
|
15224
|
-
|
15587
|
+
weight: 'bold'
|
15225
15588
|
},
|
15226
15589
|
titleSpacing: 2,
|
15227
15590
|
titleMarginBottom: 6,
|
@@ -15234,7 +15597,7 @@
|
|
15234
15597
|
footerSpacing: 2,
|
15235
15598
|
footerMarginTop: 6,
|
15236
15599
|
footerFont: {
|
15237
|
-
|
15600
|
+
weight: 'bold'
|
15238
15601
|
},
|
15239
15602
|
footerAlign: 'left',
|
15240
15603
|
padding: 6,
|
@@ -15311,7 +15674,11 @@
|
|
15311
15674
|
var options = meta.controller.getStyle(tooltipItem.dataIndex);
|
15312
15675
|
return {
|
15313
15676
|
borderColor: options.borderColor,
|
15314
|
-
backgroundColor: options.backgroundColor
|
15677
|
+
backgroundColor: options.backgroundColor,
|
15678
|
+
borderWidth: options.borderWidth,
|
15679
|
+
borderDash: options.borderDash,
|
15680
|
+
borderDashOffset: options.borderDashOffset,
|
15681
|
+
borderRadius: 0
|
15315
15682
|
};
|
15316
15683
|
},
|
15317
15684
|
labelTextColor: function labelTextColor() {
|
@@ -15389,14 +15756,14 @@
|
|
15389
15756
|
var _super19 = _createSuper(CategoryScale);
|
15390
15757
|
|
15391
15758
|
function CategoryScale(cfg) {
|
15392
|
-
var
|
15759
|
+
var _this14;
|
15393
15760
|
|
15394
15761
|
_classCallCheck(this, CategoryScale);
|
15395
15762
|
|
15396
|
-
|
15397
|
-
|
15398
|
-
|
15399
|
-
return
|
15763
|
+
_this14 = _super19.call(this, cfg);
|
15764
|
+
_this14._startValue = undefined;
|
15765
|
+
_this14._valueRange = 0;
|
15766
|
+
return _this14;
|
15400
15767
|
}
|
15401
15768
|
|
15402
15769
|
_createClass(CategoryScale, [{
|
@@ -15635,17 +16002,17 @@
|
|
15635
16002
|
var _super20 = _createSuper(LinearScaleBase);
|
15636
16003
|
|
15637
16004
|
function LinearScaleBase(cfg) {
|
15638
|
-
var
|
16005
|
+
var _this15;
|
15639
16006
|
|
15640
16007
|
_classCallCheck(this, LinearScaleBase);
|
15641
16008
|
|
15642
|
-
|
15643
|
-
|
15644
|
-
|
15645
|
-
|
15646
|
-
|
15647
|
-
|
15648
|
-
return
|
16009
|
+
_this15 = _super20.call(this, cfg);
|
16010
|
+
_this15.start = undefined;
|
16011
|
+
_this15.end = undefined;
|
16012
|
+
_this15._startValue = undefined;
|
16013
|
+
_this15._endValue = undefined;
|
16014
|
+
_this15._valueRange = 0;
|
16015
|
+
return _this15;
|
15649
16016
|
}
|
15650
16017
|
|
15651
16018
|
_createClass(LinearScaleBase, [{
|
@@ -15899,16 +16266,16 @@
|
|
15899
16266
|
var _super22 = _createSuper(LogarithmicScale);
|
15900
16267
|
|
15901
16268
|
function LogarithmicScale(cfg) {
|
15902
|
-
var
|
16269
|
+
var _this16;
|
15903
16270
|
|
15904
16271
|
_classCallCheck(this, LogarithmicScale);
|
15905
16272
|
|
15906
|
-
|
15907
|
-
|
15908
|
-
|
15909
|
-
|
15910
|
-
|
15911
|
-
return
|
16273
|
+
_this16 = _super22.call(this, cfg);
|
16274
|
+
_this16.start = undefined;
|
16275
|
+
_this16.end = undefined;
|
16276
|
+
_this16._startValue = undefined;
|
16277
|
+
_this16._valueRange = 0;
|
16278
|
+
return _this16;
|
15912
16279
|
}
|
15913
16280
|
|
15914
16281
|
_createClass(LogarithmicScale, [{
|
@@ -16297,17 +16664,17 @@
|
|
16297
16664
|
var _super23 = _createSuper(RadialLinearScale);
|
16298
16665
|
|
16299
16666
|
function RadialLinearScale(cfg) {
|
16300
|
-
var
|
16667
|
+
var _this17;
|
16301
16668
|
|
16302
16669
|
_classCallCheck(this, RadialLinearScale);
|
16303
16670
|
|
16304
|
-
|
16305
|
-
|
16306
|
-
|
16307
|
-
|
16308
|
-
|
16309
|
-
|
16310
|
-
return
|
16671
|
+
_this17 = _super23.call(this, cfg);
|
16672
|
+
_this17.xCenter = undefined;
|
16673
|
+
_this17.yCenter = undefined;
|
16674
|
+
_this17.drawingArea = undefined;
|
16675
|
+
_this17._pointLabels = [];
|
16676
|
+
_this17._pointLabelItems = [];
|
16677
|
+
return _this17;
|
16311
16678
|
}
|
16312
16679
|
|
16313
16680
|
_createClass(RadialLinearScale, [{
|
@@ -16794,21 +17161,21 @@
|
|
16794
17161
|
var _super24 = _createSuper(TimeScale);
|
16795
17162
|
|
16796
17163
|
function TimeScale(props) {
|
16797
|
-
var
|
17164
|
+
var _this18;
|
16798
17165
|
|
16799
17166
|
_classCallCheck(this, TimeScale);
|
16800
17167
|
|
16801
|
-
|
16802
|
-
|
17168
|
+
_this18 = _super24.call(this, props);
|
17169
|
+
_this18._cache = {
|
16803
17170
|
data: [],
|
16804
17171
|
labels: [],
|
16805
17172
|
all: []
|
16806
17173
|
};
|
16807
|
-
|
16808
|
-
|
16809
|
-
|
16810
|
-
|
16811
|
-
return
|
17174
|
+
_this18._unit = 'day';
|
17175
|
+
_this18._majorUnit = undefined;
|
17176
|
+
_this18._offsets = {};
|
17177
|
+
_this18._normalized = false;
|
17178
|
+
return _this18;
|
16812
17179
|
}
|
16813
17180
|
|
16814
17181
|
_createClass(TimeScale, [{
|
@@ -17032,7 +17399,7 @@
|
|
17032
17399
|
var label = me._adapter.format(time, format || (major ? majorFormat : minorFormat));
|
17033
17400
|
|
17034
17401
|
var formatter = options.ticks.callback;
|
17035
|
-
return formatter ? formatter
|
17402
|
+
return formatter ? callback(formatter, [label, index, ticks], me) : label;
|
17036
17403
|
}
|
17037
17404
|
}, {
|
17038
17405
|
key: "generateTickLabels",
|
@@ -17197,14 +17564,14 @@
|
|
17197
17564
|
var _super25 = _createSuper(TimeSeriesScale);
|
17198
17565
|
|
17199
17566
|
function TimeSeriesScale(props) {
|
17200
|
-
var
|
17567
|
+
var _this19;
|
17201
17568
|
|
17202
17569
|
_classCallCheck(this, TimeSeriesScale);
|
17203
17570
|
|
17204
|
-
|
17205
|
-
|
17206
|
-
|
17207
|
-
return
|
17571
|
+
_this19 = _super25.call(this, props);
|
17572
|
+
_this19._table = [];
|
17573
|
+
_this19._maxIndex = undefined;
|
17574
|
+
return _this19;
|
17208
17575
|
}
|
17209
17576
|
|
17210
17577
|
_createClass(TimeSeriesScale, [{
|