@oliasoft-open-source/charts-library 4.7.0-beta-6 → 4.7.0-beta-8
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.
- package/dist/index.js +883 -694
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart.stories.d.ts +89 -89
- package/dist/src/components/bar-chart/utils/use-bar-chart-options.d.ts +1 -1
- package/dist/src/components/common/common.interface.d.ts +9 -2
- package/dist/src/components/common/helpers/chart-utils.d.ts +1 -1
- package/dist/src/components/common/helpers/enums.d.ts +4 -1
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +9 -1
- package/dist/src/components/common/plugins/annotation-dragger-plugin/helpers.d.ts +28 -0
- package/dist/src/components/line-chart/line-chart.interface.d.ts +1 -0
- package/dist/src/components/line-chart/line-chart.stories.d.ts +230 -104
- package/dist/src/components/line-chart/line-chart.test-case.stories.d.ts +28 -0
- package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +1 -1
- package/dist/src/components/pie-chart/pie-chart.stories.d.ts +24 -24
- package/dist/src/components/scatter-chart/scatter-chart.stories.d.ts +26 -26
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
8
5
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
9
6
|
import * as React from "react";
|
|
@@ -12,7 +9,7 @@ import { produce } from "immer";
|
|
|
12
9
|
import { round as round$2, displayNumber, isCloseTo, roundByMagnitude } from "@oliasoft-open-source/units";
|
|
13
10
|
import cx from "classnames";
|
|
14
11
|
import { Portal, Icon, Menu, Tooltip as Tooltip$2, Button, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Flex, Text } from "@oliasoft-open-source/react-ui-library";
|
|
15
|
-
import { isEmpty, isArray as isArray$2, some, has, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, isNil, map as map$3, find, get as get$1 } from "lodash";
|
|
12
|
+
import { isEmpty, isArray as isArray$2, some, has, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, isNil, map as map$3, find, get as get$1, noop as noop$2 } from "lodash";
|
|
16
13
|
/*!
|
|
17
14
|
* @kurkle/color v0.3.2
|
|
18
15
|
* https://github.com/kurkle/color#readme
|
|
@@ -575,14 +572,14 @@ let Color$1 = class Color {
|
|
|
575
572
|
}
|
|
576
573
|
};
|
|
577
574
|
/*!
|
|
578
|
-
* Chart.js v4.4.
|
|
575
|
+
* Chart.js v4.4.6
|
|
579
576
|
* https://www.chartjs.org
|
|
580
|
-
* (c)
|
|
577
|
+
* (c) 2024 Chart.js Contributors
|
|
581
578
|
* Released under the MIT License
|
|
582
579
|
*/
|
|
583
580
|
function noop$1() {
|
|
584
581
|
}
|
|
585
|
-
const uid$1 = (() => {
|
|
582
|
+
const uid$1 = /* @__PURE__ */ (() => {
|
|
586
583
|
let id = 0;
|
|
587
584
|
return () => id++;
|
|
588
585
|
})();
|
|
@@ -622,11 +619,7 @@ function each$1(loopable, fn, thisArg, reverse) {
|
|
|
622
619
|
let i2, len, keys;
|
|
623
620
|
if (isArray$1(loopable)) {
|
|
624
621
|
len = loopable.length;
|
|
625
|
-
|
|
626
|
-
for (i2 = len - 1; i2 >= 0; i2--) {
|
|
627
|
-
fn.call(thisArg, loopable[i2], i2);
|
|
628
|
-
}
|
|
629
|
-
} else {
|
|
622
|
+
{
|
|
630
623
|
for (i2 = 0; i2 < len; i2++) {
|
|
631
624
|
fn.call(thisArg, loopable[i2], i2);
|
|
632
625
|
}
|
|
@@ -1535,6 +1528,9 @@ function _alignPixel$1(chart2, pixel, width) {
|
|
|
1535
1528
|
return Math.round((pixel - halfWidth) * devicePixelRatio2) / devicePixelRatio2 + halfWidth;
|
|
1536
1529
|
}
|
|
1537
1530
|
function clearCanvas$1(canvas2, ctx) {
|
|
1531
|
+
if (!ctx && !canvas2) {
|
|
1532
|
+
return;
|
|
1533
|
+
}
|
|
1538
1534
|
ctx = ctx || canvas2.getContext("2d");
|
|
1539
1535
|
ctx.save();
|
|
1540
1536
|
ctx.resetTransform();
|
|
@@ -1852,7 +1848,6 @@ function toFont$1(options, fallback) {
|
|
|
1852
1848
|
return font;
|
|
1853
1849
|
}
|
|
1854
1850
|
function resolve$2(inputs, context, index2, info) {
|
|
1855
|
-
let cacheable = true;
|
|
1856
1851
|
let i2, ilen, value;
|
|
1857
1852
|
for (i2 = 0, ilen = inputs.length; i2 < ilen; ++i2) {
|
|
1858
1853
|
value = inputs[i2];
|
|
@@ -1861,16 +1856,11 @@ function resolve$2(inputs, context, index2, info) {
|
|
|
1861
1856
|
}
|
|
1862
1857
|
if (context !== void 0 && typeof value === "function") {
|
|
1863
1858
|
value = value(context);
|
|
1864
|
-
cacheable = false;
|
|
1865
1859
|
}
|
|
1866
1860
|
if (index2 !== void 0 && isArray$1(value)) {
|
|
1867
1861
|
value = value[index2 % value.length];
|
|
1868
|
-
cacheable = false;
|
|
1869
1862
|
}
|
|
1870
1863
|
if (value !== void 0) {
|
|
1871
|
-
if (info && !cacheable) {
|
|
1872
|
-
info.cacheable = false;
|
|
1873
|
-
}
|
|
1874
1864
|
return value;
|
|
1875
1865
|
}
|
|
1876
1866
|
}
|
|
@@ -2038,7 +2028,7 @@ function _descriptors$1(proxy, defaults2 = {
|
|
|
2038
2028
|
const readKey$1 = (prefix, name) => prefix ? prefix + _capitalize$1(name) : name;
|
|
2039
2029
|
const needsSubResolver$1 = (prop, value) => isObject$2(value) && prop !== "adapters" && (Object.getPrototypeOf(value) === null || value.constructor === Object);
|
|
2040
2030
|
function _cached$1(target, prop, resolve2) {
|
|
2041
|
-
if (Object.prototype.hasOwnProperty.call(target, prop)) {
|
|
2031
|
+
if (Object.prototype.hasOwnProperty.call(target, prop) || prop === "constructor") {
|
|
2042
2032
|
return target[prop];
|
|
2043
2033
|
}
|
|
2044
2034
|
const value = resolve2();
|
|
@@ -2419,7 +2409,7 @@ function getRelativePosition$2(event, chart2) {
|
|
|
2419
2409
|
function getContainerSize$1(canvas2, width, height) {
|
|
2420
2410
|
let maxWidth, maxHeight;
|
|
2421
2411
|
if (width === void 0 || height === void 0) {
|
|
2422
|
-
const container = _getParentNode$1(canvas2);
|
|
2412
|
+
const container = canvas2 && _getParentNode$1(canvas2);
|
|
2423
2413
|
if (!container) {
|
|
2424
2414
|
width = canvas2.clientWidth;
|
|
2425
2415
|
height = canvas2.clientHeight;
|
|
@@ -2501,8 +2491,10 @@ const supportsEventListenerOptions$1 = function() {
|
|
|
2501
2491
|
return false;
|
|
2502
2492
|
}
|
|
2503
2493
|
};
|
|
2504
|
-
|
|
2505
|
-
|
|
2494
|
+
if (_isDomSupported$1()) {
|
|
2495
|
+
window.addEventListener("test", null, options);
|
|
2496
|
+
window.removeEventListener("test", null, options);
|
|
2497
|
+
}
|
|
2506
2498
|
} catch (e2) {
|
|
2507
2499
|
}
|
|
2508
2500
|
return passiveSupported;
|
|
@@ -2891,9 +2883,9 @@ function styleChanged$1(style, prevStyle) {
|
|
|
2891
2883
|
return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);
|
|
2892
2884
|
}
|
|
2893
2885
|
/*!
|
|
2894
|
-
* Chart.js v4.4.
|
|
2886
|
+
* Chart.js v4.4.6
|
|
2895
2887
|
* https://www.chartjs.org
|
|
2896
|
-
* (c)
|
|
2888
|
+
* (c) 2024 Chart.js Contributors
|
|
2897
2889
|
* Released under the MIT License
|
|
2898
2890
|
*/
|
|
2899
2891
|
let Animator$1 = class Animator {
|
|
@@ -3323,9 +3315,11 @@ function applyStack$1(stack, value, dsIndex, options = {}) {
|
|
|
3323
3315
|
if (value === null) {
|
|
3324
3316
|
return;
|
|
3325
3317
|
}
|
|
3318
|
+
let found = false;
|
|
3326
3319
|
for (i2 = 0, ilen = keys.length; i2 < ilen; ++i2) {
|
|
3327
3320
|
datasetIndex = +keys[i2];
|
|
3328
3321
|
if (datasetIndex === dsIndex) {
|
|
3322
|
+
found = true;
|
|
3329
3323
|
if (options.all) {
|
|
3330
3324
|
continue;
|
|
3331
3325
|
}
|
|
@@ -3336,17 +3330,23 @@ function applyStack$1(stack, value, dsIndex, options = {}) {
|
|
|
3336
3330
|
value += otherValue;
|
|
3337
3331
|
}
|
|
3338
3332
|
}
|
|
3333
|
+
if (!found && !options.all) {
|
|
3334
|
+
return 0;
|
|
3335
|
+
}
|
|
3339
3336
|
return value;
|
|
3340
3337
|
}
|
|
3341
|
-
function convertObjectDataToArray$1(data) {
|
|
3338
|
+
function convertObjectDataToArray$1(data, meta) {
|
|
3339
|
+
const { iScale, vScale } = meta;
|
|
3340
|
+
const iAxisKey = iScale.axis === "x" ? "x" : "y";
|
|
3341
|
+
const vAxisKey = vScale.axis === "x" ? "x" : "y";
|
|
3342
3342
|
const keys = Object.keys(data);
|
|
3343
3343
|
const adata = new Array(keys.length);
|
|
3344
3344
|
let i2, ilen, key;
|
|
3345
3345
|
for (i2 = 0, ilen = keys.length; i2 < ilen; ++i2) {
|
|
3346
3346
|
key = keys[i2];
|
|
3347
3347
|
adata[i2] = {
|
|
3348
|
-
|
|
3349
|
-
|
|
3348
|
+
[iAxisKey]: key,
|
|
3349
|
+
[vAxisKey]: data[key]
|
|
3350
3350
|
};
|
|
3351
3351
|
}
|
|
3352
3352
|
return adata;
|
|
@@ -3535,7 +3535,8 @@ let DatasetController$1 = (_a = class {
|
|
|
3535
3535
|
const data = dataset.data || (dataset.data = []);
|
|
3536
3536
|
const _data = this._data;
|
|
3537
3537
|
if (isObject$2(data)) {
|
|
3538
|
-
|
|
3538
|
+
const meta = this._cachedMeta;
|
|
3539
|
+
this._data = convertObjectDataToArray$1(data, meta);
|
|
3539
3540
|
} else if (_data !== data) {
|
|
3540
3541
|
if (_data) {
|
|
3541
3542
|
unlistenArrayEvents$1(_data, this);
|
|
@@ -3572,6 +3573,7 @@ let DatasetController$1 = (_a = class {
|
|
|
3572
3573
|
this._resyncElements(resetNewElements);
|
|
3573
3574
|
if (stackChanged || oldStacked !== meta._stacked) {
|
|
3574
3575
|
updateStacks$1(this, meta._parsed);
|
|
3576
|
+
meta._stacked = isStacked$1(meta.vScale, meta);
|
|
3575
3577
|
}
|
|
3576
3578
|
}
|
|
3577
3579
|
configure() {
|
|
@@ -4332,8 +4334,10 @@ let BarController$1 = (_b = class extends DatasetController$1 {
|
|
|
4332
4334
|
const metasets = iScale.getMatchingVisibleMetas(this._type).filter((meta) => meta.controller.options.grouped);
|
|
4333
4335
|
const stacked = iScale.options.stacked;
|
|
4334
4336
|
const stacks = [];
|
|
4337
|
+
const currentParsed = this._cachedMeta.controller.getParsed(dataIndex);
|
|
4338
|
+
const iScaleValue = currentParsed && currentParsed[iScale.axis];
|
|
4335
4339
|
const skipNull = (meta) => {
|
|
4336
|
-
const parsed = meta.
|
|
4340
|
+
const parsed = meta._parsed.find((item) => item[iScale.axis] === iScaleValue);
|
|
4337
4341
|
const val = parsed && parsed[meta.vScale.axis];
|
|
4338
4342
|
if (isNullOrUndef$1(val) || isNaN(val)) {
|
|
4339
4343
|
return true;
|
|
@@ -4472,7 +4476,7 @@ let BarController$1 = (_b = class extends DatasetController$1 {
|
|
|
4472
4476
|
const ilen = rects.length;
|
|
4473
4477
|
let i2 = 0;
|
|
4474
4478
|
for (; i2 < ilen; ++i2) {
|
|
4475
|
-
if (this.getParsed(i2)[vScale.axis] !== null) {
|
|
4479
|
+
if (this.getParsed(i2)[vScale.axis] !== null && !rects[i2].hidden) {
|
|
4476
4480
|
rects[i2].draw(this._ctx);
|
|
4477
4481
|
}
|
|
4478
4482
|
}
|
|
@@ -5223,7 +5227,7 @@ function getAxisItems$1(chart2, position, axis, intersect, useFinalPosition) {
|
|
|
5223
5227
|
const rangeMethod = axis === "x" ? "inXRange" : "inYRange";
|
|
5224
5228
|
let intersectsItem = false;
|
|
5225
5229
|
evaluateInteractionItems$1(chart2, axis, position, (element, datasetIndex, index2) => {
|
|
5226
|
-
if (element[rangeMethod](position[axis], useFinalPosition)) {
|
|
5230
|
+
if (element[rangeMethod] && element[rangeMethod](position[axis], useFinalPosition)) {
|
|
5227
5231
|
items.push({
|
|
5228
5232
|
element,
|
|
5229
5233
|
datasetIndex,
|
|
@@ -5721,10 +5725,14 @@ const eventListenerOptions$1 = supportsEventListenerOptions$1 ? {
|
|
|
5721
5725
|
passive: true
|
|
5722
5726
|
} : false;
|
|
5723
5727
|
function addListener$1(node, type, listener) {
|
|
5724
|
-
node
|
|
5728
|
+
if (node) {
|
|
5729
|
+
node.addEventListener(type, listener, eventListenerOptions$1);
|
|
5730
|
+
}
|
|
5725
5731
|
}
|
|
5726
5732
|
function removeListener$1(chart2, type, listener) {
|
|
5727
|
-
chart2.canvas
|
|
5733
|
+
if (chart2 && chart2.canvas) {
|
|
5734
|
+
chart2.canvas.removeEventListener(type, listener, eventListenerOptions$1);
|
|
5735
|
+
}
|
|
5728
5736
|
}
|
|
5729
5737
|
function fromNativeEvent$1(event, chart2) {
|
|
5730
5738
|
const type = EVENT_TYPES$1[event.type] || event.type;
|
|
@@ -5917,7 +5925,7 @@ let DomPlatform$1 = class DomPlatform extends BasePlatform$1 {
|
|
|
5917
5925
|
return getMaximumSize$1(canvas2, width, height, aspectRatio);
|
|
5918
5926
|
}
|
|
5919
5927
|
isAttached(canvas2) {
|
|
5920
|
-
const container = _getParentNode$1(canvas2);
|
|
5928
|
+
const container = canvas2 && _getParentNode$1(canvas2);
|
|
5921
5929
|
return !!(container && container.isConnected);
|
|
5922
5930
|
}
|
|
5923
5931
|
};
|
|
@@ -6982,6 +6990,13 @@ let Scale$1 = class Scale extends Element$2 {
|
|
|
6982
6990
|
case "right":
|
|
6983
6991
|
left2 -= width;
|
|
6984
6992
|
break;
|
|
6993
|
+
case "inner":
|
|
6994
|
+
if (i2 === ilen - 1) {
|
|
6995
|
+
left2 -= width;
|
|
6996
|
+
} else if (i2 > 0) {
|
|
6997
|
+
left2 -= width / 2;
|
|
6998
|
+
}
|
|
6999
|
+
break;
|
|
6985
7000
|
}
|
|
6986
7001
|
backdrop = {
|
|
6987
7002
|
left: left2,
|
|
@@ -7949,7 +7964,7 @@ function getResolver$1(resolverCache, scopes, prefixes) {
|
|
|
7949
7964
|
}
|
|
7950
7965
|
return cached;
|
|
7951
7966
|
}
|
|
7952
|
-
const hasFunction$1 = (value) => isObject$2(value) && Object.getOwnPropertyNames(value).
|
|
7967
|
+
const hasFunction$1 = (value) => isObject$2(value) && Object.getOwnPropertyNames(value).some((key) => isFunction$1(value[key]));
|
|
7953
7968
|
function needContext$1(proxy, names2) {
|
|
7954
7969
|
const { isScriptable, isIndexable: isIndexable2 } = _descriptors$1(proxy);
|
|
7955
7970
|
for (const prop of names2) {
|
|
@@ -7962,7 +7977,7 @@ function needContext$1(proxy, names2) {
|
|
|
7962
7977
|
}
|
|
7963
7978
|
return false;
|
|
7964
7979
|
}
|
|
7965
|
-
var version$3 = "4.4.
|
|
7980
|
+
var version$3 = "4.4.6";
|
|
7966
7981
|
const KNOWN_POSITIONS$1 = [
|
|
7967
7982
|
"top",
|
|
7968
7983
|
"bottom",
|
|
@@ -8487,8 +8502,8 @@ let Chart$2 = (_h = class {
|
|
|
8487
8502
|
let i2;
|
|
8488
8503
|
if (this._resizeBeforeDraw) {
|
|
8489
8504
|
const { width, height } = this._resizeBeforeDraw;
|
|
8490
|
-
this._resize(width, height);
|
|
8491
8505
|
this._resizeBeforeDraw = null;
|
|
8506
|
+
this._resize(width, height);
|
|
8492
8507
|
}
|
|
8493
8508
|
this.clear();
|
|
8494
8509
|
if (this.width <= 0 || this.height <= 0) {
|
|
@@ -9068,7 +9083,8 @@ let ArcElement$1 = (_i = class extends Element$2 {
|
|
|
9068
9083
|
], useFinalPosition);
|
|
9069
9084
|
const rAdjust = (this.options.spacing + this.options.borderWidth) / 2;
|
|
9070
9085
|
const _circumference = valueOrDefault$1(circumference, endAngle - startAngle);
|
|
9071
|
-
const
|
|
9086
|
+
const nonZeroBetween = _angleBetween$1(angle, startAngle, endAngle) && startAngle !== endAngle;
|
|
9087
|
+
const betweenAngles = _circumference >= TAU$1 || nonZeroBetween;
|
|
9072
9088
|
const withinRadius = _isBetween$1(distance, innerRadius + rAdjust, outerRadius + rAdjust);
|
|
9073
9089
|
return betweenAngles && withinRadius;
|
|
9074
9090
|
}
|
|
@@ -10941,20 +10957,26 @@ const positioners$2 = {
|
|
|
10941
10957
|
return false;
|
|
10942
10958
|
}
|
|
10943
10959
|
let i2, len;
|
|
10944
|
-
let
|
|
10960
|
+
let xSet = /* @__PURE__ */ new Set();
|
|
10945
10961
|
let y2 = 0;
|
|
10946
10962
|
let count = 0;
|
|
10947
10963
|
for (i2 = 0, len = items.length; i2 < len; ++i2) {
|
|
10948
10964
|
const el = items[i2].element;
|
|
10949
10965
|
if (el && el.hasValue()) {
|
|
10950
10966
|
const pos = el.tooltipPosition();
|
|
10951
|
-
|
|
10967
|
+
xSet.add(pos.x);
|
|
10952
10968
|
y2 += pos.y;
|
|
10953
10969
|
++count;
|
|
10954
10970
|
}
|
|
10955
10971
|
}
|
|
10972
|
+
if (count === 0 || xSet.size === 0) {
|
|
10973
|
+
return false;
|
|
10974
|
+
}
|
|
10975
|
+
const xAverage = [
|
|
10976
|
+
...xSet
|
|
10977
|
+
].reduce((a2, b2) => a2 + b2) / xSet.size;
|
|
10956
10978
|
return {
|
|
10957
|
-
x:
|
|
10979
|
+
x: xAverage,
|
|
10958
10980
|
y: y2 / count
|
|
10959
10981
|
};
|
|
10960
10982
|
},
|
|
@@ -11769,7 +11791,7 @@ let Tooltip$1 = (_m = class extends Element$2 {
|
|
|
11769
11791
|
return [];
|
|
11770
11792
|
}
|
|
11771
11793
|
if (!inChartArea) {
|
|
11772
|
-
return lastActive;
|
|
11794
|
+
return lastActive.filter((i2) => this.chart.data.datasets[i2.datasetIndex] && this.chart.getDatasetMeta(i2.datasetIndex).controller.getParsed(i2.index) !== void 0);
|
|
11773
11795
|
}
|
|
11774
11796
|
const active = this.chart.getElementsAtEventForMode(e2, options.mode, options, replay);
|
|
11775
11797
|
if (options.reverse) {
|
|
@@ -13015,8 +13037,7 @@ function ChartComponent(props, ref) {
|
|
|
13015
13037
|
const canvasRef = useRef(null);
|
|
13016
13038
|
const chartRef = useRef();
|
|
13017
13039
|
const renderChart = () => {
|
|
13018
|
-
if (!canvasRef.current)
|
|
13019
|
-
return;
|
|
13040
|
+
if (!canvasRef.current) return;
|
|
13020
13041
|
chartRef.current = new Chart$2(canvasRef.current, {
|
|
13021
13042
|
type,
|
|
13022
13043
|
data: cloneData(data, datasetIdKey),
|
|
@@ -13059,8 +13080,7 @@ function ChartComponent(props, ref) {
|
|
|
13059
13080
|
data.datasets
|
|
13060
13081
|
]);
|
|
13061
13082
|
useEffect(() => {
|
|
13062
|
-
if (!chartRef.current)
|
|
13063
|
-
return;
|
|
13083
|
+
if (!chartRef.current) return;
|
|
13064
13084
|
if (redraw) {
|
|
13065
13085
|
destroyChart();
|
|
13066
13086
|
setTimeout(renderChart);
|
|
@@ -13075,8 +13095,7 @@ function ChartComponent(props, ref) {
|
|
|
13075
13095
|
updateMode
|
|
13076
13096
|
]);
|
|
13077
13097
|
useEffect(() => {
|
|
13078
|
-
if (!chartRef.current)
|
|
13079
|
-
return;
|
|
13098
|
+
if (!chartRef.current) return;
|
|
13080
13099
|
destroyChart();
|
|
13081
13100
|
setTimeout(renderChart);
|
|
13082
13101
|
}, [
|
|
@@ -13269,17 +13288,15 @@ var hammer = { exports: {} };
|
|
|
13269
13288
|
var values = [];
|
|
13270
13289
|
var i2 = 0;
|
|
13271
13290
|
while (i2 < src.length) {
|
|
13272
|
-
var val =
|
|
13291
|
+
var val = src[i2][key];
|
|
13273
13292
|
if (inArray(values, val) < 0) {
|
|
13274
13293
|
results.push(src[i2]);
|
|
13275
13294
|
}
|
|
13276
13295
|
values[i2] = val;
|
|
13277
13296
|
i2++;
|
|
13278
13297
|
}
|
|
13279
|
-
|
|
13280
|
-
|
|
13281
|
-
results = results.sort();
|
|
13282
|
-
} else {
|
|
13298
|
+
{
|
|
13299
|
+
{
|
|
13283
13300
|
results = results.sort(function sortUniqueArray(a2, b2) {
|
|
13284
13301
|
return a2[key] > b2[key];
|
|
13285
13302
|
});
|
|
@@ -13690,7 +13707,7 @@ var hammer = { exports: {} };
|
|
|
13690
13707
|
var all = toArray2(ev.touches);
|
|
13691
13708
|
var changed = toArray2(ev.changedTouches);
|
|
13692
13709
|
if (type & (INPUT_END | INPUT_CANCEL)) {
|
|
13693
|
-
all = uniqueArray(all.concat(changed), "identifier"
|
|
13710
|
+
all = uniqueArray(all.concat(changed), "identifier");
|
|
13694
13711
|
}
|
|
13695
13712
|
return [all, changed];
|
|
13696
13713
|
}
|
|
@@ -13754,7 +13771,7 @@ var hammer = { exports: {} };
|
|
|
13754
13771
|
}
|
|
13755
13772
|
return [
|
|
13756
13773
|
// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
|
|
13757
|
-
uniqueArray(targetTouches.concat(changedTargetTouches), "identifier"
|
|
13774
|
+
uniqueArray(targetTouches.concat(changedTargetTouches), "identifier"),
|
|
13758
13775
|
changedTargetTouches
|
|
13759
13776
|
];
|
|
13760
13777
|
}
|
|
@@ -14894,11 +14911,7 @@ var hammer = { exports: {} };
|
|
|
14894
14911
|
});
|
|
14895
14912
|
var freeGlobal = typeof window2 !== "undefined" ? window2 : typeof self !== "undefined" ? self : {};
|
|
14896
14913
|
freeGlobal.Hammer = Hammer2;
|
|
14897
|
-
if (
|
|
14898
|
-
undefined$1(function() {
|
|
14899
|
-
return Hammer2;
|
|
14900
|
-
});
|
|
14901
|
-
} else if (module.exports) {
|
|
14914
|
+
if (module.exports) {
|
|
14902
14915
|
module.exports = Hammer2;
|
|
14903
14916
|
} else {
|
|
14904
14917
|
window2[exportName] = Hammer2;
|
|
@@ -16814,57 +16827,57 @@ var plugin = {
|
|
|
16814
16827
|
}
|
|
16815
16828
|
};
|
|
16816
16829
|
/*!
|
|
16817
|
-
* chartjs-plugin-annotation v3.0
|
|
16830
|
+
* chartjs-plugin-annotation v3.1.0
|
|
16818
16831
|
* https://www.chartjs.org/chartjs-plugin-annotation/index
|
|
16819
|
-
* (c)
|
|
16832
|
+
* (c) 2024 chartjs-plugin-annotation Contributors
|
|
16820
16833
|
* Released under the MIT License
|
|
16821
16834
|
*/
|
|
16822
16835
|
const interaction = {
|
|
16823
16836
|
modes: {
|
|
16824
16837
|
/**
|
|
16825
16838
|
* Point mode returns all elements that hit test based on the event position
|
|
16826
|
-
* @param {
|
|
16839
|
+
* @param {AnnotationElement[]} visibleElements - annotation elements which are visible
|
|
16827
16840
|
* @param {ChartEvent} event - the event we are find things at
|
|
16828
16841
|
* @return {AnnotationElement[]} - elements that are found
|
|
16829
16842
|
*/
|
|
16830
|
-
point(
|
|
16831
|
-
return filterElements(
|
|
16843
|
+
point(visibleElements, event) {
|
|
16844
|
+
return filterElements(visibleElements, event, { intersect: true });
|
|
16832
16845
|
},
|
|
16833
16846
|
/**
|
|
16834
16847
|
* Nearest mode returns the element closest to the event position
|
|
16835
|
-
* @param {
|
|
16848
|
+
* @param {AnnotationElement[]} visibleElements - annotation elements which are visible
|
|
16836
16849
|
* @param {ChartEvent} event - the event we are find things at
|
|
16837
16850
|
* @param {Object} options - interaction options to use
|
|
16838
16851
|
* @return {AnnotationElement[]} - elements that are found (only 1 element)
|
|
16839
16852
|
*/
|
|
16840
|
-
nearest(
|
|
16841
|
-
return getNearestItem(
|
|
16853
|
+
nearest(visibleElements, event, options) {
|
|
16854
|
+
return getNearestItem(visibleElements, event, options);
|
|
16842
16855
|
},
|
|
16843
16856
|
/**
|
|
16844
16857
|
* x mode returns the elements that hit-test at the current x coordinate
|
|
16845
|
-
* @param {
|
|
16858
|
+
* @param {AnnotationElement[]} visibleElements - annotation elements which are visible
|
|
16846
16859
|
* @param {ChartEvent} event - the event we are find things at
|
|
16847
16860
|
* @param {Object} options - interaction options to use
|
|
16848
16861
|
* @return {AnnotationElement[]} - elements that are found
|
|
16849
16862
|
*/
|
|
16850
|
-
x(
|
|
16851
|
-
return filterElements(
|
|
16863
|
+
x(visibleElements, event, options) {
|
|
16864
|
+
return filterElements(visibleElements, event, { intersect: options.intersect, axis: "x" });
|
|
16852
16865
|
},
|
|
16853
16866
|
/**
|
|
16854
16867
|
* y mode returns the elements that hit-test at the current y coordinate
|
|
16855
|
-
* @param {
|
|
16868
|
+
* @param {AnnotationElement[]} visibleElements - annotation elements which are visible
|
|
16856
16869
|
* @param {ChartEvent} event - the event we are find things at
|
|
16857
16870
|
* @param {Object} options - interaction options to use
|
|
16858
16871
|
* @return {AnnotationElement[]} - elements that are found
|
|
16859
16872
|
*/
|
|
16860
|
-
y(
|
|
16861
|
-
return filterElements(
|
|
16873
|
+
y(visibleElements, event, options) {
|
|
16874
|
+
return filterElements(visibleElements, event, { intersect: options.intersect, axis: "y" });
|
|
16862
16875
|
}
|
|
16863
16876
|
}
|
|
16864
16877
|
};
|
|
16865
|
-
function getElements(
|
|
16878
|
+
function getElements(visibleElements, event, options) {
|
|
16866
16879
|
const mode = interaction.modes[options.mode] || interaction.modes.nearest;
|
|
16867
|
-
return mode(
|
|
16880
|
+
return mode(visibleElements, event, options);
|
|
16868
16881
|
}
|
|
16869
16882
|
function inRangeByAxis(element, event, axis) {
|
|
16870
16883
|
if (axis !== "x" && axis !== "y") {
|
|
@@ -16880,12 +16893,12 @@ function getPointByAxis(event, center, axis) {
|
|
|
16880
16893
|
}
|
|
16881
16894
|
return center;
|
|
16882
16895
|
}
|
|
16883
|
-
function filterElements(
|
|
16884
|
-
return
|
|
16896
|
+
function filterElements(visibleElements, event, options) {
|
|
16897
|
+
return visibleElements.filter((element) => options.intersect ? element.inRange(event.x, event.y) : inRangeByAxis(element, event, options.axis));
|
|
16885
16898
|
}
|
|
16886
|
-
function getNearestItem(
|
|
16899
|
+
function getNearestItem(visibleElements, event, options) {
|
|
16887
16900
|
let minDistance = Number.POSITIVE_INFINITY;
|
|
16888
|
-
return filterElements(
|
|
16901
|
+
return filterElements(visibleElements, event, options).reduce((nearestItems, element) => {
|
|
16889
16902
|
const center = element.getCenterPoint();
|
|
16890
16903
|
const evenPoint = getPointByAxis(event, center, options.axis);
|
|
16891
16904
|
const distance = distanceBetweenPoints$1(event, evenPoint);
|
|
@@ -16898,26 +16911,36 @@ function getNearestItem(state, event, options) {
|
|
|
16898
16911
|
return nearestItems;
|
|
16899
16912
|
}, []).sort((a2, b2) => a2._index - b2._index).slice(0, 1);
|
|
16900
16913
|
}
|
|
16914
|
+
function rotated(point, center, angle) {
|
|
16915
|
+
const cos = Math.cos(angle);
|
|
16916
|
+
const sin = Math.sin(angle);
|
|
16917
|
+
const cx2 = center.x;
|
|
16918
|
+
const cy = center.y;
|
|
16919
|
+
return {
|
|
16920
|
+
x: cx2 + cos * (point.x - cx2) - sin * (point.y - cy),
|
|
16921
|
+
y: cy + sin * (point.x - cx2) + cos * (point.y - cy)
|
|
16922
|
+
};
|
|
16923
|
+
}
|
|
16901
16924
|
const isOlderPart = (act, req) => req > act || act.length > req.length && act.slice(0, req.length) === req;
|
|
16902
16925
|
const EPSILON$1 = 1e-3;
|
|
16903
16926
|
const clamp = (x2, from2, to2) => Math.min(to2, Math.max(from2, x2));
|
|
16927
|
+
const inLimit = (limit, hitSize) => limit.value >= limit.start - hitSize && limit.value <= limit.end + hitSize;
|
|
16904
16928
|
function clampAll(obj, from2, to2) {
|
|
16905
16929
|
for (const key of Object.keys(obj)) {
|
|
16906
16930
|
obj[key] = clamp(obj[key], from2, to2);
|
|
16907
16931
|
}
|
|
16908
16932
|
return obj;
|
|
16909
16933
|
}
|
|
16910
|
-
function inPointRange(point, center, radius,
|
|
16934
|
+
function inPointRange(point, center, radius, hitSize) {
|
|
16911
16935
|
if (!point || !center || radius <= 0) {
|
|
16912
16936
|
return false;
|
|
16913
16937
|
}
|
|
16914
|
-
|
|
16915
|
-
return Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2) <= Math.pow(radius + hBorderWidth, 2);
|
|
16938
|
+
return Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2) <= Math.pow(radius + hitSize, 2);
|
|
16916
16939
|
}
|
|
16917
|
-
function inBoxRange(point, { x: x2, y: y2, x2: x22, y2: y22 }, axis, borderWidth) {
|
|
16918
|
-
const
|
|
16919
|
-
const inRangeX = point.x >= x2 -
|
|
16920
|
-
const inRangeY = point.y >= y2 -
|
|
16940
|
+
function inBoxRange(point, { x: x2, y: y2, x2: x22, y2: y22 }, axis, { borderWidth, hitTolerance }) {
|
|
16941
|
+
const hitSize = (borderWidth + hitTolerance) / 2;
|
|
16942
|
+
const inRangeX = point.x >= x2 - hitSize - EPSILON$1 && point.x <= x22 + hitSize + EPSILON$1;
|
|
16943
|
+
const inRangeY = point.y >= y2 - hitSize - EPSILON$1 && point.y <= y22 + hitSize + EPSILON$1;
|
|
16921
16944
|
if (axis === "x") {
|
|
16922
16945
|
return inRangeX;
|
|
16923
16946
|
} else if (axis === "y") {
|
|
@@ -16925,6 +16948,10 @@ function inBoxRange(point, { x: x2, y: y2, x2: x22, y2: y22 }, axis, borderWidth
|
|
|
16925
16948
|
}
|
|
16926
16949
|
return inRangeX && inRangeY;
|
|
16927
16950
|
}
|
|
16951
|
+
function inLabelRange(point, { rect, center }, axis, { rotation, borderWidth, hitTolerance }) {
|
|
16952
|
+
const rotPoint = rotated(point, center, toRadians$1(-rotation));
|
|
16953
|
+
return inBoxRange(rotPoint, rect, axis, { borderWidth, hitTolerance });
|
|
16954
|
+
}
|
|
16928
16955
|
function getElementCenterPoint(element, useFinalPosition) {
|
|
16929
16956
|
const { centerX, centerY } = element.getProps(["centerX", "centerY"], useFinalPosition);
|
|
16930
16957
|
return { x: centerX, y: centerY };
|
|
@@ -16953,6 +16980,7 @@ const toPositivePercent = (s2) => clamp(toPercent(s2), 0, 1);
|
|
|
16953
16980
|
const boxAppering = (x2, y2) => ({ x: x2, y: y2, x2, y2, width: 0, height: 0 });
|
|
16954
16981
|
const defaultInitAnimation = {
|
|
16955
16982
|
box: (properties) => boxAppering(properties.centerX, properties.centerY),
|
|
16983
|
+
doughnutLabel: (properties) => boxAppering(properties.centerX, properties.centerY),
|
|
16956
16984
|
ellipse: (properties) => ({ centerX: properties.centerX, centerY: properties.centerX, radius: 0, width: 0, height: 0 }),
|
|
16957
16985
|
label: (properties) => boxAppering(properties.centerX, properties.centerY),
|
|
16958
16986
|
line: (properties) => boxAppering(properties.x, properties.y),
|
|
@@ -16989,6 +17017,24 @@ function calculateTextAlignment(size, options) {
|
|
|
16989
17017
|
}
|
|
16990
17018
|
return x2;
|
|
16991
17019
|
}
|
|
17020
|
+
function measureLabelRectangle(point, labelSize, { borderWidth, position, xAdjust, yAdjust }, padding) {
|
|
17021
|
+
const hasPadding = isObject$2(padding);
|
|
17022
|
+
const width = labelSize.width + (hasPadding ? padding.width : 0) + borderWidth;
|
|
17023
|
+
const height = labelSize.height + (hasPadding ? padding.height : 0) + borderWidth;
|
|
17024
|
+
const positionObj = toPosition(position);
|
|
17025
|
+
const x2 = calculateLabelPosition$1(point.x, width, xAdjust, positionObj.x);
|
|
17026
|
+
const y2 = calculateLabelPosition$1(point.y, height, yAdjust, positionObj.y);
|
|
17027
|
+
return {
|
|
17028
|
+
x: x2,
|
|
17029
|
+
y: y2,
|
|
17030
|
+
x2: x2 + width,
|
|
17031
|
+
y2: y2 + height,
|
|
17032
|
+
width,
|
|
17033
|
+
height,
|
|
17034
|
+
centerX: x2 + width / 2,
|
|
17035
|
+
centerY: y2 + height / 2
|
|
17036
|
+
};
|
|
17037
|
+
}
|
|
16992
17038
|
function toPosition(value, defaultValue = "center") {
|
|
16993
17039
|
if (isObject$2(value)) {
|
|
16994
17040
|
return {
|
|
@@ -17002,9 +17048,26 @@ function toPosition(value, defaultValue = "center") {
|
|
|
17002
17048
|
y: value
|
|
17003
17049
|
};
|
|
17004
17050
|
}
|
|
17051
|
+
const shouldFit = (options, fitRatio) => options && options.autoFit && fitRatio < 1;
|
|
17052
|
+
function toFonts(options, fitRatio) {
|
|
17053
|
+
const optFont = options.font;
|
|
17054
|
+
const fonts = isArray$1(optFont) ? optFont : [optFont];
|
|
17055
|
+
if (shouldFit(options, fitRatio)) {
|
|
17056
|
+
return fonts.map(function(f2) {
|
|
17057
|
+
const font = toFont$1(f2);
|
|
17058
|
+
font.size = Math.floor(f2.size * fitRatio);
|
|
17059
|
+
font.lineHeight = f2.lineHeight;
|
|
17060
|
+
return toFont$1(font);
|
|
17061
|
+
});
|
|
17062
|
+
}
|
|
17063
|
+
return fonts.map((f2) => toFont$1(f2));
|
|
17064
|
+
}
|
|
17005
17065
|
function isBoundToPoint(options) {
|
|
17006
17066
|
return options && (defined$1(options.xValue) || defined$1(options.yValue));
|
|
17007
17067
|
}
|
|
17068
|
+
function calculateLabelPosition$1(start, size, adjust = 0, position) {
|
|
17069
|
+
return start - getRelativePosition$1(size, position) + adjust;
|
|
17070
|
+
}
|
|
17008
17071
|
function initAnimationProperties(chart2, properties, options) {
|
|
17009
17072
|
const initAnim = options.init;
|
|
17010
17073
|
if (!initAnim) {
|
|
@@ -17059,10 +17122,10 @@ function translate(ctx, { x: x2, y: y2 }, rotation) {
|
|
|
17059
17122
|
}
|
|
17060
17123
|
function setBorderStyle(ctx, options) {
|
|
17061
17124
|
if (options && options.borderWidth) {
|
|
17062
|
-
ctx.lineCap = options.borderCapStyle;
|
|
17125
|
+
ctx.lineCap = options.borderCapStyle || "butt";
|
|
17063
17126
|
ctx.setLineDash(options.borderDash);
|
|
17064
17127
|
ctx.lineDashOffset = options.borderDashOffset;
|
|
17065
|
-
ctx.lineJoin = options.borderJoinStyle;
|
|
17128
|
+
ctx.lineJoin = options.borderJoinStyle || "miter";
|
|
17066
17129
|
ctx.lineWidth = options.borderWidth;
|
|
17067
17130
|
ctx.strokeStyle = options.borderColor;
|
|
17068
17131
|
return true;
|
|
@@ -17077,13 +17140,13 @@ function setShadowStyle(ctx, options) {
|
|
|
17077
17140
|
function measureLabelSize$1(ctx, options) {
|
|
17078
17141
|
const content = options.content;
|
|
17079
17142
|
if (isImageOrCanvas(content)) {
|
|
17080
|
-
|
|
17143
|
+
const size = {
|
|
17081
17144
|
width: getSize(content.width, options.width),
|
|
17082
17145
|
height: getSize(content.height, options.height)
|
|
17083
17146
|
};
|
|
17147
|
+
return size;
|
|
17084
17148
|
}
|
|
17085
|
-
const
|
|
17086
|
-
const fonts = isArray$1(optFont) ? optFont.map((f2) => toFont$1(f2)) : [toFont$1(optFont)];
|
|
17149
|
+
const fonts = toFonts(options);
|
|
17087
17150
|
const strokeWidth = options.textStrokeWidth;
|
|
17088
17151
|
const lines = isArray$1(content) ? content : [content];
|
|
17089
17152
|
const mapKey = lines.join() + fontsKey(fonts) + strokeWidth + (ctx._measureText ? "-spriting" : "");
|
|
@@ -17114,7 +17177,7 @@ function drawBox(ctx, rect, options) {
|
|
|
17114
17177
|
}
|
|
17115
17178
|
ctx.restore();
|
|
17116
17179
|
}
|
|
17117
|
-
function drawLabel(ctx, rect, options) {
|
|
17180
|
+
function drawLabel(ctx, rect, options, fitRatio) {
|
|
17118
17181
|
const content = options.content;
|
|
17119
17182
|
if (isImageOrCanvas(content)) {
|
|
17120
17183
|
ctx.save();
|
|
@@ -17124,8 +17187,7 @@ function drawLabel(ctx, rect, options) {
|
|
|
17124
17187
|
return;
|
|
17125
17188
|
}
|
|
17126
17189
|
const labels = isArray$1(content) ? content : [content];
|
|
17127
|
-
const
|
|
17128
|
-
const fonts = isArray$1(optFont) ? optFont.map((f2) => toFont$1(f2)) : [toFont$1(optFont)];
|
|
17190
|
+
const fonts = toFonts(options, fitRatio);
|
|
17129
17191
|
const optColor = options.color;
|
|
17130
17192
|
const colors2 = isArray$1(optColor) ? optColor : [optColor];
|
|
17131
17193
|
const x2 = calculateTextAlignment(rect, options);
|
|
@@ -17292,6 +17354,118 @@ function getOpacity(value, elementValue) {
|
|
|
17292
17354
|
const opacity = isNumber$1(value) ? value : elementValue;
|
|
17293
17355
|
return isNumber$1(opacity) ? clamp(opacity, 0, 1) : 1;
|
|
17294
17356
|
}
|
|
17357
|
+
const positions$1 = ["left", "bottom", "top", "right"];
|
|
17358
|
+
function drawCallout(ctx, element) {
|
|
17359
|
+
const { pointX, pointY, options } = element;
|
|
17360
|
+
const callout = options.callout;
|
|
17361
|
+
const calloutPosition = callout && callout.display && resolveCalloutPosition(element, callout);
|
|
17362
|
+
if (!calloutPosition || isPointInRange(element, callout, calloutPosition)) {
|
|
17363
|
+
return;
|
|
17364
|
+
}
|
|
17365
|
+
ctx.save();
|
|
17366
|
+
ctx.beginPath();
|
|
17367
|
+
const stroke = setBorderStyle(ctx, callout);
|
|
17368
|
+
if (!stroke) {
|
|
17369
|
+
return ctx.restore();
|
|
17370
|
+
}
|
|
17371
|
+
const { separatorStart, separatorEnd } = getCalloutSeparatorCoord(element, calloutPosition);
|
|
17372
|
+
const { sideStart, sideEnd } = getCalloutSideCoord(element, calloutPosition, separatorStart);
|
|
17373
|
+
if (callout.margin > 0 || options.borderWidth === 0) {
|
|
17374
|
+
ctx.moveTo(separatorStart.x, separatorStart.y);
|
|
17375
|
+
ctx.lineTo(separatorEnd.x, separatorEnd.y);
|
|
17376
|
+
}
|
|
17377
|
+
ctx.moveTo(sideStart.x, sideStart.y);
|
|
17378
|
+
ctx.lineTo(sideEnd.x, sideEnd.y);
|
|
17379
|
+
const rotatedPoint = rotated({ x: pointX, y: pointY }, element.getCenterPoint(), toRadians$1(-element.rotation));
|
|
17380
|
+
ctx.lineTo(rotatedPoint.x, rotatedPoint.y);
|
|
17381
|
+
ctx.stroke();
|
|
17382
|
+
ctx.restore();
|
|
17383
|
+
}
|
|
17384
|
+
function getCalloutSeparatorCoord(element, position) {
|
|
17385
|
+
const { x: x2, y: y2, x2: x22, y2: y22 } = element;
|
|
17386
|
+
const adjust = getCalloutSeparatorAdjust(element, position);
|
|
17387
|
+
let separatorStart, separatorEnd;
|
|
17388
|
+
if (position === "left" || position === "right") {
|
|
17389
|
+
separatorStart = { x: x2 + adjust, y: y2 };
|
|
17390
|
+
separatorEnd = { x: separatorStart.x, y: y22 };
|
|
17391
|
+
} else {
|
|
17392
|
+
separatorStart = { x: x2, y: y2 + adjust };
|
|
17393
|
+
separatorEnd = { x: x22, y: separatorStart.y };
|
|
17394
|
+
}
|
|
17395
|
+
return { separatorStart, separatorEnd };
|
|
17396
|
+
}
|
|
17397
|
+
function getCalloutSeparatorAdjust(element, position) {
|
|
17398
|
+
const { width, height, options } = element;
|
|
17399
|
+
const adjust = options.callout.margin + options.borderWidth / 2;
|
|
17400
|
+
if (position === "right") {
|
|
17401
|
+
return width + adjust;
|
|
17402
|
+
} else if (position === "bottom") {
|
|
17403
|
+
return height + adjust;
|
|
17404
|
+
}
|
|
17405
|
+
return -adjust;
|
|
17406
|
+
}
|
|
17407
|
+
function getCalloutSideCoord(element, position, separatorStart) {
|
|
17408
|
+
const { y: y2, width, height, options } = element;
|
|
17409
|
+
const start = options.callout.start;
|
|
17410
|
+
const side = getCalloutSideAdjust(position, options.callout);
|
|
17411
|
+
let sideStart, sideEnd;
|
|
17412
|
+
if (position === "left" || position === "right") {
|
|
17413
|
+
sideStart = { x: separatorStart.x, y: y2 + getSize(height, start) };
|
|
17414
|
+
sideEnd = { x: sideStart.x + side, y: sideStart.y };
|
|
17415
|
+
} else {
|
|
17416
|
+
sideStart = { x: separatorStart.x + getSize(width, start), y: separatorStart.y };
|
|
17417
|
+
sideEnd = { x: sideStart.x, y: sideStart.y + side };
|
|
17418
|
+
}
|
|
17419
|
+
return { sideStart, sideEnd };
|
|
17420
|
+
}
|
|
17421
|
+
function getCalloutSideAdjust(position, options) {
|
|
17422
|
+
const side = options.side;
|
|
17423
|
+
if (position === "left" || position === "top") {
|
|
17424
|
+
return -side;
|
|
17425
|
+
}
|
|
17426
|
+
return side;
|
|
17427
|
+
}
|
|
17428
|
+
function resolveCalloutPosition(element, options) {
|
|
17429
|
+
const position = options.position;
|
|
17430
|
+
if (positions$1.includes(position)) {
|
|
17431
|
+
return position;
|
|
17432
|
+
}
|
|
17433
|
+
return resolveCalloutAutoPosition(element, options);
|
|
17434
|
+
}
|
|
17435
|
+
function resolveCalloutAutoPosition(element, options) {
|
|
17436
|
+
const { x: x2, y: y2, x2: x22, y2: y22, width, height, pointX, pointY, centerX, centerY, rotation } = element;
|
|
17437
|
+
const center = { x: centerX, y: centerY };
|
|
17438
|
+
const start = options.start;
|
|
17439
|
+
const xAdjust = getSize(width, start);
|
|
17440
|
+
const yAdjust = getSize(height, start);
|
|
17441
|
+
const xPoints = [x2, x2 + xAdjust, x2 + xAdjust, x22];
|
|
17442
|
+
const yPoints = [y2 + yAdjust, y22, y2, y22];
|
|
17443
|
+
const result = [];
|
|
17444
|
+
for (let index2 = 0; index2 < 4; index2++) {
|
|
17445
|
+
const rotatedPoint = rotated({ x: xPoints[index2], y: yPoints[index2] }, center, toRadians$1(rotation));
|
|
17446
|
+
result.push({
|
|
17447
|
+
position: positions$1[index2],
|
|
17448
|
+
distance: distanceBetweenPoints$1(rotatedPoint, { x: pointX, y: pointY })
|
|
17449
|
+
});
|
|
17450
|
+
}
|
|
17451
|
+
return result.sort((a2, b2) => a2.distance - b2.distance)[0].position;
|
|
17452
|
+
}
|
|
17453
|
+
function isPointInRange(element, callout, position) {
|
|
17454
|
+
const { pointX, pointY } = element;
|
|
17455
|
+
const margin = callout.margin;
|
|
17456
|
+
let x2 = pointX;
|
|
17457
|
+
let y2 = pointY;
|
|
17458
|
+
if (position === "left") {
|
|
17459
|
+
x2 += margin;
|
|
17460
|
+
} else if (position === "right") {
|
|
17461
|
+
x2 -= margin;
|
|
17462
|
+
} else if (position === "top") {
|
|
17463
|
+
y2 += margin;
|
|
17464
|
+
} else if (position === "bottom") {
|
|
17465
|
+
y2 -= margin;
|
|
17466
|
+
}
|
|
17467
|
+
return element.inRange(x2, y2);
|
|
17468
|
+
}
|
|
17295
17469
|
const limitedLineScale = {
|
|
17296
17470
|
xScaleID: { min: "xMin", max: "xMax", start: "left", end: "right", startProp: "x", endProp: "x2" },
|
|
17297
17471
|
yScaleID: { min: "yMin", max: "yMax", start: "bottom", end: "top", startProp: "y", endProp: "y2" }
|
|
@@ -17456,7 +17630,7 @@ function resolveLimitedLineProperties(scales, area, options) {
|
|
|
17456
17630
|
}
|
|
17457
17631
|
function calculateX({ properties, options }, labelSize, position, padding) {
|
|
17458
17632
|
const { x: start, x2: end, width: size } = properties;
|
|
17459
|
-
return calculatePosition
|
|
17633
|
+
return calculatePosition({ start, end, size, borderWidth: options.borderWidth }, {
|
|
17460
17634
|
position: position.x,
|
|
17461
17635
|
padding: { start: padding.left, end: padding.right },
|
|
17462
17636
|
adjust: options.label.xAdjust,
|
|
@@ -17465,14 +17639,14 @@ function calculateX({ properties, options }, labelSize, position, padding) {
|
|
|
17465
17639
|
}
|
|
17466
17640
|
function calculateY({ properties, options }, labelSize, position, padding) {
|
|
17467
17641
|
const { y: start, y2: end, height: size } = properties;
|
|
17468
|
-
return calculatePosition
|
|
17642
|
+
return calculatePosition({ start, end, size, borderWidth: options.borderWidth }, {
|
|
17469
17643
|
position: position.y,
|
|
17470
17644
|
padding: { start: padding.top, end: padding.bottom },
|
|
17471
17645
|
adjust: options.label.yAdjust,
|
|
17472
17646
|
size: labelSize.height
|
|
17473
17647
|
});
|
|
17474
17648
|
}
|
|
17475
|
-
function calculatePosition
|
|
17649
|
+
function calculatePosition(boxOpts, labelOpts) {
|
|
17476
17650
|
const { start, end, borderWidth } = boxOpts;
|
|
17477
17651
|
const { position, padding: { start: padStart, end: padEnd }, adjust } = labelOpts;
|
|
17478
17652
|
const availableSize = end - borderWidth - start - padStart - padEnd - labelOpts.size;
|
|
@@ -17501,22 +17675,11 @@ function resolveLabelElementProperties$1(chart2, properties, options) {
|
|
|
17501
17675
|
rotation: label.rotation
|
|
17502
17676
|
};
|
|
17503
17677
|
}
|
|
17504
|
-
function rotated(point, center, angle) {
|
|
17505
|
-
const cos = Math.cos(angle);
|
|
17506
|
-
const sin = Math.sin(angle);
|
|
17507
|
-
const cx2 = center.x;
|
|
17508
|
-
const cy = center.y;
|
|
17509
|
-
return {
|
|
17510
|
-
x: cx2 + cos * (point.x - cx2) - sin * (point.y - cy),
|
|
17511
|
-
y: cy + sin * (point.x - cx2) + cos * (point.y - cy)
|
|
17512
|
-
};
|
|
17513
|
-
}
|
|
17514
17678
|
const moveHooks = ["enter", "leave"];
|
|
17515
17679
|
const eventHooks = moveHooks.concat("click");
|
|
17516
17680
|
function updateListeners(chart2, state, options) {
|
|
17517
17681
|
state.listened = loadHooks(options, eventHooks, state.listeners);
|
|
17518
17682
|
state.moveListened = false;
|
|
17519
|
-
state._getElements = getElements;
|
|
17520
17683
|
moveHooks.forEach((hook) => {
|
|
17521
17684
|
if (isFunction$1(options[hook])) {
|
|
17522
17685
|
state.moveListened = true;
|
|
@@ -17555,7 +17718,7 @@ function handleMoveEvents(state, event, options) {
|
|
|
17555
17718
|
}
|
|
17556
17719
|
let elements;
|
|
17557
17720
|
if (event.type === "mousemove") {
|
|
17558
|
-
elements = getElements(state, event, options.interaction);
|
|
17721
|
+
elements = getElements(state.visibleElements, event, options.interaction);
|
|
17559
17722
|
} else {
|
|
17560
17723
|
elements = [];
|
|
17561
17724
|
}
|
|
@@ -17576,7 +17739,7 @@ function dispatchMoveEvents({ state, event }, hook, elements, checkElements) {
|
|
|
17576
17739
|
}
|
|
17577
17740
|
function handleClickEvents(state, event, options) {
|
|
17578
17741
|
const listeners = state.listeners;
|
|
17579
|
-
const elements = getElements(state, event, options.interaction);
|
|
17742
|
+
const elements = getElements(state.visibleElements, event, options.interaction);
|
|
17580
17743
|
let changed;
|
|
17581
17744
|
for (const element of elements) {
|
|
17582
17745
|
changed = dispatchEvent(element.options.click || listeners.click, element, event) || changed;
|
|
@@ -17681,7 +17844,7 @@ function updateLimits$1(annotation2, scale, props, limits) {
|
|
|
17681
17844
|
class BoxAnnotation extends Element$2 {
|
|
17682
17845
|
inRange(mouseX, mouseY, axis, useFinalPosition) {
|
|
17683
17846
|
const { x: x2, y: y2 } = rotated({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), toRadians$1(-this.options.rotation));
|
|
17684
|
-
return inBoxRange({ x: x2, y: y2 }, this.getProps(["x", "y", "x2", "y2"], useFinalPosition), axis, this.options
|
|
17847
|
+
return inBoxRange({ x: x2, y: y2 }, this.getProps(["x", "y", "x2", "y2"], useFinalPosition), axis, this.options);
|
|
17685
17848
|
}
|
|
17686
17849
|
getCenterPoint(useFinalPosition) {
|
|
17687
17850
|
return getElementCenterPoint(this, useFinalPosition);
|
|
@@ -17712,6 +17875,7 @@ BoxAnnotation.defaults = {
|
|
|
17712
17875
|
borderWidth: 1,
|
|
17713
17876
|
display: true,
|
|
17714
17877
|
init: void 0,
|
|
17878
|
+
hitTolerance: 0,
|
|
17715
17879
|
label: {
|
|
17716
17880
|
backgroundColor: "transparent",
|
|
17717
17881
|
borderWidth: 0,
|
|
@@ -17730,6 +17894,7 @@ BoxAnnotation.defaults = {
|
|
|
17730
17894
|
weight: "bold"
|
|
17731
17895
|
},
|
|
17732
17896
|
height: void 0,
|
|
17897
|
+
hitTolerance: void 0,
|
|
17733
17898
|
opacity: void 0,
|
|
17734
17899
|
padding: 6,
|
|
17735
17900
|
position: "center",
|
|
@@ -17763,11 +17928,188 @@ BoxAnnotation.descriptors = {
|
|
|
17763
17928
|
_fallback: true
|
|
17764
17929
|
}
|
|
17765
17930
|
};
|
|
17766
|
-
|
|
17931
|
+
class DoughnutLabelAnnotation extends Element$2 {
|
|
17932
|
+
inRange(mouseX, mouseY, axis, useFinalPosition) {
|
|
17933
|
+
return inLabelRange(
|
|
17934
|
+
{ x: mouseX, y: mouseY },
|
|
17935
|
+
{ rect: this.getProps(["x", "y", "x2", "y2"], useFinalPosition), center: this.getCenterPoint(useFinalPosition) },
|
|
17936
|
+
axis,
|
|
17937
|
+
{ rotation: this.rotation, borderWidth: 0, hitTolerance: this.options.hitTolerance }
|
|
17938
|
+
);
|
|
17939
|
+
}
|
|
17940
|
+
getCenterPoint(useFinalPosition) {
|
|
17941
|
+
return getElementCenterPoint(this, useFinalPosition);
|
|
17942
|
+
}
|
|
17943
|
+
draw(ctx) {
|
|
17944
|
+
const options = this.options;
|
|
17945
|
+
if (!options.display || !options.content) {
|
|
17946
|
+
return;
|
|
17947
|
+
}
|
|
17948
|
+
drawBackground(ctx, this);
|
|
17949
|
+
ctx.save();
|
|
17950
|
+
translate(ctx, this.getCenterPoint(), this.rotation);
|
|
17951
|
+
drawLabel(ctx, this, options, this._fitRatio);
|
|
17952
|
+
ctx.restore();
|
|
17953
|
+
}
|
|
17954
|
+
resolveElementProperties(chart2, options) {
|
|
17955
|
+
const meta = getDatasetMeta(chart2, options);
|
|
17956
|
+
if (!meta) {
|
|
17957
|
+
return {};
|
|
17958
|
+
}
|
|
17959
|
+
const { controllerMeta, point, radius } = getControllerMeta(chart2, options, meta);
|
|
17960
|
+
let labelSize = measureLabelSize$1(chart2.ctx, options);
|
|
17961
|
+
const _fitRatio = getFitRatio(labelSize, radius);
|
|
17962
|
+
if (shouldFit(options, _fitRatio)) {
|
|
17963
|
+
labelSize = { width: labelSize.width * _fitRatio, height: labelSize.height * _fitRatio };
|
|
17964
|
+
}
|
|
17965
|
+
const { position, xAdjust, yAdjust } = options;
|
|
17966
|
+
const boxSize = measureLabelRectangle(point, labelSize, { borderWidth: 0, position, xAdjust, yAdjust });
|
|
17967
|
+
return {
|
|
17968
|
+
initProperties: initAnimationProperties(chart2, boxSize, options),
|
|
17969
|
+
...boxSize,
|
|
17970
|
+
...controllerMeta,
|
|
17971
|
+
rotation: options.rotation,
|
|
17972
|
+
_fitRatio
|
|
17973
|
+
};
|
|
17974
|
+
}
|
|
17975
|
+
}
|
|
17976
|
+
DoughnutLabelAnnotation.id = "doughnutLabelAnnotation";
|
|
17977
|
+
DoughnutLabelAnnotation.defaults = {
|
|
17978
|
+
autoFit: true,
|
|
17979
|
+
autoHide: true,
|
|
17980
|
+
backgroundColor: "transparent",
|
|
17981
|
+
backgroundShadowColor: "transparent",
|
|
17982
|
+
borderColor: "transparent",
|
|
17983
|
+
borderDash: [],
|
|
17984
|
+
borderDashOffset: 0,
|
|
17985
|
+
borderJoinStyle: "miter",
|
|
17986
|
+
borderShadowColor: "transparent",
|
|
17987
|
+
borderWidth: 0,
|
|
17988
|
+
color: "black",
|
|
17989
|
+
content: null,
|
|
17990
|
+
display: true,
|
|
17991
|
+
font: {
|
|
17992
|
+
family: void 0,
|
|
17993
|
+
lineHeight: void 0,
|
|
17994
|
+
size: void 0,
|
|
17995
|
+
style: void 0,
|
|
17996
|
+
weight: void 0
|
|
17997
|
+
},
|
|
17998
|
+
height: void 0,
|
|
17999
|
+
hitTolerance: 0,
|
|
18000
|
+
init: void 0,
|
|
18001
|
+
opacity: void 0,
|
|
18002
|
+
position: "center",
|
|
18003
|
+
rotation: 0,
|
|
18004
|
+
shadowBlur: 0,
|
|
18005
|
+
shadowOffsetX: 0,
|
|
18006
|
+
shadowOffsetY: 0,
|
|
18007
|
+
spacing: 1,
|
|
18008
|
+
textAlign: "center",
|
|
18009
|
+
textStrokeColor: void 0,
|
|
18010
|
+
textStrokeWidth: 0,
|
|
18011
|
+
width: void 0,
|
|
18012
|
+
xAdjust: 0,
|
|
18013
|
+
yAdjust: 0
|
|
18014
|
+
};
|
|
18015
|
+
DoughnutLabelAnnotation.defaultRoutes = {};
|
|
18016
|
+
function getDatasetMeta(chart2, options) {
|
|
18017
|
+
return chart2.getSortedVisibleDatasetMetas().reduce(function(result, value) {
|
|
18018
|
+
const controller = value.controller;
|
|
18019
|
+
if (controller instanceof DoughnutController$1 && isControllerVisible(chart2, options, value.data) && (!result || controller.innerRadius < result.controller.innerRadius) && controller.options.circumference >= 90) {
|
|
18020
|
+
return value;
|
|
18021
|
+
}
|
|
18022
|
+
return result;
|
|
18023
|
+
}, void 0);
|
|
18024
|
+
}
|
|
18025
|
+
function isControllerVisible(chart2, options, elements) {
|
|
18026
|
+
if (!options.autoHide) {
|
|
18027
|
+
return true;
|
|
18028
|
+
}
|
|
18029
|
+
for (let i2 = 0; i2 < elements.length; i2++) {
|
|
18030
|
+
if (!elements[i2].hidden && chart2.getDataVisibility(i2)) {
|
|
18031
|
+
return true;
|
|
18032
|
+
}
|
|
18033
|
+
}
|
|
18034
|
+
}
|
|
18035
|
+
function getControllerMeta({ chartArea }, options, meta) {
|
|
18036
|
+
const { left: left2, top: top2, right: right2, bottom: bottom2 } = chartArea;
|
|
18037
|
+
const { innerRadius, offsetX, offsetY } = meta.controller;
|
|
18038
|
+
const x2 = (left2 + right2) / 2 + offsetX;
|
|
18039
|
+
const y2 = (top2 + bottom2) / 2 + offsetY;
|
|
18040
|
+
const square = {
|
|
18041
|
+
left: Math.max(x2 - innerRadius, left2),
|
|
18042
|
+
right: Math.min(x2 + innerRadius, right2),
|
|
18043
|
+
top: Math.max(y2 - innerRadius, top2),
|
|
18044
|
+
bottom: Math.min(y2 + innerRadius, bottom2)
|
|
18045
|
+
};
|
|
18046
|
+
const point = {
|
|
18047
|
+
x: (square.left + square.right) / 2,
|
|
18048
|
+
y: (square.top + square.bottom) / 2
|
|
18049
|
+
};
|
|
18050
|
+
const space = options.spacing + options.borderWidth / 2;
|
|
18051
|
+
const _radius = innerRadius - space;
|
|
18052
|
+
const _counterclockwise = point.y > y2;
|
|
18053
|
+
const side = _counterclockwise ? top2 + space : bottom2 - space;
|
|
18054
|
+
const angles = getAngles(side, x2, y2, _radius);
|
|
18055
|
+
const controllerMeta = {
|
|
18056
|
+
_centerX: x2,
|
|
18057
|
+
_centerY: y2,
|
|
18058
|
+
_radius,
|
|
18059
|
+
_counterclockwise,
|
|
18060
|
+
...angles
|
|
18061
|
+
};
|
|
18062
|
+
return {
|
|
18063
|
+
controllerMeta,
|
|
18064
|
+
point,
|
|
18065
|
+
radius: Math.min(innerRadius, Math.min(square.right - square.left, square.bottom - square.top) / 2)
|
|
18066
|
+
};
|
|
18067
|
+
}
|
|
18068
|
+
function getFitRatio({ width, height }, radius) {
|
|
18069
|
+
const hypo = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2));
|
|
18070
|
+
return radius * 2 / hypo;
|
|
18071
|
+
}
|
|
18072
|
+
function getAngles(y2, centerX, centerY, radius) {
|
|
18073
|
+
const yk2 = Math.pow(centerY - y2, 2);
|
|
18074
|
+
const r2 = Math.pow(radius, 2);
|
|
18075
|
+
const b2 = centerX * -2;
|
|
18076
|
+
const c2 = Math.pow(centerX, 2) + yk2 - r2;
|
|
18077
|
+
const delta = Math.pow(b2, 2) - 4 * c2;
|
|
18078
|
+
if (delta <= 0) {
|
|
18079
|
+
return {
|
|
18080
|
+
_startAngle: 0,
|
|
18081
|
+
_endAngle: TAU$1
|
|
18082
|
+
};
|
|
18083
|
+
}
|
|
18084
|
+
const start = (-b2 - Math.sqrt(delta)) / 2;
|
|
18085
|
+
const end = (-b2 + Math.sqrt(delta)) / 2;
|
|
18086
|
+
return {
|
|
18087
|
+
_startAngle: getAngleFromPoint$1({ x: centerX, y: centerY }, { x: start, y: y2 }).angle,
|
|
18088
|
+
_endAngle: getAngleFromPoint$1({ x: centerX, y: centerY }, { x: end, y: y2 }).angle
|
|
18089
|
+
};
|
|
18090
|
+
}
|
|
18091
|
+
function drawBackground(ctx, element) {
|
|
18092
|
+
const { _centerX, _centerY, _radius, _startAngle, _endAngle, _counterclockwise, options } = element;
|
|
18093
|
+
ctx.save();
|
|
18094
|
+
const stroke = setBorderStyle(ctx, options);
|
|
18095
|
+
ctx.fillStyle = options.backgroundColor;
|
|
18096
|
+
ctx.beginPath();
|
|
18097
|
+
ctx.arc(_centerX, _centerY, _radius, _startAngle, _endAngle, _counterclockwise);
|
|
18098
|
+
ctx.closePath();
|
|
18099
|
+
ctx.fill();
|
|
18100
|
+
if (stroke) {
|
|
18101
|
+
ctx.stroke();
|
|
18102
|
+
}
|
|
18103
|
+
ctx.restore();
|
|
18104
|
+
}
|
|
17767
18105
|
class LabelAnnotation extends Element$2 {
|
|
17768
18106
|
inRange(mouseX, mouseY, axis, useFinalPosition) {
|
|
17769
|
-
|
|
17770
|
-
|
|
18107
|
+
return inLabelRange(
|
|
18108
|
+
{ x: mouseX, y: mouseY },
|
|
18109
|
+
{ rect: this.getProps(["x", "y", "x2", "y2"], useFinalPosition), center: this.getCenterPoint(useFinalPosition) },
|
|
18110
|
+
axis,
|
|
18111
|
+
{ rotation: this.rotation, borderWidth: this.options.borderWidth, hitTolerance: this.options.hitTolerance }
|
|
18112
|
+
);
|
|
17771
18113
|
}
|
|
17772
18114
|
getCenterPoint(useFinalPosition) {
|
|
17773
18115
|
return getElementCenterPoint(this, useFinalPosition);
|
|
@@ -17795,7 +18137,7 @@ class LabelAnnotation extends Element$2 {
|
|
|
17795
18137
|
}
|
|
17796
18138
|
const padding = toPadding$1(options.padding);
|
|
17797
18139
|
const labelSize = measureLabelSize$1(chart2.ctx, options);
|
|
17798
|
-
const boxSize =
|
|
18140
|
+
const boxSize = measureLabelRectangle(point, labelSize, options, padding);
|
|
17799
18141
|
return {
|
|
17800
18142
|
initProperties: initAnimationProperties(chart2, boxSize, options),
|
|
17801
18143
|
pointX: point.x,
|
|
@@ -17841,6 +18183,7 @@ LabelAnnotation.defaults = {
|
|
|
17841
18183
|
weight: void 0
|
|
17842
18184
|
},
|
|
17843
18185
|
height: void 0,
|
|
18186
|
+
hitTolerance: 0,
|
|
17844
18187
|
init: void 0,
|
|
17845
18188
|
opacity: void 0,
|
|
17846
18189
|
padding: 6,
|
|
@@ -17868,121 +18211,6 @@ LabelAnnotation.defaults = {
|
|
|
17868
18211
|
LabelAnnotation.defaultRoutes = {
|
|
17869
18212
|
borderColor: "color"
|
|
17870
18213
|
};
|
|
17871
|
-
function measureRect(point, size, options, padding) {
|
|
17872
|
-
const width = size.width + padding.width + options.borderWidth;
|
|
17873
|
-
const height = size.height + padding.height + options.borderWidth;
|
|
17874
|
-
const position = toPosition(options.position, "center");
|
|
17875
|
-
const x2 = calculatePosition(point.x, width, options.xAdjust, position.x);
|
|
17876
|
-
const y2 = calculatePosition(point.y, height, options.yAdjust, position.y);
|
|
17877
|
-
return {
|
|
17878
|
-
x: x2,
|
|
17879
|
-
y: y2,
|
|
17880
|
-
x2: x2 + width,
|
|
17881
|
-
y2: y2 + height,
|
|
17882
|
-
width,
|
|
17883
|
-
height,
|
|
17884
|
-
centerX: x2 + width / 2,
|
|
17885
|
-
centerY: y2 + height / 2
|
|
17886
|
-
};
|
|
17887
|
-
}
|
|
17888
|
-
function calculatePosition(start, size, adjust = 0, position) {
|
|
17889
|
-
return start - getRelativePosition$1(size, position) + adjust;
|
|
17890
|
-
}
|
|
17891
|
-
function drawCallout(ctx, element) {
|
|
17892
|
-
const { pointX, pointY, options } = element;
|
|
17893
|
-
const callout = options.callout;
|
|
17894
|
-
const calloutPosition = callout && callout.display && resolveCalloutPosition(element, callout);
|
|
17895
|
-
if (!calloutPosition || isPointInRange(element, callout, calloutPosition)) {
|
|
17896
|
-
return;
|
|
17897
|
-
}
|
|
17898
|
-
ctx.save();
|
|
17899
|
-
ctx.beginPath();
|
|
17900
|
-
const stroke = setBorderStyle(ctx, callout);
|
|
17901
|
-
if (!stroke) {
|
|
17902
|
-
return ctx.restore();
|
|
17903
|
-
}
|
|
17904
|
-
const { separatorStart, separatorEnd } = getCalloutSeparatorCoord(element, calloutPosition);
|
|
17905
|
-
const { sideStart, sideEnd } = getCalloutSideCoord(element, calloutPosition, separatorStart);
|
|
17906
|
-
if (callout.margin > 0 || options.borderWidth === 0) {
|
|
17907
|
-
ctx.moveTo(separatorStart.x, separatorStart.y);
|
|
17908
|
-
ctx.lineTo(separatorEnd.x, separatorEnd.y);
|
|
17909
|
-
}
|
|
17910
|
-
ctx.moveTo(sideStart.x, sideStart.y);
|
|
17911
|
-
ctx.lineTo(sideEnd.x, sideEnd.y);
|
|
17912
|
-
const rotatedPoint = rotated({ x: pointX, y: pointY }, element.getCenterPoint(), toRadians$1(-element.rotation));
|
|
17913
|
-
ctx.lineTo(rotatedPoint.x, rotatedPoint.y);
|
|
17914
|
-
ctx.stroke();
|
|
17915
|
-
ctx.restore();
|
|
17916
|
-
}
|
|
17917
|
-
function getCalloutSeparatorCoord(element, position) {
|
|
17918
|
-
const { x: x2, y: y2, x2: x22, y2: y22 } = element;
|
|
17919
|
-
const adjust = getCalloutSeparatorAdjust(element, position);
|
|
17920
|
-
let separatorStart, separatorEnd;
|
|
17921
|
-
if (position === "left" || position === "right") {
|
|
17922
|
-
separatorStart = { x: x2 + adjust, y: y2 };
|
|
17923
|
-
separatorEnd = { x: separatorStart.x, y: y22 };
|
|
17924
|
-
} else {
|
|
17925
|
-
separatorStart = { x: x2, y: y2 + adjust };
|
|
17926
|
-
separatorEnd = { x: x22, y: separatorStart.y };
|
|
17927
|
-
}
|
|
17928
|
-
return { separatorStart, separatorEnd };
|
|
17929
|
-
}
|
|
17930
|
-
function getCalloutSeparatorAdjust(element, position) {
|
|
17931
|
-
const { width, height, options } = element;
|
|
17932
|
-
const adjust = options.callout.margin + options.borderWidth / 2;
|
|
17933
|
-
if (position === "right") {
|
|
17934
|
-
return width + adjust;
|
|
17935
|
-
} else if (position === "bottom") {
|
|
17936
|
-
return height + adjust;
|
|
17937
|
-
}
|
|
17938
|
-
return -adjust;
|
|
17939
|
-
}
|
|
17940
|
-
function getCalloutSideCoord(element, position, separatorStart) {
|
|
17941
|
-
const { y: y2, width, height, options } = element;
|
|
17942
|
-
const start = options.callout.start;
|
|
17943
|
-
const side = getCalloutSideAdjust(position, options.callout);
|
|
17944
|
-
let sideStart, sideEnd;
|
|
17945
|
-
if (position === "left" || position === "right") {
|
|
17946
|
-
sideStart = { x: separatorStart.x, y: y2 + getSize(height, start) };
|
|
17947
|
-
sideEnd = { x: sideStart.x + side, y: sideStart.y };
|
|
17948
|
-
} else {
|
|
17949
|
-
sideStart = { x: separatorStart.x + getSize(width, start), y: separatorStart.y };
|
|
17950
|
-
sideEnd = { x: sideStart.x, y: sideStart.y + side };
|
|
17951
|
-
}
|
|
17952
|
-
return { sideStart, sideEnd };
|
|
17953
|
-
}
|
|
17954
|
-
function getCalloutSideAdjust(position, options) {
|
|
17955
|
-
const side = options.side;
|
|
17956
|
-
if (position === "left" || position === "top") {
|
|
17957
|
-
return -side;
|
|
17958
|
-
}
|
|
17959
|
-
return side;
|
|
17960
|
-
}
|
|
17961
|
-
function resolveCalloutPosition(element, options) {
|
|
17962
|
-
const position = options.position;
|
|
17963
|
-
if (positions$1.includes(position)) {
|
|
17964
|
-
return position;
|
|
17965
|
-
}
|
|
17966
|
-
return resolveCalloutAutoPosition(element, options);
|
|
17967
|
-
}
|
|
17968
|
-
function resolveCalloutAutoPosition(element, options) {
|
|
17969
|
-
const { x: x2, y: y2, x2: x22, y2: y22, width, height, pointX, pointY, centerX, centerY, rotation } = element;
|
|
17970
|
-
const center = { x: centerX, y: centerY };
|
|
17971
|
-
const start = options.start;
|
|
17972
|
-
const xAdjust = getSize(width, start);
|
|
17973
|
-
const yAdjust = getSize(height, start);
|
|
17974
|
-
const xPoints = [x2, x2 + xAdjust, x2 + xAdjust, x22];
|
|
17975
|
-
const yPoints = [y2 + yAdjust, y22, y2, y22];
|
|
17976
|
-
const result = [];
|
|
17977
|
-
for (let index2 = 0; index2 < 4; index2++) {
|
|
17978
|
-
const rotatedPoint = rotated({ x: xPoints[index2], y: yPoints[index2] }, center, toRadians$1(rotation));
|
|
17979
|
-
result.push({
|
|
17980
|
-
position: positions$1[index2],
|
|
17981
|
-
distance: distanceBetweenPoints$1(rotatedPoint, { x: pointX, y: pointY })
|
|
17982
|
-
});
|
|
17983
|
-
}
|
|
17984
|
-
return result.sort((a2, b2) => a2.distance - b2.distance)[0].position;
|
|
17985
|
-
}
|
|
17986
18214
|
function getLabelSize({ x: x2, y: y2, width, height, options }) {
|
|
17987
18215
|
const hBorderWidth = options.borderWidth / 2;
|
|
17988
18216
|
const padding = toPadding$1(options.padding);
|
|
@@ -17993,22 +18221,6 @@ function getLabelSize({ x: x2, y: y2, width, height, options }) {
|
|
|
17993
18221
|
height: height - padding.top - padding.bottom - options.borderWidth
|
|
17994
18222
|
};
|
|
17995
18223
|
}
|
|
17996
|
-
function isPointInRange(element, callout, position) {
|
|
17997
|
-
const { pointX, pointY } = element;
|
|
17998
|
-
const margin = callout.margin;
|
|
17999
|
-
let x2 = pointX;
|
|
18000
|
-
let y2 = pointY;
|
|
18001
|
-
if (position === "left") {
|
|
18002
|
-
x2 += margin;
|
|
18003
|
-
} else if (position === "right") {
|
|
18004
|
-
x2 -= margin;
|
|
18005
|
-
} else if (position === "top") {
|
|
18006
|
-
y2 += margin;
|
|
18007
|
-
} else if (position === "bottom") {
|
|
18008
|
-
y2 -= margin;
|
|
18009
|
-
}
|
|
18010
|
-
return element.inRange(x2, y2);
|
|
18011
|
-
}
|
|
18012
18224
|
const pointInLine = (p1, p2, t) => ({ x: p1.x + t * (p2.x - p1.x), y: p1.y + t * (p2.y - p1.y) });
|
|
18013
18225
|
const interpolateX = (y2, p1, p2) => pointInLine(p1, p2, Math.abs((y2 - p1.y) / (p2.y - p1.y))).x;
|
|
18014
18226
|
const interpolateY = (x2, p1, p2) => pointInLine(p1, p2, Math.abs((x2 - p1.x) / (p2.x - p1.x))).y;
|
|
@@ -18020,12 +18232,13 @@ const coordAngleInCurve = (start, cp, end, t) => 2 * (1 - t) * (cp - start) + 2
|
|
|
18020
18232
|
const angleInCurve = (start, cp, end, t) => -Math.atan2(coordAngleInCurve(start.x, cp.x, end.x, t), coordAngleInCurve(start.y, cp.y, end.y, t)) + 0.5 * PI$1;
|
|
18021
18233
|
class LineAnnotation extends Element$2 {
|
|
18022
18234
|
inRange(mouseX, mouseY, axis, useFinalPosition) {
|
|
18023
|
-
const
|
|
18235
|
+
const hitSize = (this.options.borderWidth + this.options.hitTolerance) / 2;
|
|
18024
18236
|
if (axis !== "x" && axis !== "y") {
|
|
18025
18237
|
const point = { mouseX, mouseY };
|
|
18026
18238
|
const { path, ctx } = this;
|
|
18027
18239
|
if (path) {
|
|
18028
18240
|
setBorderStyle(ctx, this.options);
|
|
18241
|
+
ctx.lineWidth += this.options.hitTolerance;
|
|
18029
18242
|
const { chart: chart2 } = this.$context;
|
|
18030
18243
|
const mx = mouseX * chart2.currentDevicePixelRatio;
|
|
18031
18244
|
const my = mouseY * chart2.currentDevicePixelRatio;
|
|
@@ -18033,10 +18246,10 @@ class LineAnnotation extends Element$2 {
|
|
|
18033
18246
|
ctx.restore();
|
|
18034
18247
|
return result;
|
|
18035
18248
|
}
|
|
18036
|
-
const epsilon = sqr(
|
|
18249
|
+
const epsilon = sqr(hitSize);
|
|
18037
18250
|
return intersects(this, point, epsilon, useFinalPosition) || isOnLabel(this, point, useFinalPosition);
|
|
18038
18251
|
}
|
|
18039
|
-
return inAxisRange(this, { mouseX, mouseY }, axis, {
|
|
18252
|
+
return inAxisRange(this, { mouseX, mouseY }, axis, { hitSize, useFinalPosition });
|
|
18040
18253
|
}
|
|
18041
18254
|
getCenterPoint(useFinalPosition) {
|
|
18042
18255
|
return getElementCenterPoint(this, useFinalPosition);
|
|
@@ -18131,6 +18344,7 @@ LineAnnotation.defaults = {
|
|
|
18131
18344
|
display: true,
|
|
18132
18345
|
endValue: void 0,
|
|
18133
18346
|
init: void 0,
|
|
18347
|
+
hitTolerance: 0,
|
|
18134
18348
|
label: {
|
|
18135
18349
|
backgroundColor: "rgba(0,0,0,0.8)",
|
|
18136
18350
|
backgroundShadowColor: "transparent",
|
|
@@ -18155,6 +18369,7 @@ LineAnnotation.defaults = {
|
|
|
18155
18369
|
weight: "bold"
|
|
18156
18370
|
},
|
|
18157
18371
|
height: void 0,
|
|
18372
|
+
hitTolerance: void 0,
|
|
18158
18373
|
opacity: void 0,
|
|
18159
18374
|
padding: 6,
|
|
18160
18375
|
position: "center",
|
|
@@ -18197,9 +18412,9 @@ LineAnnotation.descriptors = {
|
|
|
18197
18412
|
LineAnnotation.defaultRoutes = {
|
|
18198
18413
|
borderColor: "color"
|
|
18199
18414
|
};
|
|
18200
|
-
function inAxisRange(element, { mouseX, mouseY }, axis, {
|
|
18415
|
+
function inAxisRange(element, { mouseX, mouseY }, axis, { hitSize, useFinalPosition }) {
|
|
18201
18416
|
const limit = rangeLimit(mouseX, mouseY, element.getProps(["x", "y", "x2", "y2"], useFinalPosition), axis);
|
|
18202
|
-
return limit
|
|
18417
|
+
return inLimit(limit, hitSize) || isOnLabel(element, { mouseX, mouseY }, useFinalPosition, axis);
|
|
18203
18418
|
}
|
|
18204
18419
|
function isLineInArea({ x: x2, y: y2, x2: x22, y2: y22 }, { top: top2, right: right2, bottom: bottom2, left: left2 }) {
|
|
18205
18420
|
return !(x2 < left2 && x22 < left2 || x2 > right2 && x22 > right2 || y2 < top2 && y22 < top2 || y2 > bottom2 && y22 > bottom2);
|
|
@@ -18432,15 +18647,14 @@ function drawCurve(ctx, element, cp, length) {
|
|
|
18432
18647
|
class EllipseAnnotation extends Element$2 {
|
|
18433
18648
|
inRange(mouseX, mouseY, axis, useFinalPosition) {
|
|
18434
18649
|
const rotation = this.options.rotation;
|
|
18435
|
-
const
|
|
18650
|
+
const hitSize = (this.options.borderWidth + this.options.hitTolerance) / 2;
|
|
18436
18651
|
if (axis !== "x" && axis !== "y") {
|
|
18437
|
-
return pointInEllipse({ x: mouseX, y: mouseY }, this.getProps(["width", "height", "centerX", "centerY"], useFinalPosition), rotation,
|
|
18652
|
+
return pointInEllipse({ x: mouseX, y: mouseY }, this.getProps(["width", "height", "centerX", "centerY"], useFinalPosition), rotation, hitSize);
|
|
18438
18653
|
}
|
|
18439
18654
|
const { x: x2, y: y2, x2: x22, y2: y22 } = this.getProps(["x", "y", "x2", "y2"], useFinalPosition);
|
|
18440
|
-
const hBorderWidth = borderWidth / 2;
|
|
18441
18655
|
const limit = axis === "y" ? { start: y2, end: y22 } : { start: x2, end: x22 };
|
|
18442
18656
|
const rotatedPoint = rotated({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), toRadians$1(-rotation));
|
|
18443
|
-
return rotatedPoint[axis] >= limit.start -
|
|
18657
|
+
return rotatedPoint[axis] >= limit.start - hitSize - EPSILON$1 && rotatedPoint[axis] <= limit.end + hitSize + EPSILON$1;
|
|
18444
18658
|
}
|
|
18445
18659
|
getCenterPoint(useFinalPosition) {
|
|
18446
18660
|
return getElementCenterPoint(this, useFinalPosition);
|
|
@@ -18477,6 +18691,7 @@ EllipseAnnotation.defaults = {
|
|
|
18477
18691
|
borderShadowColor: "transparent",
|
|
18478
18692
|
borderWidth: 1,
|
|
18479
18693
|
display: true,
|
|
18694
|
+
hitTolerance: 0,
|
|
18480
18695
|
init: void 0,
|
|
18481
18696
|
label: Object.assign({}, BoxAnnotation.defaults.label),
|
|
18482
18697
|
rotation: 0,
|
|
@@ -18500,7 +18715,7 @@ EllipseAnnotation.descriptors = {
|
|
|
18500
18715
|
_fallback: true
|
|
18501
18716
|
}
|
|
18502
18717
|
};
|
|
18503
|
-
function pointInEllipse(p2, ellipse, rotation,
|
|
18718
|
+
function pointInEllipse(p2, ellipse, rotation, hitSize) {
|
|
18504
18719
|
const { width, height, centerX, centerY } = ellipse;
|
|
18505
18720
|
const xRadius = width / 2;
|
|
18506
18721
|
const yRadius = height / 2;
|
|
@@ -18508,23 +18723,21 @@ function pointInEllipse(p2, ellipse, rotation, borderWidth) {
|
|
|
18508
18723
|
return false;
|
|
18509
18724
|
}
|
|
18510
18725
|
const angle = toRadians$1(rotation || 0);
|
|
18511
|
-
const hBorderWidth = borderWidth / 2 || 0;
|
|
18512
18726
|
const cosAngle = Math.cos(angle);
|
|
18513
18727
|
const sinAngle = Math.sin(angle);
|
|
18514
18728
|
const a2 = Math.pow(cosAngle * (p2.x - centerX) + sinAngle * (p2.y - centerY), 2);
|
|
18515
18729
|
const b2 = Math.pow(sinAngle * (p2.x - centerX) - cosAngle * (p2.y - centerY), 2);
|
|
18516
|
-
return a2 / Math.pow(xRadius +
|
|
18730
|
+
return a2 / Math.pow(xRadius + hitSize, 2) + b2 / Math.pow(yRadius + hitSize, 2) <= 1.0001;
|
|
18517
18731
|
}
|
|
18518
18732
|
class PointAnnotation extends Element$2 {
|
|
18519
18733
|
inRange(mouseX, mouseY, axis, useFinalPosition) {
|
|
18520
18734
|
const { x: x2, y: y2, x2: x22, y2: y22, width } = this.getProps(["x", "y", "x2", "y2", "width"], useFinalPosition);
|
|
18521
|
-
const
|
|
18735
|
+
const hitSize = (this.options.borderWidth + this.options.hitTolerance) / 2;
|
|
18522
18736
|
if (axis !== "x" && axis !== "y") {
|
|
18523
|
-
return inPointRange({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), width / 2,
|
|
18737
|
+
return inPointRange({ x: mouseX, y: mouseY }, this.getCenterPoint(useFinalPosition), width / 2, hitSize);
|
|
18524
18738
|
}
|
|
18525
|
-
const hBorderWidth = borderWidth / 2;
|
|
18526
18739
|
const limit = axis === "y" ? { start: y2, end: y22, value: mouseY } : { start: x2, end: x22, value: mouseX };
|
|
18527
|
-
return limit
|
|
18740
|
+
return inLimit(limit, hitSize);
|
|
18528
18741
|
}
|
|
18529
18742
|
getCenterPoint(useFinalPosition) {
|
|
18530
18743
|
return getElementCenterPoint(this, useFinalPosition);
|
|
@@ -18562,6 +18775,7 @@ PointAnnotation.defaults = {
|
|
|
18562
18775
|
borderShadowColor: "transparent",
|
|
18563
18776
|
borderWidth: 1,
|
|
18564
18777
|
display: true,
|
|
18778
|
+
hitTolerance: 0,
|
|
18565
18779
|
init: void 0,
|
|
18566
18780
|
pointStyle: "circle",
|
|
18567
18781
|
radius: 10,
|
|
@@ -18649,6 +18863,7 @@ PolygonAnnotation.defaults = {
|
|
|
18649
18863
|
borderShadowColor: "transparent",
|
|
18650
18864
|
borderWidth: 1,
|
|
18651
18865
|
display: true,
|
|
18866
|
+
hitTolerance: 0,
|
|
18652
18867
|
init: void 0,
|
|
18653
18868
|
point: {
|
|
18654
18869
|
radius: 0
|
|
@@ -18675,8 +18890,8 @@ PolygonAnnotation.defaultRoutes = {
|
|
|
18675
18890
|
borderColor: "color",
|
|
18676
18891
|
backgroundColor: "color"
|
|
18677
18892
|
};
|
|
18678
|
-
function buildPointElement({ centerX, centerY }, { radius, borderWidth }, rad) {
|
|
18679
|
-
const
|
|
18893
|
+
function buildPointElement({ centerX, centerY }, { radius, borderWidth, hitTolerance }, rad) {
|
|
18894
|
+
const hitSize = (borderWidth + hitTolerance) / 2;
|
|
18680
18895
|
const sin = Math.sin(rad);
|
|
18681
18896
|
const cos = Math.cos(rad);
|
|
18682
18897
|
const point = { x: centerX + sin * radius, y: centerY - cos * radius };
|
|
@@ -18688,8 +18903,8 @@ function buildPointElement({ centerX, centerY }, { radius, borderWidth }, rad) {
|
|
|
18688
18903
|
y: point.y,
|
|
18689
18904
|
centerX: point.x,
|
|
18690
18905
|
centerY: point.y,
|
|
18691
|
-
bX: centerX + sin * (radius +
|
|
18692
|
-
bY: centerY - cos * (radius +
|
|
18906
|
+
bX: centerX + sin * (radius + hitSize),
|
|
18907
|
+
bY: centerY - cos * (radius + hitSize)
|
|
18693
18908
|
}
|
|
18694
18909
|
};
|
|
18695
18910
|
}
|
|
@@ -18707,6 +18922,7 @@ function pointIsInPolygon(points, x2, y2, useFinalPosition) {
|
|
|
18707
18922
|
}
|
|
18708
18923
|
const annotationTypes = {
|
|
18709
18924
|
box: BoxAnnotation,
|
|
18925
|
+
doughnutLabel: DoughnutLabelAnnotation,
|
|
18710
18926
|
ellipse: EllipseAnnotation,
|
|
18711
18927
|
label: LabelAnnotation,
|
|
18712
18928
|
line: LineAnnotation,
|
|
@@ -18738,7 +18954,7 @@ function updateElements(chart2, state, options, mode) {
|
|
|
18738
18954
|
for (let i2 = 0; i2 < annotations.length; i2++) {
|
|
18739
18955
|
const annotationOptions = annotations[i2];
|
|
18740
18956
|
const element = getOrCreateElement(elements, i2, annotationOptions.type);
|
|
18741
|
-
const resolver = annotationOptions.setContext(getContext(chart2, element, annotationOptions));
|
|
18957
|
+
const resolver = annotationOptions.setContext(getContext(chart2, element, elements, annotationOptions));
|
|
18742
18958
|
const properties = element.resolveElementProperties(chart2, resolver);
|
|
18743
18959
|
properties.skip = toSkip(properties);
|
|
18744
18960
|
if ("elements" in properties) {
|
|
@@ -18812,9 +19028,12 @@ function resolveObj(resolver, defs) {
|
|
|
18812
19028
|
}
|
|
18813
19029
|
return result;
|
|
18814
19030
|
}
|
|
18815
|
-
function getContext(chart2, element, annotation2) {
|
|
19031
|
+
function getContext(chart2, element, elements, annotation2) {
|
|
18816
19032
|
return element.$context || (element.$context = Object.assign(Object.create(chart2.getContext()), {
|
|
18817
19033
|
element,
|
|
19034
|
+
get elements() {
|
|
19035
|
+
return elements.filter((el) => el && el.options);
|
|
19036
|
+
},
|
|
18818
19037
|
id: annotation2.id,
|
|
18819
19038
|
type: "annotation"
|
|
18820
19039
|
}));
|
|
@@ -18830,8 +19049,9 @@ function resyncElements(elements, annotations) {
|
|
|
18830
19049
|
}
|
|
18831
19050
|
return elements;
|
|
18832
19051
|
}
|
|
18833
|
-
var version$1 = "3.0
|
|
19052
|
+
var version$1 = "3.1.0";
|
|
18834
19053
|
const chartStates = /* @__PURE__ */ new Map();
|
|
19054
|
+
const isNotDoughnutLabel = (annotation2) => annotation2.type !== "doughnutLabel";
|
|
18835
19055
|
const hooks = eventHooks.concat(elementHooks);
|
|
18836
19056
|
var annotation = {
|
|
18837
19057
|
id: "annotation",
|
|
@@ -18873,11 +19093,11 @@ var annotation = {
|
|
|
18873
19093
|
} else if (isArray$1(annotationOptions)) {
|
|
18874
19094
|
annotations.push(...annotationOptions);
|
|
18875
19095
|
}
|
|
18876
|
-
verifyScaleOptions(annotations, chart2.scales);
|
|
19096
|
+
verifyScaleOptions(annotations.filter(isNotDoughnutLabel), chart2.scales);
|
|
18877
19097
|
},
|
|
18878
19098
|
afterDataLimits(chart2, args) {
|
|
18879
19099
|
const state = chartStates.get(chart2);
|
|
18880
|
-
adjustScaleRange(chart2, args.scale, state.annotations.filter((a2) => a2.display && a2.adjustScaleRange));
|
|
19100
|
+
adjustScaleRange(chart2, args.scale, state.annotations.filter(isNotDoughnutLabel).filter((a2) => a2.display && a2.adjustScaleRange));
|
|
18881
19101
|
},
|
|
18882
19102
|
afterUpdate(chart2, args, options) {
|
|
18883
19103
|
const state = chartStates.get(chart2);
|
|
@@ -18892,6 +19112,9 @@ var annotation = {
|
|
|
18892
19112
|
afterDatasetsDraw(chart2, _args, options) {
|
|
18893
19113
|
draw$1(chart2, "afterDatasetsDraw", options.clip);
|
|
18894
19114
|
},
|
|
19115
|
+
beforeDatasetDraw(chart2, _args, options) {
|
|
19116
|
+
draw$1(chart2, _args.index, options.clip);
|
|
19117
|
+
},
|
|
18895
19118
|
beforeDraw(chart2, _args, options) {
|
|
18896
19119
|
draw$1(chart2, "beforeDraw", options.clip);
|
|
18897
19120
|
},
|
|
@@ -18907,14 +19130,23 @@ var annotation = {
|
|
|
18907
19130
|
afterDestroy(chart2) {
|
|
18908
19131
|
chartStates.delete(chart2);
|
|
18909
19132
|
},
|
|
18910
|
-
|
|
18911
|
-
|
|
19133
|
+
getAnnotations(chart2) {
|
|
19134
|
+
const state = chartStates.get(chart2);
|
|
19135
|
+
return state ? state.elements : [];
|
|
19136
|
+
},
|
|
19137
|
+
// only for testing
|
|
19138
|
+
_getAnnotationElementsAtEventForMode(visibleElements, event, options) {
|
|
19139
|
+
return getElements(visibleElements, event, options);
|
|
18912
19140
|
},
|
|
18913
19141
|
defaults: {
|
|
18914
19142
|
animations: {
|
|
18915
19143
|
numbers: {
|
|
18916
19144
|
properties: ["x", "y", "x2", "y2", "width", "height", "centerX", "centerY", "pointX", "pointY", "radius"],
|
|
18917
19145
|
type: "number"
|
|
19146
|
+
},
|
|
19147
|
+
colors: {
|
|
19148
|
+
properties: ["backgroundColor", "borderColor"],
|
|
19149
|
+
type: "color"
|
|
18918
19150
|
}
|
|
18919
19151
|
},
|
|
18920
19152
|
clip: true,
|
|
@@ -19009,8 +19241,7 @@ var ActionTypes = {
|
|
|
19009
19241
|
}
|
|
19010
19242
|
};
|
|
19011
19243
|
function isPlainObject(obj) {
|
|
19012
|
-
if (typeof obj !== "object" || obj === null)
|
|
19013
|
-
return false;
|
|
19244
|
+
if (typeof obj !== "object" || obj === null) return false;
|
|
19014
19245
|
var proto = obj;
|
|
19015
19246
|
while (Object.getPrototypeOf(proto) !== null) {
|
|
19016
19247
|
proto = Object.getPrototypeOf(proto);
|
|
@@ -19018,10 +19249,8 @@ function isPlainObject(obj) {
|
|
|
19018
19249
|
return Object.getPrototypeOf(obj) === proto;
|
|
19019
19250
|
}
|
|
19020
19251
|
function miniKindOf(val) {
|
|
19021
|
-
if (val === void 0)
|
|
19022
|
-
|
|
19023
|
-
if (val === null)
|
|
19024
|
-
return "null";
|
|
19252
|
+
if (val === void 0) return "undefined";
|
|
19253
|
+
if (val === null) return "null";
|
|
19025
19254
|
var type = typeof val;
|
|
19026
19255
|
switch (type) {
|
|
19027
19256
|
case "boolean":
|
|
@@ -19032,12 +19261,9 @@ function miniKindOf(val) {
|
|
|
19032
19261
|
return type;
|
|
19033
19262
|
}
|
|
19034
19263
|
}
|
|
19035
|
-
if (Array.isArray(val))
|
|
19036
|
-
|
|
19037
|
-
if (
|
|
19038
|
-
return "date";
|
|
19039
|
-
if (isError(val))
|
|
19040
|
-
return "error";
|
|
19264
|
+
if (Array.isArray(val)) return "array";
|
|
19265
|
+
if (isDate(val)) return "date";
|
|
19266
|
+
if (isError(val)) return "error";
|
|
19041
19267
|
var constructorName = ctorName(val);
|
|
19042
19268
|
switch (constructorName) {
|
|
19043
19269
|
case "Symbol":
|
|
@@ -19057,8 +19283,7 @@ function isError(val) {
|
|
|
19057
19283
|
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
19058
19284
|
}
|
|
19059
19285
|
function isDate(val) {
|
|
19060
|
-
if (val instanceof Date)
|
|
19061
|
-
return true;
|
|
19286
|
+
if (val instanceof Date) return true;
|
|
19062
19287
|
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
19063
19288
|
}
|
|
19064
19289
|
function kindOf(val) {
|
|
@@ -20352,33 +20577,28 @@ function makeStoreInstance(debugMode) {
|
|
|
20352
20577
|
}));
|
|
20353
20578
|
}
|
|
20354
20579
|
function _objectWithoutProperties(source, excluded) {
|
|
20355
|
-
if (source == null)
|
|
20356
|
-
return {};
|
|
20580
|
+
if (source == null) return {};
|
|
20357
20581
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
20358
20582
|
var key, i2;
|
|
20359
20583
|
if (Object.getOwnPropertySymbols) {
|
|
20360
20584
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
20361
20585
|
for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) {
|
|
20362
20586
|
key = sourceSymbolKeys[i2];
|
|
20363
|
-
if (excluded.indexOf(key) >= 0)
|
|
20364
|
-
|
|
20365
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
20366
|
-
continue;
|
|
20587
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
20588
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
20367
20589
|
target[key] = source[key];
|
|
20368
20590
|
}
|
|
20369
20591
|
}
|
|
20370
20592
|
return target;
|
|
20371
20593
|
}
|
|
20372
20594
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
20373
|
-
if (source == null)
|
|
20374
|
-
return {};
|
|
20595
|
+
if (source == null) return {};
|
|
20375
20596
|
var target = {};
|
|
20376
20597
|
var sourceKeys = Object.keys(source);
|
|
20377
20598
|
var key, i2;
|
|
20378
20599
|
for (i2 = 0; i2 < sourceKeys.length; i2++) {
|
|
20379
20600
|
key = sourceKeys[i2];
|
|
20380
|
-
if (excluded.indexOf(key) >= 0)
|
|
20381
|
-
continue;
|
|
20601
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
20382
20602
|
target[key] = source[key];
|
|
20383
20603
|
}
|
|
20384
20604
|
return target;
|
|
@@ -20437,45 +20657,35 @@ function getGlobalContext() {
|
|
|
20437
20657
|
return typeof global !== "undefined" ? global : window;
|
|
20438
20658
|
}
|
|
20439
20659
|
var fastDeepEqual = function equal(a2, b2) {
|
|
20440
|
-
if (a2 === b2)
|
|
20441
|
-
return true;
|
|
20660
|
+
if (a2 === b2) return true;
|
|
20442
20661
|
if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
|
|
20443
|
-
if (a2.constructor !== b2.constructor)
|
|
20444
|
-
return false;
|
|
20662
|
+
if (a2.constructor !== b2.constructor) return false;
|
|
20445
20663
|
var length, i2, keys;
|
|
20446
20664
|
if (Array.isArray(a2)) {
|
|
20447
20665
|
length = a2.length;
|
|
20448
|
-
if (length != b2.length)
|
|
20449
|
-
return false;
|
|
20666
|
+
if (length != b2.length) return false;
|
|
20450
20667
|
for (i2 = length; i2-- !== 0; )
|
|
20451
|
-
if (!equal(a2[i2], b2[i2]))
|
|
20452
|
-
return false;
|
|
20668
|
+
if (!equal(a2[i2], b2[i2])) return false;
|
|
20453
20669
|
return true;
|
|
20454
20670
|
}
|
|
20455
|
-
if (a2.constructor === RegExp)
|
|
20456
|
-
|
|
20457
|
-
if (a2.
|
|
20458
|
-
return a2.valueOf() === b2.valueOf();
|
|
20459
|
-
if (a2.toString !== Object.prototype.toString)
|
|
20460
|
-
return a2.toString() === b2.toString();
|
|
20671
|
+
if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
|
|
20672
|
+
if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
|
|
20673
|
+
if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
|
|
20461
20674
|
keys = Object.keys(a2);
|
|
20462
20675
|
length = keys.length;
|
|
20463
|
-
if (length !== Object.keys(b2).length)
|
|
20464
|
-
return false;
|
|
20676
|
+
if (length !== Object.keys(b2).length) return false;
|
|
20465
20677
|
for (i2 = length; i2-- !== 0; )
|
|
20466
|
-
if (!Object.prototype.hasOwnProperty.call(b2, keys[i2]))
|
|
20467
|
-
return false;
|
|
20678
|
+
if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
|
|
20468
20679
|
for (i2 = length; i2-- !== 0; ) {
|
|
20469
20680
|
var key = keys[i2];
|
|
20470
|
-
if (!equal(a2[key], b2[key]))
|
|
20471
|
-
return false;
|
|
20681
|
+
if (!equal(a2[key], b2[key])) return false;
|
|
20472
20682
|
}
|
|
20473
20683
|
return true;
|
|
20474
20684
|
}
|
|
20475
20685
|
return a2 !== a2 && b2 !== b2;
|
|
20476
20686
|
};
|
|
20477
20687
|
const isEqual = /* @__PURE__ */ getDefaultExportFromCjs(fastDeepEqual);
|
|
20478
|
-
const useIsomorphicLayoutEffect$
|
|
20688
|
+
const useIsomorphicLayoutEffect$1 = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
20479
20689
|
function useCollector(monitor, collect, onUpdate) {
|
|
20480
20690
|
const [collected, setCollected] = useState(
|
|
20481
20691
|
() => collect(monitor)
|
|
@@ -20493,7 +20703,7 @@ function useCollector(monitor, collect, onUpdate) {
|
|
|
20493
20703
|
monitor,
|
|
20494
20704
|
onUpdate
|
|
20495
20705
|
]);
|
|
20496
|
-
useIsomorphicLayoutEffect$
|
|
20706
|
+
useIsomorphicLayoutEffect$1(updateCollected);
|
|
20497
20707
|
return [
|
|
20498
20708
|
collected,
|
|
20499
20709
|
updateCollected
|
|
@@ -20501,7 +20711,7 @@ function useCollector(monitor, collect, onUpdate) {
|
|
|
20501
20711
|
}
|
|
20502
20712
|
function useMonitorOutput(monitor, collect, onCollect) {
|
|
20503
20713
|
const [collected, updateCollected] = useCollector(monitor, collect, onCollect);
|
|
20504
|
-
useIsomorphicLayoutEffect$
|
|
20714
|
+
useIsomorphicLayoutEffect$1(function subscribeToMonitorStateChange() {
|
|
20505
20715
|
const handlerId = monitor.getHandlerId();
|
|
20506
20716
|
if (handlerId == null) {
|
|
20507
20717
|
return;
|
|
@@ -20526,9 +20736,9 @@ function useCollectedProps(collector, monitor, connector) {
|
|
|
20526
20736
|
}
|
|
20527
20737
|
function useOptionalFactory(arg, deps) {
|
|
20528
20738
|
const memoDeps = [
|
|
20529
|
-
...
|
|
20739
|
+
...[]
|
|
20530
20740
|
];
|
|
20531
|
-
if (
|
|
20741
|
+
if (typeof arg !== "function") {
|
|
20532
20742
|
memoDeps.push(arg);
|
|
20533
20743
|
}
|
|
20534
20744
|
return useMemo(() => {
|
|
@@ -20718,7 +20928,7 @@ function registerSource(type, source, manager) {
|
|
|
20718
20928
|
];
|
|
20719
20929
|
}
|
|
20720
20930
|
function shallowEqual(objA, objB, compare, compareContext) {
|
|
20721
|
-
let compareResult =
|
|
20931
|
+
let compareResult = void 0;
|
|
20722
20932
|
if (compareResult !== void 0) {
|
|
20723
20933
|
return !!compareResult;
|
|
20724
20934
|
}
|
|
@@ -20741,7 +20951,7 @@ function shallowEqual(objA, objB, compare, compareContext) {
|
|
|
20741
20951
|
}
|
|
20742
20952
|
const valueA = objA[key];
|
|
20743
20953
|
const valueB = objB[key];
|
|
20744
|
-
compareResult =
|
|
20954
|
+
compareResult = void 0;
|
|
20745
20955
|
if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
|
|
20746
20956
|
return false;
|
|
20747
20957
|
}
|
|
@@ -21051,7 +21261,7 @@ function useDragSourceConnector(dragSourceOptions, dragPreviewOptions) {
|
|
|
21051
21261
|
manager
|
|
21052
21262
|
]
|
|
21053
21263
|
);
|
|
21054
|
-
useIsomorphicLayoutEffect$
|
|
21264
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
21055
21265
|
connector.dragSourceOptions = dragSourceOptions || null;
|
|
21056
21266
|
connector.reconnect();
|
|
21057
21267
|
return () => connector.disconnectDragSource();
|
|
@@ -21059,7 +21269,7 @@ function useDragSourceConnector(dragSourceOptions, dragPreviewOptions) {
|
|
|
21059
21269
|
connector,
|
|
21060
21270
|
dragSourceOptions
|
|
21061
21271
|
]);
|
|
21062
|
-
useIsomorphicLayoutEffect$
|
|
21272
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
21063
21273
|
connector.dragPreviewOptions = dragPreviewOptions || null;
|
|
21064
21274
|
connector.reconnect();
|
|
21065
21275
|
return () => connector.disconnectDragPreview();
|
|
@@ -21153,7 +21363,7 @@ function useRegisteredDragSource(spec, monitor, connector) {
|
|
|
21153
21363
|
const manager = useDragDropManager();
|
|
21154
21364
|
const handler = useDragSource(spec, monitor, connector);
|
|
21155
21365
|
const itemType = useDragType(spec);
|
|
21156
|
-
useIsomorphicLayoutEffect$
|
|
21366
|
+
useIsomorphicLayoutEffect$1(function registerDragSource() {
|
|
21157
21367
|
if (itemType != null) {
|
|
21158
21368
|
const [handlerId, unregister] = registerSource(itemType, handler, manager);
|
|
21159
21369
|
monitor.receiveHandlerId(handlerId);
|
|
@@ -21170,7 +21380,7 @@ function useRegisteredDragSource(spec, monitor, connector) {
|
|
|
21170
21380
|
]);
|
|
21171
21381
|
}
|
|
21172
21382
|
function useDrag(specArg, deps) {
|
|
21173
|
-
const spec = useOptionalFactory(specArg
|
|
21383
|
+
const spec = useOptionalFactory(specArg);
|
|
21174
21384
|
invariant(!spec.begin, `useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)`);
|
|
21175
21385
|
const monitor = useDragSourceMonitor();
|
|
21176
21386
|
const connector = useDragSourceConnector(spec.options, spec.previewOptions);
|
|
@@ -21197,7 +21407,7 @@ function useDropTargetConnector(options) {
|
|
|
21197
21407
|
manager
|
|
21198
21408
|
]
|
|
21199
21409
|
);
|
|
21200
|
-
useIsomorphicLayoutEffect$
|
|
21410
|
+
useIsomorphicLayoutEffect$1(() => {
|
|
21201
21411
|
connector.dropTargetOptions = options || null;
|
|
21202
21412
|
connector.reconnect();
|
|
21203
21413
|
return () => connector.disconnectDropTarget();
|
|
@@ -21270,7 +21480,7 @@ function useRegisteredDropTarget(spec, monitor, connector) {
|
|
|
21270
21480
|
const manager = useDragDropManager();
|
|
21271
21481
|
const dropTarget = useDropTarget(spec, monitor);
|
|
21272
21482
|
const accept = useAccept(spec);
|
|
21273
|
-
useIsomorphicLayoutEffect$
|
|
21483
|
+
useIsomorphicLayoutEffect$1(function registerDropTarget() {
|
|
21274
21484
|
const [handlerId, unregister] = registerTarget(accept, dropTarget, manager);
|
|
21275
21485
|
monitor.receiveHandlerId(handlerId);
|
|
21276
21486
|
connector.receiveHandlerId(handlerId);
|
|
@@ -21286,7 +21496,7 @@ function useRegisteredDropTarget(spec, monitor, connector) {
|
|
|
21286
21496
|
]);
|
|
21287
21497
|
}
|
|
21288
21498
|
function useDrop(specArg, deps) {
|
|
21289
|
-
const spec = useOptionalFactory(specArg
|
|
21499
|
+
const spec = useOptionalFactory(specArg);
|
|
21290
21500
|
const monitor = useDropTargetMonitor();
|
|
21291
21501
|
const connector = useDropTargetConnector(spec.options);
|
|
21292
21502
|
useRegisteredDropTarget(spec, monitor, connector);
|
|
@@ -22367,6 +22577,9 @@ var AnnotationType$1 = /* @__PURE__ */ ((AnnotationType2) => {
|
|
|
22367
22577
|
})(AnnotationType$1 || {});
|
|
22368
22578
|
var PointStyle = /* @__PURE__ */ ((PointStyle2) => {
|
|
22369
22579
|
PointStyle2["Circle"] = "circle";
|
|
22580
|
+
PointStyle2["Square"] = "rect";
|
|
22581
|
+
PointStyle2["Diamond"] = "rectRot";
|
|
22582
|
+
PointStyle2["Triangle"] = "triangle";
|
|
22370
22583
|
return PointStyle2;
|
|
22371
22584
|
})(PointStyle || {});
|
|
22372
22585
|
var ChartHoverMode = /* @__PURE__ */ ((ChartHoverMode2) => {
|
|
@@ -22397,8 +22610,7 @@ const MINOR_TICKS_PER_MAJOR = 10;
|
|
|
22397
22610
|
const getLargestMajorTickWidth = (majorTickPositions) => {
|
|
22398
22611
|
return majorTickPositions.reduce(
|
|
22399
22612
|
(acc, curr, index2) => {
|
|
22400
|
-
if (index2 === 0)
|
|
22401
|
-
return acc;
|
|
22613
|
+
if (index2 === 0) return acc;
|
|
22402
22614
|
const gap = Math.abs(curr - majorTickPositions[index2 - 1]);
|
|
22403
22615
|
return Math.max(gap, acc);
|
|
22404
22616
|
},
|
|
@@ -22434,10 +22646,8 @@ const drawMinorTicksForScale = (scale) => {
|
|
|
22434
22646
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
22435
22647
|
const { chart: chart2, ctx } = scale;
|
|
22436
22648
|
const config2 = chart2.config;
|
|
22437
|
-
if (!((_d2 = (_c2 = (_b2 = (_a2 = config2 == null ? void 0 : config2.options) == null ? void 0 : _a2.scales) == null ? void 0 : _b2[scale.id]) == null ? void 0 : _c2.grid) == null ? void 0 : _d2.drawOnChartArea))
|
|
22438
|
-
|
|
22439
|
-
if (config2.options.indexAxis === scale.axis)
|
|
22440
|
-
return;
|
|
22649
|
+
if (!((_d2 = (_c2 = (_b2 = (_a2 = config2 == null ? void 0 : config2.options) == null ? void 0 : _a2.scales) == null ? void 0 : _b2[scale.id]) == null ? void 0 : _c2.grid) == null ? void 0 : _d2.drawOnChartArea)) return;
|
|
22650
|
+
if (config2.options.indexAxis === scale.axis) return;
|
|
22441
22651
|
const isHorizontal = scale.axis === "x";
|
|
22442
22652
|
const majorTickPositions = scale.ticks.map((_2, index2) => scale.getPixelForTick(index2)).sort((a2, b2) => a2 - b2);
|
|
22443
22653
|
const minorTickPositions = getMinorTickPositions(majorTickPositions, scale);
|
|
@@ -22678,13 +22888,11 @@ const generateKey = (values) => {
|
|
|
22678
22888
|
};
|
|
22679
22889
|
const isPrimitiveValue = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null;
|
|
22680
22890
|
const isRangeValid = (r2) => {
|
|
22681
|
-
if (!r2)
|
|
22682
|
-
return false;
|
|
22891
|
+
if (!r2) return false;
|
|
22683
22892
|
return Object.values(r2).some((value) => !isNilOrEmpty(value));
|
|
22684
22893
|
};
|
|
22685
22894
|
const getChartStateFromStorage = (persistenceId) => {
|
|
22686
|
-
if (!persistenceId)
|
|
22687
|
-
return null;
|
|
22895
|
+
if (!persistenceId) return null;
|
|
22688
22896
|
const chartStateKey = `line-chart-state-${persistenceId}`;
|
|
22689
22897
|
const chartStateObjectJSON = localStorage.getItem(chartStateKey);
|
|
22690
22898
|
if (chartStateObjectJSON) {
|
|
@@ -22714,8 +22922,7 @@ const removeExpiredChartStates = (maxAgeInHours = 72) => {
|
|
|
22714
22922
|
}
|
|
22715
22923
|
};
|
|
22716
22924
|
const storeChartStateInStorage = (state, persistenceId) => {
|
|
22717
|
-
if (!persistenceId)
|
|
22718
|
-
return;
|
|
22925
|
+
if (!persistenceId) return;
|
|
22719
22926
|
const currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
22720
22927
|
const chartStateKey = `line-chart-state-${persistenceId}`;
|
|
22721
22928
|
const chartStateObject = {
|
|
@@ -22729,10 +22936,15 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22729
22936
|
const {
|
|
22730
22937
|
additionalAxesOptions: { range: customAxesRange = {} },
|
|
22731
22938
|
axes,
|
|
22732
|
-
chartOptions: {
|
|
22939
|
+
chartOptions: {
|
|
22940
|
+
enableZoom,
|
|
22941
|
+
enablePan,
|
|
22942
|
+
showPoints,
|
|
22943
|
+
showLine,
|
|
22944
|
+
enableDragAnnotation
|
|
22945
|
+
},
|
|
22733
22946
|
legend: { display },
|
|
22734
|
-
dragData
|
|
22735
|
-
annotations: { enableDragAnnotation }
|
|
22947
|
+
dragData
|
|
22736
22948
|
} = options;
|
|
22737
22949
|
const getStateAxesByType = (axisType, customAxesRange2) => {
|
|
22738
22950
|
var _a2, _b2, _c2, _d2, _e2;
|
|
@@ -22783,7 +22995,7 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22783
22995
|
enableDragAnnotation: enableDragAnnotationStorage
|
|
22784
22996
|
} = getChartStateFromStorage(persistenceId) || {};
|
|
22785
22997
|
return {
|
|
22786
|
-
zoomEnabled: zoomEnabled ?? enableZoom,
|
|
22998
|
+
zoomEnabled: enableDragAnnotation ?? enableDragAnnotationStorage ? false : zoomEnabled ?? enableZoom,
|
|
22787
22999
|
panEnabled: panEnabled ?? enablePan,
|
|
22788
23000
|
pointsEnabled: pointsEnabled ?? showPoints,
|
|
22789
23001
|
lineEnabled: lineEnabled ?? showLine,
|
|
@@ -22791,7 +23003,7 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22791
23003
|
axes: stateAxes,
|
|
22792
23004
|
showTable: false,
|
|
22793
23005
|
enableDragPoints: (dragData == null ? void 0 : dragData.enableDragData) && enableDragPoints,
|
|
22794
|
-
enableDragAnnotation: enableDragAnnotation
|
|
23006
|
+
enableDragAnnotation: enableDragAnnotation ?? enableDragAnnotationStorage,
|
|
22795
23007
|
initialAxesRanges: []
|
|
22796
23008
|
};
|
|
22797
23009
|
};
|
|
@@ -22808,7 +23020,6 @@ var noop = function() {
|
|
|
22808
23020
|
};
|
|
22809
23021
|
var isBrowser = typeof window !== "undefined";
|
|
22810
23022
|
var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
22811
|
-
const useIsomorphicLayoutEffect$1 = useIsomorphicLayoutEffect;
|
|
22812
23023
|
var defaultState = {
|
|
22813
23024
|
x: 0,
|
|
22814
23025
|
y: 0,
|
|
@@ -22830,7 +23041,7 @@ function useMeasure() {
|
|
|
22830
23041
|
}
|
|
22831
23042
|
});
|
|
22832
23043
|
}, []);
|
|
22833
|
-
useIsomorphicLayoutEffect
|
|
23044
|
+
useIsomorphicLayoutEffect(function() {
|
|
22834
23045
|
if (!element)
|
|
22835
23046
|
return;
|
|
22836
23047
|
observer.observe(element);
|
|
@@ -22860,10 +23071,8 @@ function getLineOptions({
|
|
|
22860
23071
|
icon: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgLineAndPoint, {}) }),
|
|
22861
23072
|
selected: pointsEnabled && lineEnabled,
|
|
22862
23073
|
onClick: () => {
|
|
22863
|
-
if (!pointsEnabled)
|
|
22864
|
-
|
|
22865
|
-
if (!lineEnabled)
|
|
22866
|
-
onToggleLine();
|
|
23074
|
+
if (!pointsEnabled) onTogglePoints();
|
|
23075
|
+
if (!lineEnabled) onToggleLine();
|
|
22867
23076
|
}
|
|
22868
23077
|
},
|
|
22869
23078
|
{
|
|
@@ -22872,10 +23081,8 @@ function getLineOptions({
|
|
|
22872
23081
|
icon: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgLineOnly, {}) }),
|
|
22873
23082
|
selected: !pointsEnabled && lineEnabled,
|
|
22874
23083
|
onClick: () => {
|
|
22875
|
-
if (pointsEnabled)
|
|
22876
|
-
|
|
22877
|
-
if (!lineEnabled)
|
|
22878
|
-
onToggleLine();
|
|
23084
|
+
if (pointsEnabled) onTogglePoints();
|
|
23085
|
+
if (!lineEnabled) onToggleLine();
|
|
22879
23086
|
}
|
|
22880
23087
|
},
|
|
22881
23088
|
{
|
|
@@ -22884,10 +23091,8 @@ function getLineOptions({
|
|
|
22884
23091
|
icon: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgPointOnly, {}) }),
|
|
22885
23092
|
selected: pointsEnabled && !lineEnabled,
|
|
22886
23093
|
onClick: () => {
|
|
22887
|
-
if (!pointsEnabled)
|
|
22888
|
-
|
|
22889
|
-
if (lineEnabled)
|
|
22890
|
-
onToggleLine();
|
|
23094
|
+
if (!pointsEnabled) onTogglePoints();
|
|
23095
|
+
if (lineEnabled) onToggleLine();
|
|
22891
23096
|
}
|
|
22892
23097
|
}
|
|
22893
23098
|
];
|
|
@@ -22934,28 +23139,22 @@ var DefaultContext = {
|
|
|
22934
23139
|
attr: void 0
|
|
22935
23140
|
};
|
|
22936
23141
|
var IconContext = React__default.createContext && React__default.createContext(DefaultContext);
|
|
22937
|
-
var __assign =
|
|
23142
|
+
var __assign = function() {
|
|
22938
23143
|
__assign = Object.assign || function(t) {
|
|
22939
23144
|
for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
|
|
22940
23145
|
s2 = arguments[i2];
|
|
22941
|
-
for (var p2 in s2)
|
|
22942
|
-
if (Object.prototype.hasOwnProperty.call(s2, p2))
|
|
22943
|
-
t[p2] = s2[p2];
|
|
23146
|
+
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t[p2] = s2[p2];
|
|
22944
23147
|
}
|
|
22945
23148
|
return t;
|
|
22946
23149
|
};
|
|
22947
23150
|
return __assign.apply(this, arguments);
|
|
22948
23151
|
};
|
|
22949
|
-
var __rest =
|
|
23152
|
+
var __rest = function(s2, e2) {
|
|
22950
23153
|
var t = {};
|
|
22951
|
-
for (var p2 in s2)
|
|
22952
|
-
|
|
22953
|
-
|
|
22954
|
-
|
|
22955
|
-
for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
|
|
22956
|
-
if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2]))
|
|
22957
|
-
t[p2[i2]] = s2[p2[i2]];
|
|
22958
|
-
}
|
|
23154
|
+
for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t[p2] = s2[p2];
|
|
23155
|
+
if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) {
|
|
23156
|
+
if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2])) t[p2[i2]] = s2[p2[i2]];
|
|
23157
|
+
}
|
|
22959
23158
|
return t;
|
|
22960
23159
|
};
|
|
22961
23160
|
function Tree2Element(tree) {
|
|
@@ -22977,10 +23176,8 @@ function IconBase(props) {
|
|
|
22977
23176
|
var attr = props.attr, size = props.size, title = props.title, svgProps = __rest(props, ["attr", "size", "title"]);
|
|
22978
23177
|
var computedSize = size || conf.size || "1em";
|
|
22979
23178
|
var className;
|
|
22980
|
-
if (conf.className)
|
|
22981
|
-
|
|
22982
|
-
if (props.className)
|
|
22983
|
-
className = (className ? className + " " : "") + props.className;
|
|
23179
|
+
if (conf.className) className = conf.className;
|
|
23180
|
+
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
22984
23181
|
return React__default.createElement("svg", __assign({
|
|
22985
23182
|
stroke: "currentColor",
|
|
22986
23183
|
fill: "currentColor",
|
|
@@ -23055,8 +23252,7 @@ function getDragOptions({
|
|
|
23055
23252
|
selected: zoomEnabled,
|
|
23056
23253
|
type: "Option",
|
|
23057
23254
|
onClick: () => {
|
|
23058
|
-
if (!zoomEnabled)
|
|
23059
|
-
onToggleZoom();
|
|
23255
|
+
if (!zoomEnabled) onToggleZoom();
|
|
23060
23256
|
}
|
|
23061
23257
|
},
|
|
23062
23258
|
{
|
|
@@ -23066,8 +23262,7 @@ function getDragOptions({
|
|
|
23066
23262
|
selected: panEnabled,
|
|
23067
23263
|
type: "Option",
|
|
23068
23264
|
onClick: () => {
|
|
23069
|
-
if (!panEnabled)
|
|
23070
|
-
onTogglePan();
|
|
23265
|
+
if (!panEnabled) onTogglePan();
|
|
23071
23266
|
}
|
|
23072
23267
|
},
|
|
23073
23268
|
...isDragDataAllowed ? [
|
|
@@ -23077,8 +23272,7 @@ function getDragOptions({
|
|
|
23077
23272
|
selected: enableDragPoints,
|
|
23078
23273
|
type: "Option",
|
|
23079
23274
|
onClick: () => {
|
|
23080
|
-
if (!enableDragPoints)
|
|
23081
|
-
onToggleDragPoints();
|
|
23275
|
+
if (!enableDragPoints) onToggleDragPoints();
|
|
23082
23276
|
}
|
|
23083
23277
|
}
|
|
23084
23278
|
] : [],
|
|
@@ -23089,8 +23283,7 @@ function getDragOptions({
|
|
|
23089
23283
|
selected: enableDragAnnotation,
|
|
23090
23284
|
type: "Option",
|
|
23091
23285
|
onClick: () => {
|
|
23092
|
-
if (!enableDragAnnotation)
|
|
23093
|
-
onToggleDragAnnotation();
|
|
23286
|
+
if (!enableDragAnnotation) onToggleDragAnnotation();
|
|
23094
23287
|
}
|
|
23095
23288
|
}
|
|
23096
23289
|
] : [],
|
|
@@ -23125,8 +23318,8 @@ const DragOptions = ({ options }) => {
|
|
|
23125
23318
|
}
|
|
23126
23319
|
);
|
|
23127
23320
|
};
|
|
23128
|
-
const controls = "
|
|
23129
|
-
const buttons = "
|
|
23321
|
+
const controls = "_controls_1edjs_1";
|
|
23322
|
+
const buttons = "_buttons_1edjs_6";
|
|
23130
23323
|
const styles$4 = {
|
|
23131
23324
|
controls,
|
|
23132
23325
|
buttons
|
|
@@ -23172,7 +23365,7 @@ function resolveUrl(url, baseUrl) {
|
|
|
23172
23365
|
a2.href = url;
|
|
23173
23366
|
return a2.href;
|
|
23174
23367
|
}
|
|
23175
|
-
const uuid = (() => {
|
|
23368
|
+
const uuid = /* @__PURE__ */ (() => {
|
|
23176
23369
|
let counter = 0;
|
|
23177
23370
|
const random = () => (
|
|
23178
23371
|
// eslint-disable-next-line no-bitwise
|
|
@@ -23591,10 +23784,8 @@ async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl)
|
|
|
23591
23784
|
const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
|
|
23592
23785
|
const contentType = getMimeType(resourceURL);
|
|
23593
23786
|
let dataURL;
|
|
23594
|
-
if (getContentFromUrl)
|
|
23595
|
-
|
|
23596
|
-
dataURL = makeDataUrl(content, contentType);
|
|
23597
|
-
} else {
|
|
23787
|
+
if (getContentFromUrl) ;
|
|
23788
|
+
else {
|
|
23598
23789
|
dataURL = await resourceToDataURL(resolvedURL, contentType, options);
|
|
23599
23790
|
}
|
|
23600
23791
|
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
|
|
@@ -23892,8 +24083,7 @@ var dist = { exports: {} };
|
|
|
23892
24083
|
return function(e3) {
|
|
23893
24084
|
var t = {};
|
|
23894
24085
|
function n2(o2) {
|
|
23895
|
-
if (t[o2])
|
|
23896
|
-
return t[o2].exports;
|
|
24086
|
+
if (t[o2]) return t[o2].exports;
|
|
23897
24087
|
var r2 = t[o2] = { i: o2, l: false, exports: {} };
|
|
23898
24088
|
return e3[o2].call(r2.exports, r2, r2.exports, n2), r2.l = true, r2.exports;
|
|
23899
24089
|
}
|
|
@@ -23902,16 +24092,12 @@ var dist = { exports: {} };
|
|
|
23902
24092
|
}, n2.r = function(e4) {
|
|
23903
24093
|
"undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e4, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e4, "__esModule", { value: true });
|
|
23904
24094
|
}, n2.t = function(e4, t2) {
|
|
23905
|
-
if (1 & t2 && (e4 = n2(e4)), 8 & t2)
|
|
23906
|
-
|
|
23907
|
-
if (4 & t2 && "object" == typeof e4 && e4 && e4.__esModule)
|
|
23908
|
-
return e4;
|
|
24095
|
+
if (1 & t2 && (e4 = n2(e4)), 8 & t2) return e4;
|
|
24096
|
+
if (4 & t2 && "object" == typeof e4 && e4 && e4.__esModule) return e4;
|
|
23909
24097
|
var o2 = /* @__PURE__ */ Object.create(null);
|
|
23910
|
-
if (n2.r(o2), Object.defineProperty(o2, "default", { enumerable: true, value: e4 }), 2 & t2 && "string" != typeof e4)
|
|
23911
|
-
|
|
23912
|
-
|
|
23913
|
-
return e4[t3];
|
|
23914
|
-
}).bind(null, r2));
|
|
24098
|
+
if (n2.r(o2), Object.defineProperty(o2, "default", { enumerable: true, value: e4 }), 2 & t2 && "string" != typeof e4) for (var r2 in e4) n2.d(o2, r2, (function(t3) {
|
|
24099
|
+
return e4[t3];
|
|
24100
|
+
}).bind(null, r2));
|
|
23915
24101
|
return o2;
|
|
23916
24102
|
}, n2.n = function(e4) {
|
|
23917
24103
|
var t2 = e4 && e4.__esModule ? function() {
|
|
@@ -23965,12 +24151,10 @@ var dist = { exports: {} };
|
|
|
23965
24151
|
r3(s2);
|
|
23966
24152
|
}, 0));
|
|
23967
24153
|
} : "msSaveOrOpenBlob" in navigator ? function(e4, n4, a4) {
|
|
23968
|
-
if (n4 = n4 || e4.name || "download", "string" != typeof e4)
|
|
23969
|
-
|
|
23970
|
-
|
|
23971
|
-
|
|
23972
|
-
else if (o3(e4))
|
|
23973
|
-
t2(e4, n4, a4);
|
|
24154
|
+
if (n4 = n4 || e4.name || "download", "string" != typeof e4) navigator.msSaveOrOpenBlob(function(e5, t3) {
|
|
24155
|
+
return void 0 === t3 ? t3 = { autoBom: false } : "object" != typeof t3 && (console.warn("Deprecated: Expected third argument to be a object"), t3 = { autoBom: !t3 }), t3.autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e5.type) ? new Blob(["\uFEFF", e5], { type: e5.type }) : e5;
|
|
24156
|
+
}(e4, a4), n4);
|
|
24157
|
+
else if (o3(e4)) t2(e4, n4, a4);
|
|
23974
24158
|
else {
|
|
23975
24159
|
var i3 = document.createElement("a");
|
|
23976
24160
|
i3.href = e4, i3.target = "_blank", setTimeout(function() {
|
|
@@ -23978,8 +24162,7 @@ var dist = { exports: {} };
|
|
|
23978
24162
|
});
|
|
23979
24163
|
}
|
|
23980
24164
|
} : function(e4, n4, o4, r4) {
|
|
23981
|
-
if ((r4 = r4 || open("", "_blank")) && (r4.document.title = r4.document.body.innerText = "downloading..."), "string" == typeof e4)
|
|
23982
|
-
return t2(e4, n4, o4);
|
|
24165
|
+
if ((r4 = r4 || open("", "_blank")) && (r4.document.title = r4.document.body.innerText = "downloading..."), "string" == typeof e4) return t2(e4, n4, o4);
|
|
23983
24166
|
var c3 = "application/octet-stream" === e4.type, s2 = /constructor/i.test(a3.HTMLElement) || a3.safari, u2 = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
23984
24167
|
if ((u2 || c3 && s2 || i2) && "undefined" != typeof FileReader) {
|
|
23985
24168
|
var l2 = new FileReader();
|
|
@@ -24003,8 +24186,7 @@ var dist = { exports: {} };
|
|
|
24003
24186
|
return function(e4, t2, n3) {
|
|
24004
24187
|
t2 = t2 || "", n3 = n3 || 512;
|
|
24005
24188
|
for (var o3 = atob(e4), r3 = [], a3 = 0; a3 < o3.length; a3 += n3) {
|
|
24006
|
-
for (var i2 = o3.slice(a3, a3 + n3), c2 = new Array(i2.length), s2 = 0; s2 < i2.length; s2++)
|
|
24007
|
-
c2[s2] = i2.charCodeAt(s2);
|
|
24189
|
+
for (var i2 = o3.slice(a3, a3 + n3), c2 = new Array(i2.length), s2 = 0; s2 < i2.length; s2++) c2[s2] = i2.charCodeAt(s2);
|
|
24008
24190
|
var u2 = new Uint8Array(c2);
|
|
24009
24191
|
r3.push(u2);
|
|
24010
24192
|
}
|
|
@@ -24024,8 +24206,7 @@ var dist = { exports: {} };
|
|
|
24024
24206
|
return (u2 = Object.assign || function(e4) {
|
|
24025
24207
|
for (var t2 = 1; t2 < arguments.length; t2++) {
|
|
24026
24208
|
var n3 = arguments[t2];
|
|
24027
|
-
for (var o3 in n3)
|
|
24028
|
-
Object.prototype.hasOwnProperty.call(n3, o3) && (e4[o3] = n3[o3]);
|
|
24209
|
+
for (var o3 in n3) Object.prototype.hasOwnProperty.call(n3, o3) && (e4[o3] = n3[o3]);
|
|
24029
24210
|
}
|
|
24030
24211
|
return e4;
|
|
24031
24212
|
}).apply(this, arguments);
|
|
@@ -24048,8 +24229,7 @@ var dist = { exports: {} };
|
|
|
24048
24229
|
var t2;
|
|
24049
24230
|
if ("string" == typeof e4 && (t2 = Object.keys(f2).find(function(t3) {
|
|
24050
24231
|
return 0 === e4.indexOf(f2[t3]);
|
|
24051
|
-
})), t2)
|
|
24052
|
-
return t2;
|
|
24232
|
+
})), t2) return t2;
|
|
24053
24233
|
throw new Error("props.base64 on <Base64Downloader/> has invalid or undefined extension. expected ".concat(Object.keys(l2).join(", ")));
|
|
24054
24234
|
}
|
|
24055
24235
|
d2.defaultProps = { className: "", style: {}, downloadName: p2, Tag: "button", extraAttributes: {} }, d2.propTypes = { base64: i2.a.string.isRequired, children: i2.a.oneOfType([i2.a.node, i2.a.string]).isRequired, downloadName: i2.a.string, onDownloadSuccess: i2.a.func, onDownloadError: i2.a.func, Tag: i2.a.string, className: i2.a.string, style: i2.a.object, extraAttributes: i2.a.object }, t.default = d2;
|
|
@@ -24077,7 +24257,7 @@ var dist = { exports: {} };
|
|
|
24077
24257
|
e3.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
24078
24258
|
}, function(e3, t) {
|
|
24079
24259
|
var n2;
|
|
24080
|
-
n2 = function() {
|
|
24260
|
+
n2 = /* @__PURE__ */ function() {
|
|
24081
24261
|
return this;
|
|
24082
24262
|
}();
|
|
24083
24263
|
try {
|
|
@@ -24094,8 +24274,7 @@ const downloadPgn = (chartRef, state) => {
|
|
|
24094
24274
|
var _a2;
|
|
24095
24275
|
const chart2 = chartRef.current;
|
|
24096
24276
|
const canvasElement = (_a2 = chart2 == null ? void 0 : chart2.canvas) == null ? void 0 : _a2.parentElement;
|
|
24097
|
-
if (!canvasElement)
|
|
24098
|
-
return;
|
|
24277
|
+
if (!canvasElement) return;
|
|
24099
24278
|
const { ctx } = chart2;
|
|
24100
24279
|
ctx.save();
|
|
24101
24280
|
ctx.globalCompositeOperation = "destination-over";
|
|
@@ -24261,8 +24440,7 @@ const initializeFormState = ({
|
|
|
24261
24440
|
const isEmptyString = (value) => value === "";
|
|
24262
24441
|
const createErrorMessages = (value, compareTo, type) => {
|
|
24263
24442
|
const errors = [];
|
|
24264
|
-
if (isEmptyString(value))
|
|
24265
|
-
errors.push("mustHaveAValue");
|
|
24443
|
+
if (isEmptyString(value)) errors.push("mustHaveAValue");
|
|
24266
24444
|
if (type === "min" && !isLessThanMax(value, compareTo)) {
|
|
24267
24445
|
errors.push("mustBeLessThanMax");
|
|
24268
24446
|
} else if (type === "max" && !isGreaterThanMin(value, compareTo)) {
|
|
@@ -24808,9 +24986,10 @@ const defaultLegend$3 = (legend2) => ({
|
|
|
24808
24986
|
});
|
|
24809
24987
|
const defaultChartOptions$3 = (options) => ({
|
|
24810
24988
|
showPoints: (options == null ? void 0 : options.showPoints) ?? true,
|
|
24989
|
+
showLine: (options == null ? void 0 : options.showLine) ?? true,
|
|
24811
24990
|
enableZoom: (options == null ? void 0 : options.enableZoom) ?? true,
|
|
24812
24991
|
enablePan: (options == null ? void 0 : options.enablePan) ?? false,
|
|
24813
|
-
|
|
24992
|
+
enableDragAnnotation: (options == null ? void 0 : options.enableDragAnnotation) ?? false,
|
|
24814
24993
|
closeOnOutsideClick: (options == null ? void 0 : options.closeOnOutsideClick) ?? false
|
|
24815
24994
|
});
|
|
24816
24995
|
const defaultInteractions$3 = (interactions) => ({
|
|
@@ -24870,8 +25049,7 @@ const INIT_KEYS = {
|
|
|
24870
25049
|
const LOWER_BOUND = 1e-4;
|
|
24871
25050
|
const UPPER_BOUND = 1e7;
|
|
24872
25051
|
const checkCustomOption = (data, customOptions) => {
|
|
24873
|
-
if (isEmpty(data) || isEmpty(customOptions))
|
|
24874
|
-
return false;
|
|
25052
|
+
if (isEmpty(data) || isEmpty(customOptions)) return false;
|
|
24875
25053
|
const checkOption = (dataset) => {
|
|
24876
25054
|
if (typeof customOptions === "string") {
|
|
24877
25055
|
return dataset && has(dataset, customOptions);
|
|
@@ -25196,8 +25374,7 @@ const getAnnotationsData = (data) => {
|
|
|
25196
25374
|
};
|
|
25197
25375
|
const getAxesDataFromMetasets = (chartRef, scalesKeys, annotationsData) => {
|
|
25198
25376
|
var _a2;
|
|
25199
|
-
if (!chartRef || !scalesKeys)
|
|
25200
|
-
return {};
|
|
25377
|
+
if (!chartRef || !scalesKeys) return {};
|
|
25201
25378
|
const metasets = ((_a2 = chartRef == null ? void 0 : chartRef.current) == null ? void 0 : _a2.getSortedVisibleDatasetMetas()) ?? [];
|
|
25202
25379
|
const annotData = getAnnotationsData(annotationsData);
|
|
25203
25380
|
return metasets && (scalesKeys == null ? void 0 : scalesKeys.reduce((acc, key) => {
|
|
@@ -25541,7 +25718,8 @@ const generateAnnotations = (annotationsData) => {
|
|
|
25541
25718
|
const borderColor = {
|
|
25542
25719
|
[AnnotationType.LINE]: color2,
|
|
25543
25720
|
[AnnotationType.POINT]: color2,
|
|
25544
|
-
[AnnotationType.BOX]: color2
|
|
25721
|
+
[AnnotationType.BOX]: color2,
|
|
25722
|
+
[AnnotationType.ELLIPSE]: TRANSPARENT
|
|
25545
25723
|
}[type] || TRANSPARENT;
|
|
25546
25724
|
const borderWidth = type === AnnotationType.LINE ? BORDER_WIDTH.INITIAL : 0;
|
|
25547
25725
|
const borderDash = type === AnnotationType.LINE ? ANNOTATION_DASH : void 0;
|
|
@@ -25626,7 +25804,10 @@ const generateAnnotations = (annotationsData) => {
|
|
|
25626
25804
|
leave,
|
|
25627
25805
|
onDragStart,
|
|
25628
25806
|
onDrag,
|
|
25629
|
-
onDragEnd
|
|
25807
|
+
onDragEnd,
|
|
25808
|
+
pointStyle: (ann == null ? void 0 : ann.pointStyle) ?? PointStyle.Circle,
|
|
25809
|
+
resizable: (ann == null ? void 0 : ann.resizable) ?? true,
|
|
25810
|
+
displayDragCoordinates: (ann == null ? void 0 : ann.displayDragCoordinates) ?? true
|
|
25630
25811
|
};
|
|
25631
25812
|
});
|
|
25632
25813
|
};
|
|
@@ -25919,8 +26100,7 @@ const getAxesRangesFromChart = (chartRef, axes) => {
|
|
|
25919
26100
|
});
|
|
25920
26101
|
};
|
|
25921
26102
|
const getAxisRangeByType = (chartRef, axesType, annotationsData) => {
|
|
25922
|
-
if (!chartRef || !chartRef.current)
|
|
25923
|
-
return null;
|
|
26103
|
+
if (!chartRef || !chartRef.current) return null;
|
|
25924
26104
|
const metasets = chartRef.current.getSortedVisibleDatasetMetas();
|
|
25925
26105
|
const annotDataByType = getAnnotationsData(annotationsData)[axesType] ?? [];
|
|
25926
26106
|
let allData = [];
|
|
@@ -25929,8 +26109,7 @@ const getAxisRangeByType = (chartRef, axesType, annotationsData) => {
|
|
|
25929
26109
|
allData = allData.concat(data);
|
|
25930
26110
|
});
|
|
25931
26111
|
allData = allData.concat(annotDataByType);
|
|
25932
|
-
if (allData.length === 0)
|
|
25933
|
-
return null;
|
|
26112
|
+
if (allData.length === 0) return null;
|
|
25934
26113
|
const min = Math.min(...allData);
|
|
25935
26114
|
const max = Math.max(...allData);
|
|
25936
26115
|
return { min, max };
|
|
@@ -26165,8 +26344,7 @@ const chartAreaTextPlugin = {
|
|
|
26165
26344
|
maxWidth: initialMaxWidth,
|
|
26166
26345
|
position
|
|
26167
26346
|
} = options;
|
|
26168
|
-
if (!showLabel || !text)
|
|
26169
|
-
return;
|
|
26347
|
+
if (!showLabel || !text) return;
|
|
26170
26348
|
const { ctx, chartArea } = chart2;
|
|
26171
26349
|
const maxWidth = calculateMaxWidth(initialMaxWidth, chartArea.width);
|
|
26172
26350
|
const [x2, y2] = getPositionCoordinates(position, chart2, xOffset, yOffset);
|
|
@@ -26245,11 +26423,77 @@ const calculateAnnotationMetricsInValuesInPixels = (annotation2, scales) => {
|
|
|
26245
26423
|
height
|
|
26246
26424
|
};
|
|
26247
26425
|
};
|
|
26426
|
+
const isWithinChartArea = ({
|
|
26427
|
+
x: x2,
|
|
26428
|
+
y: y2,
|
|
26429
|
+
chartArea,
|
|
26430
|
+
scales,
|
|
26431
|
+
metrics,
|
|
26432
|
+
resizable = false,
|
|
26433
|
+
dragRange,
|
|
26434
|
+
annotationType
|
|
26435
|
+
}) => {
|
|
26436
|
+
if (resizable && !dragRange) {
|
|
26437
|
+
return true;
|
|
26438
|
+
}
|
|
26439
|
+
if (dragRange) {
|
|
26440
|
+
const withinRangeX = x2 !== void 0 && dragRange.x ? x2 >= dragRange.x[0] && x2 <= dragRange.x[1] : true;
|
|
26441
|
+
const withinRangeY = y2 !== void 0 && dragRange.y ? y2 >= dragRange.y[0] && y2 <= dragRange.y[1] : true;
|
|
26442
|
+
return withinRangeX && withinRangeY;
|
|
26443
|
+
}
|
|
26444
|
+
const minX = scales.x.getValueForPixel(chartArea.left) ?? Number.NEGATIVE_INFINITY;
|
|
26445
|
+
const maxX = scales.x.getValueForPixel(chartArea.right) ?? Number.POSITIVE_INFINITY;
|
|
26446
|
+
const minY = scales.y.getValueForPixel(chartArea.bottom) ?? Number.NEGATIVE_INFINITY;
|
|
26447
|
+
const maxY = scales.y.getValueForPixel(chartArea.top) ?? Number.POSITIVE_INFINITY;
|
|
26448
|
+
if (annotationType === AnnotationType.POINT) {
|
|
26449
|
+
const withinX = x2 !== void 0 ? x2 >= minX && x2 <= maxX : true;
|
|
26450
|
+
const withinY = y2 !== void 0 ? y2 >= minY && y2 <= maxY : true;
|
|
26451
|
+
return withinX && withinY;
|
|
26452
|
+
}
|
|
26453
|
+
if (annotationType === AnnotationType.BOX && metrics.width !== void 0 && metrics.height !== void 0) {
|
|
26454
|
+
const boxXMin = x2 !== void 0 ? x2 - metrics.width / 2 : void 0;
|
|
26455
|
+
const boxXMax = x2 !== void 0 ? x2 + metrics.width / 2 : void 0;
|
|
26456
|
+
const boxYMin = y2 !== void 0 ? y2 - metrics.height / 2 : void 0;
|
|
26457
|
+
const boxYMax = y2 !== void 0 ? y2 + metrics.height / 2 : void 0;
|
|
26458
|
+
const withinBoxX = boxXMin !== void 0 && boxXMax !== void 0 ? boxXMin >= minX && boxXMax <= maxX : true;
|
|
26459
|
+
const withinBoxY = boxYMin !== void 0 && boxYMax !== void 0 ? boxYMin >= minY && boxYMax <= maxY : true;
|
|
26460
|
+
return withinBoxX && withinBoxY;
|
|
26461
|
+
}
|
|
26462
|
+
return true;
|
|
26463
|
+
};
|
|
26464
|
+
const updateAnnotationPositionWithinBounds = (axis, newPosition, activeAnnotation, chart2, scales, metrics) => {
|
|
26465
|
+
const { resizable, dragRange = null } = activeAnnotation ?? {};
|
|
26466
|
+
const checkArea = isWithinChartArea({
|
|
26467
|
+
[axis]: newPosition,
|
|
26468
|
+
chartArea: chart2.chartArea,
|
|
26469
|
+
scales,
|
|
26470
|
+
resizable,
|
|
26471
|
+
dragRange,
|
|
26472
|
+
metrics: metrics || {},
|
|
26473
|
+
annotationType: activeAnnotation.type
|
|
26474
|
+
});
|
|
26475
|
+
if (!checkArea) return;
|
|
26476
|
+
if (activeAnnotation.type === AnnotationType.POINT) {
|
|
26477
|
+
if (axis === "x") {
|
|
26478
|
+
activeAnnotation.xValue = newPosition;
|
|
26479
|
+
} else if (axis === "y") {
|
|
26480
|
+
activeAnnotation.yValue = newPosition;
|
|
26481
|
+
}
|
|
26482
|
+
} else if (activeAnnotation.type === AnnotationType.BOX && metrics) {
|
|
26483
|
+
if (axis === "x" && metrics.width) {
|
|
26484
|
+
activeAnnotation.xMin = newPosition - metrics.width / 2;
|
|
26485
|
+
activeAnnotation.xMax = newPosition + metrics.width / 2;
|
|
26486
|
+
}
|
|
26487
|
+
if (axis === "y" && metrics.height) {
|
|
26488
|
+
activeAnnotation.yMin = newPosition - metrics.height / 2;
|
|
26489
|
+
activeAnnotation.yMax = newPosition + metrics.height / 2;
|
|
26490
|
+
}
|
|
26491
|
+
}
|
|
26492
|
+
};
|
|
26248
26493
|
const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDraggingState, hoveredAnnotationId) => {
|
|
26249
26494
|
const { x: x2, y: y2 } = getMousePositionInCoordinates(event, canvas2, scales);
|
|
26250
26495
|
const annotation2 = hoveredAnnotationId ? annotations == null ? void 0 : annotations[hoveredAnnotationId] : null;
|
|
26251
|
-
if (!annotation2)
|
|
26252
|
-
return;
|
|
26496
|
+
if (!annotation2) return;
|
|
26253
26497
|
const metrics = calculateAnnotationMetricsInValues(annotation2);
|
|
26254
26498
|
if (annotation2 && annotation2.enableDrag && !isNil(metrics.centerY) && !isNil(metrics.centerX)) {
|
|
26255
26499
|
canvas2.style.cursor = CursorStyle.Move;
|
|
@@ -26270,24 +26514,24 @@ const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAn
|
|
|
26270
26514
|
let newCenterX = x2 - dragStartX;
|
|
26271
26515
|
let newCenterY = y2 - dragStartY;
|
|
26272
26516
|
if (dragAxis !== DragAxis.Y) {
|
|
26273
|
-
|
|
26274
|
-
|
|
26275
|
-
|
|
26276
|
-
|
|
26277
|
-
|
|
26278
|
-
|
|
26279
|
-
|
|
26280
|
-
|
|
26517
|
+
updateAnnotationPositionWithinBounds(
|
|
26518
|
+
DragAxis.X,
|
|
26519
|
+
newCenterX,
|
|
26520
|
+
activeAnnotation,
|
|
26521
|
+
chart2,
|
|
26522
|
+
scales,
|
|
26523
|
+
metrics
|
|
26524
|
+
);
|
|
26281
26525
|
}
|
|
26282
26526
|
if (dragAxis !== DragAxis.X) {
|
|
26283
|
-
|
|
26284
|
-
|
|
26285
|
-
|
|
26286
|
-
|
|
26287
|
-
|
|
26288
|
-
|
|
26289
|
-
|
|
26290
|
-
|
|
26527
|
+
updateAnnotationPositionWithinBounds(
|
|
26528
|
+
DragAxis.Y,
|
|
26529
|
+
newCenterY,
|
|
26530
|
+
activeAnnotation,
|
|
26531
|
+
chart2,
|
|
26532
|
+
scales,
|
|
26533
|
+
metrics
|
|
26534
|
+
);
|
|
26291
26535
|
}
|
|
26292
26536
|
chart2.update();
|
|
26293
26537
|
if (activeAnnotation == null ? void 0 : activeAnnotation.onDrag) {
|
|
@@ -26302,18 +26546,20 @@ const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAn
|
|
|
26302
26546
|
chart2.draw();
|
|
26303
26547
|
ctx.font = DEFAULT_FONT_FAMILY;
|
|
26304
26548
|
ctx.fillStyle = "black";
|
|
26305
|
-
|
|
26306
|
-
|
|
26307
|
-
|
|
26308
|
-
|
|
26309
|
-
|
|
26310
|
-
labelY
|
|
26311
|
-
|
|
26312
|
-
|
|
26313
|
-
labelY
|
|
26549
|
+
if (activeAnnotation == null ? void 0 : activeAnnotation.displayDragCoordinates) {
|
|
26550
|
+
let labelX = xValue - 45;
|
|
26551
|
+
let labelY = yValue - 20;
|
|
26552
|
+
const labelText = `X: ${round$2(centerX, 2)}, Y: ${round$2(centerY, 2)}`;
|
|
26553
|
+
const labelHeight = 14;
|
|
26554
|
+
if (labelY - labelHeight < 0) {
|
|
26555
|
+
labelY = yValue + labelHeight + 15;
|
|
26556
|
+
}
|
|
26557
|
+
if (labelY > height) {
|
|
26558
|
+
labelY = height - 7;
|
|
26559
|
+
}
|
|
26560
|
+
ctx.fillText(labelText, labelX, labelY);
|
|
26561
|
+
ctx.restore();
|
|
26314
26562
|
}
|
|
26315
|
-
ctx.fillText(labelText, labelX, labelY);
|
|
26316
|
-
ctx.restore();
|
|
26317
26563
|
}
|
|
26318
26564
|
}
|
|
26319
26565
|
};
|
|
@@ -26368,8 +26614,7 @@ const annotationDraggerPlugin = {
|
|
|
26368
26614
|
beforeDraw(chart2) {
|
|
26369
26615
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
26370
26616
|
let annotations = ((_b2 = (_a2 = chart2.options.plugins) == null ? void 0 : _a2.annotation) == null ? void 0 : _b2.annotations) ?? {};
|
|
26371
|
-
if (!annotations)
|
|
26372
|
-
return;
|
|
26617
|
+
if (!annotations) return;
|
|
26373
26618
|
annotationLabel(
|
|
26374
26619
|
chart2.ctx,
|
|
26375
26620
|
annotations,
|
|
@@ -26397,15 +26642,31 @@ const annotationDraggerPlugin = {
|
|
|
26397
26642
|
}
|
|
26398
26643
|
},
|
|
26399
26644
|
afterUpdate(chart2) {
|
|
26400
|
-
var _a2, _b2, _c2, _d2;
|
|
26645
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
26401
26646
|
const { canvas: canvas2, scales, hoveredAnnotationId } = chart2;
|
|
26402
26647
|
const pluginOptions = ((_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.annotationDraggerPlugin) || {
|
|
26403
26648
|
enabled: false
|
|
26404
26649
|
};
|
|
26405
26650
|
const typedScales = { x: scales.x, y: scales.y };
|
|
26406
26651
|
let annotations = ((_d2 = (_c2 = chart2.options.plugins) == null ? void 0 : _c2.annotation) == null ? void 0 : _d2.annotations) ?? {};
|
|
26407
|
-
if (!chart2 && !annotations)
|
|
26408
|
-
|
|
26652
|
+
if (!chart2 && !annotations) return;
|
|
26653
|
+
if (pluginOptions.enabled) {
|
|
26654
|
+
if ((_f2 = (_e2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _e2.plugins) == null ? void 0 : _f2.tooltip) {
|
|
26655
|
+
chart2.options.plugins.tooltip.enabled = false;
|
|
26656
|
+
}
|
|
26657
|
+
chart2.options.hover = {
|
|
26658
|
+
mode: void 0,
|
|
26659
|
+
intersect: false
|
|
26660
|
+
};
|
|
26661
|
+
} else {
|
|
26662
|
+
if ((_h2 = (_g2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _g2.plugins) == null ? void 0 : _h2.tooltip) {
|
|
26663
|
+
chart2.options.plugins.tooltip.enabled = true;
|
|
26664
|
+
}
|
|
26665
|
+
chart2.options.hover = {
|
|
26666
|
+
mode: ChartHoverMode.Nearest,
|
|
26667
|
+
intersect: true
|
|
26668
|
+
};
|
|
26669
|
+
}
|
|
26409
26670
|
let isDragging2 = false;
|
|
26410
26671
|
let dragStartX, dragStartY;
|
|
26411
26672
|
let activeAnnotation = null;
|
|
@@ -26572,9 +26833,10 @@ const SvgTriangle = (props) => /* @__PURE__ */ React.createElement("svg", { heig
|
|
|
26572
26833
|
const LEGEND_SYMBOL_SIZE$1 = 16;
|
|
26573
26834
|
const LineItem = ({ dataset }) => {
|
|
26574
26835
|
var _a2;
|
|
26575
|
-
const { borderColor, borderDash, borderWidth } = dataset;
|
|
26576
|
-
const
|
|
26577
|
-
const
|
|
26836
|
+
const { borderColor, borderDash, borderWidth } = dataset ?? {};
|
|
26837
|
+
const [dash0, dash1] = borderDash ?? [];
|
|
26838
|
+
const offset = dash0 && dash1 ? (LEGEND_SYMBOL_SIZE$1 - dash0) / 2 % (dash0 + dash1) * -1 : 0;
|
|
26839
|
+
const borderDashString = ((_a2 = dataset == null ? void 0 : dataset.borderDash) == null ? void 0 : _a2.join(" ")) || "";
|
|
26578
26840
|
return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemLine, children: /* @__PURE__ */ jsx(
|
|
26579
26841
|
"svg",
|
|
26580
26842
|
{
|
|
@@ -26599,9 +26861,8 @@ const LineItem = ({ dataset }) => {
|
|
|
26599
26861
|
) });
|
|
26600
26862
|
};
|
|
26601
26863
|
const PointItem = ({ dataset }) => {
|
|
26602
|
-
const { pointBackgroundColor, pointRadius, pointStyle = "" } = dataset;
|
|
26603
|
-
if (!pointRadius)
|
|
26604
|
-
return null;
|
|
26864
|
+
const { pointBackgroundColor, pointRadius, pointStyle = "" } = dataset ?? {};
|
|
26865
|
+
if (!pointRadius) return null;
|
|
26605
26866
|
const size = pointRadius * 2;
|
|
26606
26867
|
const icons = {
|
|
26607
26868
|
circle: /* @__PURE__ */ jsx(SvgCircle, {}),
|
|
@@ -26612,19 +26873,19 @@ const PointItem = ({ dataset }) => {
|
|
|
26612
26873
|
return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(
|
|
26613
26874
|
Icon,
|
|
26614
26875
|
{
|
|
26615
|
-
icon: icons[pointStyle] ?? /* @__PURE__ */ jsx(SvgCircle, {}),
|
|
26876
|
+
icon: (icons == null ? void 0 : icons[pointStyle]) ?? /* @__PURE__ */ jsx(SvgCircle, {}),
|
|
26616
26877
|
size,
|
|
26617
26878
|
color: pointBackgroundColor
|
|
26618
26879
|
}
|
|
26619
26880
|
) });
|
|
26620
26881
|
};
|
|
26621
26882
|
const BoxItem = ({ dataset }) => {
|
|
26622
|
-
const { backgroundColor } = dataset;
|
|
26883
|
+
const { backgroundColor } = dataset ?? {};
|
|
26623
26884
|
const style = { backgroundColor };
|
|
26624
26885
|
return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemBox, style });
|
|
26625
26886
|
};
|
|
26626
26887
|
const LegendItemLine = ({ dataset }) => {
|
|
26627
|
-
const { annotationType, showLine } = dataset;
|
|
26888
|
+
const { annotationType, showLine } = dataset ?? {};
|
|
26628
26889
|
switch (annotationType) {
|
|
26629
26890
|
case AnnotationType$1.Box:
|
|
26630
26891
|
case AnnotationType$1.Ellipse:
|
|
@@ -26644,15 +26905,15 @@ const renderLegendItemSymbol = (dataset, chartType, index2) => {
|
|
|
26644
26905
|
case ChartType.LINE:
|
|
26645
26906
|
return /* @__PURE__ */ jsx(LegendItemLine, { dataset });
|
|
26646
26907
|
case ChartType.BAR: {
|
|
26647
|
-
const { backgroundColor } = dataset;
|
|
26648
|
-
const color2 = backgroundColor instanceof Array ? backgroundColor[index2] : backgroundColor;
|
|
26908
|
+
const { backgroundColor } = dataset ?? {};
|
|
26909
|
+
const color2 = backgroundColor instanceof Array ? backgroundColor == null ? void 0 : backgroundColor[index2] : backgroundColor;
|
|
26649
26910
|
return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemBox, children: /* @__PURE__ */ jsx(TbSquareFilled, { color: color2 }) });
|
|
26650
26911
|
}
|
|
26651
26912
|
case ChartType.PIE:
|
|
26652
26913
|
return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(Icon, { icon: /* @__PURE__ */ jsx(SvgCircle, {}) }) });
|
|
26653
26914
|
case ChartType.SCATTER: {
|
|
26654
|
-
const { backgroundColor, borderColor } = dataset;
|
|
26655
|
-
const color2 = backgroundColor instanceof Array ? backgroundColor[index2] : backgroundColor;
|
|
26915
|
+
const { backgroundColor, borderColor } = dataset ?? {};
|
|
26916
|
+
const color2 = backgroundColor instanceof Array ? backgroundColor == null ? void 0 : backgroundColor[index2] : backgroundColor;
|
|
26656
26917
|
return /* @__PURE__ */ jsx("span", { className: styles$3.legendItemPoint, children: /* @__PURE__ */ jsx(TbCircleFilled, { color: color2 ?? borderColor }) });
|
|
26657
26918
|
}
|
|
26658
26919
|
default:
|
|
@@ -26669,7 +26930,7 @@ const LegendItem = ({
|
|
|
26669
26930
|
return /* @__PURE__ */ jsxs(
|
|
26670
26931
|
"div",
|
|
26671
26932
|
{
|
|
26672
|
-
className: cx(styles$3.legendItem, hidden && styles$3.isHidden),
|
|
26933
|
+
className: cx(styles$3 == null ? void 0 : styles$3.legendItem, hidden && (styles$3 == null ? void 0 : styles$3.isHidden)),
|
|
26673
26934
|
onClick: handleClick,
|
|
26674
26935
|
children: [
|
|
26675
26936
|
/* @__PURE__ */ jsx(
|
|
@@ -26680,7 +26941,7 @@ const LegendItem = ({
|
|
|
26680
26941
|
children: renderLegendItemSymbol(dataset, chartType, index2)
|
|
26681
26942
|
}
|
|
26682
26943
|
),
|
|
26683
|
-
/* @__PURE__ */ jsx("span", { className: styles$3.legendItemText, children: dataset.label })
|
|
26944
|
+
/* @__PURE__ */ jsx("span", { className: styles$3.legendItemText, children: dataset == null ? void 0 : dataset.label })
|
|
26684
26945
|
]
|
|
26685
26946
|
}
|
|
26686
26947
|
);
|
|
@@ -26722,9 +26983,8 @@ const getGeneratedLabels = (chart2) => {
|
|
|
26722
26983
|
const useGeneratedLabels = (chartRef, generatedDatasets) => {
|
|
26723
26984
|
const [items, setItems] = useState([]);
|
|
26724
26985
|
useEffect(() => {
|
|
26725
|
-
const chart2 = chartRef.current;
|
|
26726
|
-
if (!chart2)
|
|
26727
|
-
return;
|
|
26986
|
+
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
26987
|
+
if (!chart2) return;
|
|
26728
26988
|
const newItems = getGeneratedLabels(chart2);
|
|
26729
26989
|
setItems(newItems);
|
|
26730
26990
|
}, [generatedDatasets, chartRef]);
|
|
@@ -26735,10 +26995,10 @@ const createLegendStyle = (legendPosition, chart2) => {
|
|
|
26735
26995
|
const { height = 0, width = 0, chartArea } = chart2 ?? {};
|
|
26736
26996
|
const { top: top2 = 0, left: left2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = chartArea ?? {};
|
|
26737
26997
|
return {
|
|
26738
|
-
left: legendPosition.includes("left") ? left2 : void 0,
|
|
26739
|
-
right: legendPosition.includes("right") ? width - right2 : void 0,
|
|
26740
|
-
top: legendPosition.includes("top") ? top2 : void 0,
|
|
26741
|
-
bottom: legendPosition.includes("bottom") ? height - bottom2 : void 0,
|
|
26998
|
+
left: (legendPosition == null ? void 0 : legendPosition.includes("left")) ? left2 : void 0,
|
|
26999
|
+
right: (legendPosition == null ? void 0 : legendPosition.includes("right")) ? width - right2 : void 0,
|
|
27000
|
+
top: (legendPosition == null ? void 0 : legendPosition.includes("top")) ? top2 : void 0,
|
|
27001
|
+
bottom: (legendPosition == null ? void 0 : legendPosition.includes("bottom")) ? height - bottom2 : void 0,
|
|
26742
27002
|
maxHeight: 0.5 * (bottom2 - top2 - LEGEND_MARGIN * 2),
|
|
26743
27003
|
maxWidth: 0.9 * (right2 - left2 - LEGEND_MARGIN * 2),
|
|
26744
27004
|
margin: LEGEND_MARGIN
|
|
@@ -26749,27 +27009,28 @@ const LegendItems = ({
|
|
|
26749
27009
|
datasets,
|
|
26750
27010
|
legendClick,
|
|
26751
27011
|
chartType
|
|
26752
|
-
}) => /* @__PURE__ */ jsx("div", { className: styles$3.legendItems, children: items.map((item, index2) => {
|
|
26753
|
-
|
|
27012
|
+
}) => /* @__PURE__ */ jsx("div", { className: styles$3.legendItems, children: items == null ? void 0 : items.map((item, index2) => {
|
|
27013
|
+
var _a2;
|
|
27014
|
+
if ((_a2 = datasets == null ? void 0 : datasets[item == null ? void 0 : item.datasetIndex]) == null ? void 0 : _a2.hideLegend) {
|
|
26754
27015
|
return null;
|
|
26755
27016
|
}
|
|
26756
27017
|
return /* @__PURE__ */ jsx(
|
|
26757
27018
|
LegendItem,
|
|
26758
27019
|
{
|
|
26759
27020
|
index: index2,
|
|
26760
|
-
hidden: item.hidden,
|
|
26761
|
-
dataset: datasets[item.datasetIndex],
|
|
27021
|
+
hidden: item == null ? void 0 : item.hidden,
|
|
27022
|
+
dataset: datasets == null ? void 0 : datasets[item == null ? void 0 : item.datasetIndex],
|
|
26762
27023
|
handleClick: (_2) => legendClick(_2, item),
|
|
26763
27024
|
chartType
|
|
26764
27025
|
},
|
|
26765
|
-
`${item.datasetIndex}-hidden-${item.hidden}`
|
|
27026
|
+
`${item == null ? void 0 : item.datasetIndex}-hidden-${item == null ? void 0 : item.hidden}`
|
|
26766
27027
|
);
|
|
26767
27028
|
}) });
|
|
26768
27029
|
const LegendPanel = forwardRef(
|
|
26769
27030
|
({ legendPosition, chartRef, isDragging: isDragging2, legendConfig }, ref) => {
|
|
26770
27031
|
var _a2;
|
|
26771
27032
|
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
26772
|
-
const { options, generatedDatasets, chartType } = legendConfig;
|
|
27033
|
+
const { options, generatedDatasets, chartType } = legendConfig ?? {};
|
|
26773
27034
|
const datasets = (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets;
|
|
26774
27035
|
const { legend: legend2, legendClick } = useLegendState({
|
|
26775
27036
|
chartRef,
|
|
@@ -26813,13 +27074,17 @@ const LegendPanel = forwardRef(
|
|
|
26813
27074
|
}
|
|
26814
27075
|
);
|
|
26815
27076
|
const LegendDropZone = (legendDropZoneProps) => {
|
|
26816
|
-
const {
|
|
27077
|
+
const {
|
|
27078
|
+
position = "",
|
|
27079
|
+
onDrop = noop$2,
|
|
27080
|
+
placeholderSize = {}
|
|
27081
|
+
} = legendDropZoneProps ?? {};
|
|
26817
27082
|
const [{ isOver, canDrop }, dropRef] = useDrop(() => ({
|
|
26818
27083
|
accept: "legend",
|
|
26819
27084
|
drop: onDrop,
|
|
26820
27085
|
collect: (monitor) => ({
|
|
26821
|
-
isOver: monitor.isOver(),
|
|
26822
|
-
canDrop: monitor.canDrop()
|
|
27086
|
+
isOver: monitor == null ? void 0 : monitor.isOver(),
|
|
27087
|
+
canDrop: monitor == null ? void 0 : monitor.canDrop()
|
|
26823
27088
|
})
|
|
26824
27089
|
}));
|
|
26825
27090
|
const isActive2 = isOver && canDrop;
|
|
@@ -26830,10 +27095,10 @@ const LegendDropZone = (legendDropZoneProps) => {
|
|
|
26830
27095
|
className: cx(
|
|
26831
27096
|
styles$3.dropzone,
|
|
26832
27097
|
isActive2 && styles$3.isActive,
|
|
26833
|
-
position.includes("left") && styles$3.left,
|
|
26834
|
-
position.includes("right") && styles$3.right,
|
|
26835
|
-
position.includes("top") && styles$3.top,
|
|
26836
|
-
position.includes("bottom") && styles$3.bottom
|
|
27098
|
+
(position == null ? void 0 : position.includes("left")) && styles$3.left,
|
|
27099
|
+
(position == null ? void 0 : position.includes("right")) && styles$3.right,
|
|
27100
|
+
(position == null ? void 0 : position.includes("top")) && styles$3.top,
|
|
27101
|
+
(position == null ? void 0 : position.includes("bottom")) && styles$3.bottom
|
|
26837
27102
|
),
|
|
26838
27103
|
children: /* @__PURE__ */ jsx(
|
|
26839
27104
|
"div",
|
|
@@ -26866,7 +27131,7 @@ const LegendDropZones = (legendDropZonesProps) => {
|
|
|
26866
27131
|
zIndex: isDragging2 ? 0 : -1
|
|
26867
27132
|
// Position dropzones behind chart when not needed
|
|
26868
27133
|
},
|
|
26869
|
-
children: positions2.map((position) => /* @__PURE__ */ jsx(
|
|
27134
|
+
children: positions2 == null ? void 0 : positions2.map((position) => /* @__PURE__ */ jsx(
|
|
26870
27135
|
LegendDropZone,
|
|
26871
27136
|
{
|
|
26872
27137
|
position,
|
|
@@ -26880,24 +27145,32 @@ const LegendDropZones = (legendDropZonesProps) => {
|
|
|
26880
27145
|
};
|
|
26881
27146
|
const Legend2 = ({ chartRef, legendConfig }) => {
|
|
26882
27147
|
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
26883
|
-
const
|
|
27148
|
+
const [chartArea, setChartArea] = useState(
|
|
27149
|
+
chart2 == null ? void 0 : chart2.chartArea
|
|
27150
|
+
);
|
|
26884
27151
|
const {
|
|
26885
27152
|
options: { legend: legend2 }
|
|
26886
27153
|
} = legendConfig ?? {};
|
|
26887
|
-
const [measureRef] = useMeasure$1();
|
|
27154
|
+
const [measureRef, measureRect] = useMeasure$1();
|
|
26888
27155
|
const resizeRef = measureRef;
|
|
26889
27156
|
const panelRef = useRef(null);
|
|
26890
27157
|
const [legendPosition, setLegendPosition] = useState(
|
|
26891
27158
|
(legend2 == null ? void 0 : legend2.position) || Position.BottomLeft
|
|
26892
27159
|
);
|
|
26893
|
-
const panelRect = panelRef.current ? panelRef.current.getBoundingClientRect() : null;
|
|
27160
|
+
const panelRect = (panelRef == null ? void 0 : panelRef.current) ? panelRef.current.getBoundingClientRect() : null;
|
|
26894
27161
|
const panelSize = { width: panelRect == null ? void 0 : panelRect.width, height: panelRect == null ? void 0 : panelRect.height };
|
|
26895
|
-
const [{ isDragging: isDragging2 }, dragRef] = useDrag(() => ({
|
|
27162
|
+
const [{ isDragging: isDragging2 = false }, dragRef = noop$2] = useDrag(() => ({
|
|
26896
27163
|
type: "legend",
|
|
26897
27164
|
collect: (monitor) => ({
|
|
26898
27165
|
isDragging: monitor.isDragging()
|
|
26899
27166
|
})
|
|
26900
27167
|
}));
|
|
27168
|
+
useEffect(() => {
|
|
27169
|
+
const timeout = setTimeout(() => {
|
|
27170
|
+
setChartArea(chart2 == null ? void 0 : chart2.chartArea);
|
|
27171
|
+
}, 20);
|
|
27172
|
+
return () => clearTimeout(timeout);
|
|
27173
|
+
}, [measureRect]);
|
|
26901
27174
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26902
27175
|
/* @__PURE__ */ jsx("div", { ref: resizeRef, className: styles$3.resizeContainer }),
|
|
26903
27176
|
/* @__PURE__ */ jsx(
|
|
@@ -26920,7 +27193,8 @@ const Legend2 = ({ chartRef, legendConfig }) => {
|
|
|
26920
27193
|
setLegendPosition: (position) => setLegendPosition(position),
|
|
26921
27194
|
isDragging: isDragging2,
|
|
26922
27195
|
placeholderSize: panelSize
|
|
26923
|
-
}
|
|
27196
|
+
},
|
|
27197
|
+
measureRect.width
|
|
26924
27198
|
)
|
|
26925
27199
|
] });
|
|
26926
27200
|
};
|
|
@@ -27240,8 +27514,7 @@ const usePieChartConfig = (chart2) => {
|
|
|
27240
27514
|
return "";
|
|
27241
27515
|
const dataElement = context.dataset.data[context.dataIndex];
|
|
27242
27516
|
const label = (dataElement == null ? void 0 : dataElement.label) || (typeof dataElement === "number" ? dataElement : Array.isArray(dataElement) ? dataElement.reduce((acc, curr, i2) => {
|
|
27243
|
-
if (i2 === 0)
|
|
27244
|
-
return `${acc} ${curr}`;
|
|
27517
|
+
if (i2 === 0) return `${acc} ${curr}`;
|
|
27245
27518
|
return `${acc}, ${curr}`;
|
|
27246
27519
|
}, "") : "");
|
|
27247
27520
|
const dataLabel = typeof dataElement === "number" ? Number.isInteger(label) ? label : label.toFixed(2) : label;
|
|
@@ -27262,8 +27535,7 @@ const usePieChartConfig = (chart2) => {
|
|
|
27262
27535
|
usePointStyle: true,
|
|
27263
27536
|
filter: (item) => {
|
|
27264
27537
|
var _a2;
|
|
27265
|
-
if (!options.legend.useDataset)
|
|
27266
|
-
return true;
|
|
27538
|
+
if (!options.legend.useDataset) return true;
|
|
27267
27539
|
return !((_a2 = data.datasets[item.index]) == null ? void 0 : _a2.hideLegend);
|
|
27268
27540
|
}
|
|
27269
27541
|
},
|
|
@@ -27402,7 +27674,7 @@ const PieChartWithLegend = (props) => {
|
|
|
27402
27674
|
* (c) 2022 Chart.js Contributors
|
|
27403
27675
|
* Released under the MIT License
|
|
27404
27676
|
*/
|
|
27405
|
-
const uid = function() {
|
|
27677
|
+
const uid = /* @__PURE__ */ function() {
|
|
27406
27678
|
let id = 0;
|
|
27407
27679
|
return function() {
|
|
27408
27680
|
return id++;
|
|
@@ -27442,11 +27714,7 @@ function each(loopable, fn, thisArg, reverse) {
|
|
|
27442
27714
|
let i2, len, keys;
|
|
27443
27715
|
if (isArray(loopable)) {
|
|
27444
27716
|
len = loopable.length;
|
|
27445
|
-
|
|
27446
|
-
for (i2 = len - 1; i2 >= 0; i2--) {
|
|
27447
|
-
fn.call(thisArg, loopable[i2], i2);
|
|
27448
|
-
}
|
|
27449
|
-
} else {
|
|
27717
|
+
{
|
|
27450
27718
|
for (i2 = 0; i2 < len; i2++) {
|
|
27451
27719
|
fn.call(thisArg, loopable[i2], i2);
|
|
27452
27720
|
}
|
|
@@ -28703,7 +28971,7 @@ function clearCanvas(canvas2, ctx) {
|
|
|
28703
28971
|
ctx.restore();
|
|
28704
28972
|
}
|
|
28705
28973
|
function drawPoint(ctx, options, x2, y2) {
|
|
28706
|
-
drawPointLegend(ctx, options, x2, y2
|
|
28974
|
+
drawPointLegend(ctx, options, x2, y2);
|
|
28707
28975
|
}
|
|
28708
28976
|
function drawPointLegend(ctx, options, x2, y2, w2) {
|
|
28709
28977
|
let type, xOffset, yOffset, size, cornerRadius, width;
|
|
@@ -28728,9 +28996,7 @@ function drawPointLegend(ctx, options, x2, y2, w2) {
|
|
|
28728
28996
|
ctx.beginPath();
|
|
28729
28997
|
switch (style) {
|
|
28730
28998
|
default:
|
|
28731
|
-
|
|
28732
|
-
ctx.ellipse(x2, y2, w2 / 2, radius, 0, 0, TAU);
|
|
28733
|
-
} else {
|
|
28999
|
+
{
|
|
28734
29000
|
ctx.arc(x2, y2, radius, 0, TAU);
|
|
28735
29001
|
}
|
|
28736
29002
|
ctx.closePath();
|
|
@@ -28757,7 +29023,7 @@ function drawPointLegend(ctx, options, x2, y2, w2) {
|
|
|
28757
29023
|
case "rect":
|
|
28758
29024
|
if (!rotation) {
|
|
28759
29025
|
size = Math.SQRT1_2 * radius;
|
|
28760
|
-
width =
|
|
29026
|
+
width = size;
|
|
28761
29027
|
ctx.rect(x2 - width, y2 - size, 2 * width, 2 * size);
|
|
28762
29028
|
break;
|
|
28763
29029
|
}
|
|
@@ -28797,7 +29063,7 @@ function drawPointLegend(ctx, options, x2, y2, w2) {
|
|
|
28797
29063
|
ctx.lineTo(x2 - yOffset, y2 + xOffset);
|
|
28798
29064
|
break;
|
|
28799
29065
|
case "line":
|
|
28800
|
-
xOffset =
|
|
29066
|
+
xOffset = Math.cos(rad) * radius;
|
|
28801
29067
|
yOffset = Math.sin(rad) * radius;
|
|
28802
29068
|
ctx.moveTo(x2 - xOffset, y2 - yOffset);
|
|
28803
29069
|
ctx.lineTo(x2 + xOffset, y2 + yOffset);
|
|
@@ -28985,25 +29251,13 @@ function toFont(options, fallback) {
|
|
|
28985
29251
|
return font;
|
|
28986
29252
|
}
|
|
28987
29253
|
function resolve(inputs, context, index2, info) {
|
|
28988
|
-
let cacheable = true;
|
|
28989
29254
|
let i2, ilen, value;
|
|
28990
29255
|
for (i2 = 0, ilen = inputs.length; i2 < ilen; ++i2) {
|
|
28991
29256
|
value = inputs[i2];
|
|
28992
29257
|
if (value === void 0) {
|
|
28993
29258
|
continue;
|
|
28994
29259
|
}
|
|
28995
|
-
if (context !== void 0 && typeof value === "function") {
|
|
28996
|
-
value = value(context);
|
|
28997
|
-
cacheable = false;
|
|
28998
|
-
}
|
|
28999
|
-
if (index2 !== void 0 && isArray(value)) {
|
|
29000
|
-
value = value[index2 % value.length];
|
|
29001
|
-
cacheable = false;
|
|
29002
|
-
}
|
|
29003
29260
|
if (value !== void 0) {
|
|
29004
|
-
if (info && !cacheable) {
|
|
29005
|
-
info.cacheable = false;
|
|
29006
|
-
}
|
|
29007
29261
|
return value;
|
|
29008
29262
|
}
|
|
29009
29263
|
}
|
|
@@ -39002,8 +39256,7 @@ var n = { value: () => {
|
|
|
39002
39256
|
} };
|
|
39003
39257
|
function e() {
|
|
39004
39258
|
for (var t, n2 = 0, e2 = arguments.length, i2 = {}; n2 < e2; ++n2) {
|
|
39005
|
-
if (!(t = arguments[n2] + "") || t in i2 || /[\s.]/.test(t))
|
|
39006
|
-
throw new Error("illegal type: " + t);
|
|
39259
|
+
if (!(t = arguments[n2] + "") || t in i2 || /[\s.]/.test(t)) throw new Error("illegal type: " + t);
|
|
39007
39260
|
i2[t] = [];
|
|
39008
39261
|
}
|
|
39009
39262
|
return new r(i2);
|
|
@@ -39014,58 +39267,40 @@ function r(t) {
|
|
|
39014
39267
|
function i(t, n2) {
|
|
39015
39268
|
return t.trim().split(/^|\s+/).map(function(t2) {
|
|
39016
39269
|
var e2 = "", r2 = t2.indexOf(".");
|
|
39017
|
-
if (r2 >= 0 && (e2 = t2.slice(r2 + 1), t2 = t2.slice(0, r2)), t2 && !n2.hasOwnProperty(t2))
|
|
39018
|
-
throw new Error("unknown type: " + t2);
|
|
39270
|
+
if (r2 >= 0 && (e2 = t2.slice(r2 + 1), t2 = t2.slice(0, r2)), t2 && !n2.hasOwnProperty(t2)) throw new Error("unknown type: " + t2);
|
|
39019
39271
|
return { type: t2, name: e2 };
|
|
39020
39272
|
});
|
|
39021
39273
|
}
|
|
39022
39274
|
function o(t, n2) {
|
|
39023
|
-
for (var e2, r2 = 0, i2 = t.length; r2 < i2; ++r2)
|
|
39024
|
-
if ((e2 = t[r2]).name === n2)
|
|
39025
|
-
return e2.value;
|
|
39275
|
+
for (var e2, r2 = 0, i2 = t.length; r2 < i2; ++r2) if ((e2 = t[r2]).name === n2) return e2.value;
|
|
39026
39276
|
}
|
|
39027
39277
|
function a(t, e2, r2) {
|
|
39028
|
-
for (var i2 = 0, o2 = t.length; i2 < o2; ++i2)
|
|
39029
|
-
|
|
39030
|
-
|
|
39031
|
-
|
|
39032
|
-
}
|
|
39278
|
+
for (var i2 = 0, o2 = t.length; i2 < o2; ++i2) if (t[i2].name === e2) {
|
|
39279
|
+
t[i2] = n, t = t.slice(0, i2).concat(t.slice(i2 + 1));
|
|
39280
|
+
break;
|
|
39281
|
+
}
|
|
39033
39282
|
return null != r2 && t.push({ name: e2, value: r2 }), t;
|
|
39034
39283
|
}
|
|
39035
39284
|
r.prototype = e.prototype = { constructor: r, on: function(t, n2) {
|
|
39036
39285
|
var e2, r2 = this._, u2 = i(t + "", r2), s2 = -1, c2 = u2.length;
|
|
39037
39286
|
if (!(arguments.length < 2)) {
|
|
39038
|
-
if (null != n2 && "function" != typeof n2)
|
|
39039
|
-
|
|
39040
|
-
for (
|
|
39041
|
-
if (e2 = (t = u2[s2]).type)
|
|
39042
|
-
r2[e2] = a(r2[e2], t.name, n2);
|
|
39043
|
-
else if (null == n2)
|
|
39044
|
-
for (e2 in r2)
|
|
39045
|
-
r2[e2] = a(r2[e2], t.name, null);
|
|
39287
|
+
if (null != n2 && "function" != typeof n2) throw new Error("invalid callback: " + n2);
|
|
39288
|
+
for (; ++s2 < c2; ) if (e2 = (t = u2[s2]).type) r2[e2] = a(r2[e2], t.name, n2);
|
|
39289
|
+
else if (null == n2) for (e2 in r2) r2[e2] = a(r2[e2], t.name, null);
|
|
39046
39290
|
return this;
|
|
39047
39291
|
}
|
|
39048
|
-
for (; ++s2 < c2; )
|
|
39049
|
-
if ((e2 = (t = u2[s2]).type) && (e2 = o(r2[e2], t.name)))
|
|
39050
|
-
return e2;
|
|
39292
|
+
for (; ++s2 < c2; ) if ((e2 = (t = u2[s2]).type) && (e2 = o(r2[e2], t.name))) return e2;
|
|
39051
39293
|
}, copy: function() {
|
|
39052
39294
|
var t = {}, n2 = this._;
|
|
39053
|
-
for (var e2 in n2)
|
|
39054
|
-
t[e2] = n2[e2].slice();
|
|
39295
|
+
for (var e2 in n2) t[e2] = n2[e2].slice();
|
|
39055
39296
|
return new r(t);
|
|
39056
39297
|
}, call: function(t, n2) {
|
|
39057
|
-
if ((e2 = arguments.length - 2) > 0)
|
|
39058
|
-
|
|
39059
|
-
|
|
39060
|
-
if (!this._.hasOwnProperty(t))
|
|
39061
|
-
throw new Error("unknown type: " + t);
|
|
39062
|
-
for (o2 = 0, e2 = (r2 = this._[t]).length; o2 < e2; ++o2)
|
|
39063
|
-
r2[o2].value.apply(n2, i2);
|
|
39298
|
+
if ((e2 = arguments.length - 2) > 0) for (var e2, r2, i2 = new Array(e2), o2 = 0; o2 < e2; ++o2) i2[o2] = arguments[o2 + 2];
|
|
39299
|
+
if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
|
|
39300
|
+
for (o2 = 0, e2 = (r2 = this._[t]).length; o2 < e2; ++o2) r2[o2].value.apply(n2, i2);
|
|
39064
39301
|
}, apply: function(t, n2, e2) {
|
|
39065
|
-
if (!this._.hasOwnProperty(t))
|
|
39066
|
-
|
|
39067
|
-
for (var r2 = this._[t], i2 = 0, o2 = r2.length; i2 < o2; ++i2)
|
|
39068
|
-
r2[i2].value.apply(n2, e2);
|
|
39302
|
+
if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
|
|
39303
|
+
for (var r2 = this._[t], i2 = 0, o2 = r2.length; i2 < o2; ++i2) r2[i2].value.apply(n2, e2);
|
|
39069
39304
|
} };
|
|
39070
39305
|
var u = "http://www.w3.org/1999/xhtml", s = { svg: "http://www.w3.org/2000/svg", xhtml: u, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" };
|
|
39071
39306
|
function c(t) {
|
|
@@ -39125,19 +39360,14 @@ function E(t) {
|
|
|
39125
39360
|
};
|
|
39126
39361
|
}
|
|
39127
39362
|
function D(t, n2, e2, r2, i2, o2) {
|
|
39128
|
-
for (var a2, u2 = 0, s2 = n2.length, c2 = o2.length; u2 < c2; ++u2)
|
|
39129
|
-
|
|
39130
|
-
for (; u2 < s2; ++u2)
|
|
39131
|
-
(a2 = n2[u2]) && (i2[u2] = a2);
|
|
39363
|
+
for (var a2, u2 = 0, s2 = n2.length, c2 = o2.length; u2 < c2; ++u2) (a2 = n2[u2]) ? (a2.__data__ = o2[u2], r2[u2] = a2) : e2[u2] = new A(t, o2[u2]);
|
|
39364
|
+
for (; u2 < s2; ++u2) (a2 = n2[u2]) && (i2[u2] = a2);
|
|
39132
39365
|
}
|
|
39133
39366
|
function S(t, n2, e2, r2, i2, o2, a2) {
|
|
39134
39367
|
var u2, s2, c2, l2 = /* @__PURE__ */ new Map(), f2 = n2.length, h3 = o2.length, p2 = new Array(f2);
|
|
39135
|
-
for (u2 = 0; u2 < f2; ++u2)
|
|
39136
|
-
|
|
39137
|
-
for (u2 = 0; u2 <
|
|
39138
|
-
c2 = a2.call(t, o2[u2], u2, o2) + "", (s2 = l2.get(c2)) ? (r2[u2] = s2, s2.__data__ = o2[u2], l2.delete(c2)) : e2[u2] = new A(t, o2[u2]);
|
|
39139
|
-
for (u2 = 0; u2 < f2; ++u2)
|
|
39140
|
-
(s2 = n2[u2]) && l2.get(p2[u2]) === s2 && (i2[u2] = s2);
|
|
39368
|
+
for (u2 = 0; u2 < f2; ++u2) (s2 = n2[u2]) && (p2[u2] = c2 = a2.call(s2, s2.__data__, u2, n2) + "", l2.has(c2) ? i2[u2] = s2 : l2.set(c2, s2));
|
|
39369
|
+
for (u2 = 0; u2 < h3; ++u2) c2 = a2.call(t, o2[u2], u2, o2) + "", (s2 = l2.get(c2)) ? (r2[u2] = s2, s2.__data__ = o2[u2], l2.delete(c2)) : e2[u2] = new A(t, o2[u2]);
|
|
39370
|
+
for (u2 = 0; u2 < f2; ++u2) (s2 = n2[u2]) && l2.get(p2[u2]) === s2 && (i2[u2] = s2);
|
|
39141
39371
|
}
|
|
39142
39372
|
function C(t) {
|
|
39143
39373
|
return t.__data__;
|
|
@@ -39228,12 +39458,10 @@ function H(t) {
|
|
|
39228
39458
|
this._node = t, this._names = F(t.getAttribute("class") || "");
|
|
39229
39459
|
}
|
|
39230
39460
|
function G(t, n2) {
|
|
39231
|
-
for (var e2 = z(t), r2 = -1, i2 = n2.length; ++r2 < i2; )
|
|
39232
|
-
e2.add(n2[r2]);
|
|
39461
|
+
for (var e2 = z(t), r2 = -1, i2 = n2.length; ++r2 < i2; ) e2.add(n2[r2]);
|
|
39233
39462
|
}
|
|
39234
39463
|
function K(t, n2) {
|
|
39235
|
-
for (var e2 = z(t), r2 = -1, i2 = n2.length; ++r2 < i2; )
|
|
39236
|
-
e2.remove(n2[r2]);
|
|
39464
|
+
for (var e2 = z(t), r2 = -1, i2 = n2.length; ++r2 < i2; ) e2.remove(n2[r2]);
|
|
39237
39465
|
}
|
|
39238
39466
|
function J(t) {
|
|
39239
39467
|
return function() {
|
|
@@ -39309,23 +39537,20 @@ function ft(t) {
|
|
|
39309
39537
|
return function() {
|
|
39310
39538
|
var n2 = this.__on;
|
|
39311
39539
|
if (n2) {
|
|
39312
|
-
for (var e2, r2 = 0, i2 = -1, o2 = n2.length; r2 < o2; ++r2)
|
|
39313
|
-
e2 = n2[r2], t.type && e2.type !== t.type || e2.name !== t.name ? n2[++i2] = e2 : this.removeEventListener(e2.type, e2.listener, e2.options);
|
|
39540
|
+
for (var e2, r2 = 0, i2 = -1, o2 = n2.length; r2 < o2; ++r2) e2 = n2[r2], t.type && e2.type !== t.type || e2.name !== t.name ? n2[++i2] = e2 : this.removeEventListener(e2.type, e2.listener, e2.options);
|
|
39314
39541
|
++i2 ? n2.length = i2 : delete this.__on;
|
|
39315
39542
|
}
|
|
39316
39543
|
};
|
|
39317
39544
|
}
|
|
39318
39545
|
function ht(t, n2, e2) {
|
|
39319
39546
|
return function() {
|
|
39320
|
-
var r2, i2 = this.__on, o2 = function(t2) {
|
|
39547
|
+
var r2, i2 = this.__on, o2 = /* @__PURE__ */ function(t2) {
|
|
39321
39548
|
return function(n3) {
|
|
39322
39549
|
t2.call(this, n3, this.__data__);
|
|
39323
39550
|
};
|
|
39324
39551
|
}(n2);
|
|
39325
39552
|
if (i2) {
|
|
39326
|
-
for (var a2 = 0, u2 = i2.length; a2 < u2; ++a2)
|
|
39327
|
-
if ((r2 = i2[a2]).type === t.type && r2.name === t.name)
|
|
39328
|
-
return this.removeEventListener(r2.type, r2.listener, r2.options), this.addEventListener(r2.type, r2.listener = o2, r2.options = e2), void (r2.value = n2);
|
|
39553
|
+
for (var a2 = 0, u2 = i2.length; a2 < u2; ++a2) if ((r2 = i2[a2]).type === t.type && r2.name === t.name) return this.removeEventListener(r2.type, r2.listener, r2.options), this.addEventListener(r2.type, r2.listener = o2, r2.options = e2), void (r2.value = n2);
|
|
39329
39554
|
}
|
|
39330
39555
|
this.addEventListener(t.type, o2, e2), r2 = { type: t.type, name: t.name, value: n2, listener: o2, options: e2 }, i2 ? i2.push(r2) : this.__on = [r2];
|
|
39331
39556
|
};
|
|
@@ -39370,8 +39595,7 @@ function mt(t) {
|
|
|
39370
39595
|
function _t(t, n2) {
|
|
39371
39596
|
if (t = function(t2) {
|
|
39372
39597
|
let n3;
|
|
39373
|
-
for (; n3 = t2.sourceEvent; )
|
|
39374
|
-
t2 = n3;
|
|
39598
|
+
for (; n3 = t2.sourceEvent; ) t2 = n3;
|
|
39375
39599
|
return t2;
|
|
39376
39600
|
}(t), void 0 === n2 && (n2 = t.currentTarget), n2) {
|
|
39377
39601
|
var e2 = n2.ownerSVGElement || n2;
|
|
@@ -39388,12 +39612,10 @@ function _t(t, n2) {
|
|
|
39388
39612
|
}
|
|
39389
39613
|
yt.prototype = { constructor: yt, select: function(t) {
|
|
39390
39614
|
"function" != typeof t && (t = d(t));
|
|
39391
|
-
for (var n2 = this._groups, e2 = n2.length, r2 = new Array(e2), i2 = 0; i2 < e2; ++i2)
|
|
39392
|
-
for (var o2, a2, u2 = n2[i2], s2 = u2.length, c2 = r2[i2] = new Array(s2), l2 = 0; l2 < s2; ++l2)
|
|
39393
|
-
(o2 = u2[l2]) && (a2 = t.call(o2, o2.__data__, l2, u2)) && ("__data__" in o2 && (a2.__data__ = o2.__data__), c2[l2] = a2);
|
|
39615
|
+
for (var n2 = this._groups, e2 = n2.length, r2 = new Array(e2), i2 = 0; i2 < e2; ++i2) for (var o2, a2, u2 = n2[i2], s2 = u2.length, c2 = r2[i2] = new Array(s2), l2 = 0; l2 < s2; ++l2) (o2 = u2[l2]) && (a2 = t.call(o2, o2.__data__, l2, u2)) && ("__data__" in o2 && (a2.__data__ = o2.__data__), c2[l2] = a2);
|
|
39394
39616
|
return new yt(r2, this._parents);
|
|
39395
39617
|
}, selectAll: function(t) {
|
|
39396
|
-
t = "function" == typeof t ? function(t2) {
|
|
39618
|
+
t = "function" == typeof t ? /* @__PURE__ */ function(t2) {
|
|
39397
39619
|
return function() {
|
|
39398
39620
|
return g(t2.apply(this, arguments));
|
|
39399
39621
|
};
|
|
@@ -39402,46 +39624,39 @@ yt.prototype = { constructor: yt, select: function(t) {
|
|
|
39402
39624
|
return this.querySelectorAll(t2);
|
|
39403
39625
|
};
|
|
39404
39626
|
}(t);
|
|
39405
|
-
for (var n2 = this._groups, e2 = n2.length, r2 = [], i2 = [], o2 = 0; o2 < e2; ++o2)
|
|
39406
|
-
for (var a2, u2 = n2[o2], s2 = u2.length, c2 = 0; c2 < s2; ++c2)
|
|
39407
|
-
(a2 = u2[c2]) && (r2.push(t.call(a2, a2.__data__, c2, u2)), i2.push(a2));
|
|
39627
|
+
for (var n2 = this._groups, e2 = n2.length, r2 = [], i2 = [], o2 = 0; o2 < e2; ++o2) for (var a2, u2 = n2[o2], s2 = u2.length, c2 = 0; c2 < s2; ++c2) (a2 = u2[c2]) && (r2.push(t.call(a2, a2.__data__, c2, u2)), i2.push(a2));
|
|
39408
39628
|
return new yt(r2, i2);
|
|
39409
39629
|
}, selectChild: function(t) {
|
|
39410
|
-
return this.select(null == t ? _ : function(t2) {
|
|
39630
|
+
return this.select(null == t ? _ : /* @__PURE__ */ function(t2) {
|
|
39411
39631
|
return function() {
|
|
39412
39632
|
return m.call(this.children, t2);
|
|
39413
39633
|
};
|
|
39414
39634
|
}("function" == typeof t ? t : y(t)));
|
|
39415
39635
|
}, selectChildren: function(t) {
|
|
39416
|
-
return this.selectAll(null == t ? x : function(t2) {
|
|
39636
|
+
return this.selectAll(null == t ? x : /* @__PURE__ */ function(t2) {
|
|
39417
39637
|
return function() {
|
|
39418
39638
|
return w.call(this.children, t2);
|
|
39419
39639
|
};
|
|
39420
39640
|
}("function" == typeof t ? t : y(t)));
|
|
39421
39641
|
}, filter: function(t) {
|
|
39422
|
-
"function" != typeof t && (t = function(t2) {
|
|
39642
|
+
"function" != typeof t && (t = /* @__PURE__ */ function(t2) {
|
|
39423
39643
|
return function() {
|
|
39424
39644
|
return this.matches(t2);
|
|
39425
39645
|
};
|
|
39426
39646
|
}(t));
|
|
39427
|
-
for (var n2 = this._groups, e2 = n2.length, r2 = new Array(e2), i2 = 0; i2 < e2; ++i2)
|
|
39428
|
-
for (var o2, a2 = n2[i2], u2 = a2.length, s2 = r2[i2] = [], c2 = 0; c2 < u2; ++c2)
|
|
39429
|
-
(o2 = a2[c2]) && t.call(o2, o2.__data__, c2, a2) && s2.push(o2);
|
|
39647
|
+
for (var n2 = this._groups, e2 = n2.length, r2 = new Array(e2), i2 = 0; i2 < e2; ++i2) for (var o2, a2 = n2[i2], u2 = a2.length, s2 = r2[i2] = [], c2 = 0; c2 < u2; ++c2) (o2 = a2[c2]) && t.call(o2, o2.__data__, c2, a2) && s2.push(o2);
|
|
39430
39648
|
return new yt(r2, this._parents);
|
|
39431
39649
|
}, data: function(t, n2) {
|
|
39432
|
-
if (!arguments.length)
|
|
39433
|
-
return Array.from(this, C);
|
|
39650
|
+
if (!arguments.length) return Array.from(this, C);
|
|
39434
39651
|
var e2 = n2 ? S : D, r2 = this._parents, i2 = this._groups;
|
|
39435
39652
|
"function" != typeof t && (t = E(t));
|
|
39436
39653
|
for (var o2 = i2.length, a2 = new Array(o2), u2 = new Array(o2), s2 = new Array(o2), c2 = 0; c2 < o2; ++c2) {
|
|
39437
39654
|
var l2 = r2[c2], f2 = i2[c2], h3 = f2.length, p2 = M(t.call(l2, l2 && l2.__data__, c2, r2)), d2 = p2.length, g2 = u2[c2] = new Array(d2), v2 = a2[c2] = new Array(d2), y2 = s2[c2] = new Array(h3);
|
|
39438
39655
|
e2(l2, f2, g2, v2, y2, p2, n2);
|
|
39439
|
-
for (var m2, _2, w2 = 0, x2 = 0; w2 < d2; ++w2)
|
|
39440
|
-
|
|
39441
|
-
|
|
39442
|
-
|
|
39443
|
-
m2._next = _2 || null;
|
|
39444
|
-
}
|
|
39656
|
+
for (var m2, _2, w2 = 0, x2 = 0; w2 < d2; ++w2) if (m2 = g2[w2]) {
|
|
39657
|
+
for (w2 >= x2 && (x2 = w2 + 1); !(_2 = v2[x2]) && ++x2 < d2; ) ;
|
|
39658
|
+
m2._next = _2 || null;
|
|
39659
|
+
}
|
|
39445
39660
|
}
|
|
39446
39661
|
return (a2 = new yt(a2, r2))._enter = u2, a2._exit = s2, a2;
|
|
39447
39662
|
}, enter: function() {
|
|
@@ -39452,18 +39667,13 @@ yt.prototype = { constructor: yt, select: function(t) {
|
|
|
39452
39667
|
var r2 = this.enter(), i2 = this, o2 = this.exit();
|
|
39453
39668
|
return "function" == typeof t ? (r2 = t(r2)) && (r2 = r2.selection()) : r2 = r2.append(t + ""), null != n2 && (i2 = n2(i2)) && (i2 = i2.selection()), null == e2 ? o2.remove() : e2(o2), r2 && i2 ? r2.merge(i2).order() : i2;
|
|
39454
39669
|
}, merge: function(t) {
|
|
39455
|
-
for (var n2 = t.selection ? t.selection() : t, e2 = this._groups, r2 = n2._groups, i2 = e2.length, o2 = r2.length, a2 = Math.min(i2, o2), u2 = new Array(i2), s2 = 0; s2 < a2; ++s2)
|
|
39456
|
-
|
|
39457
|
-
(c2 = l2[d2] || f2[d2]) && (p2[d2] = c2);
|
|
39458
|
-
for (; s2 < i2; ++s2)
|
|
39459
|
-
u2[s2] = e2[s2];
|
|
39670
|
+
for (var n2 = t.selection ? t.selection() : t, e2 = this._groups, r2 = n2._groups, i2 = e2.length, o2 = r2.length, a2 = Math.min(i2, o2), u2 = new Array(i2), s2 = 0; s2 < a2; ++s2) for (var c2, l2 = e2[s2], f2 = r2[s2], h3 = l2.length, p2 = u2[s2] = new Array(h3), d2 = 0; d2 < h3; ++d2) (c2 = l2[d2] || f2[d2]) && (p2[d2] = c2);
|
|
39671
|
+
for (; s2 < i2; ++s2) u2[s2] = e2[s2];
|
|
39460
39672
|
return new yt(u2, this._parents);
|
|
39461
39673
|
}, selection: function() {
|
|
39462
39674
|
return this;
|
|
39463
39675
|
}, order: function() {
|
|
39464
|
-
for (var t = this._groups, n2 = -1, e2 = t.length; ++n2 < e2; )
|
|
39465
|
-
for (var r2, i2 = t[n2], o2 = i2.length - 1, a2 = i2[o2]; --o2 >= 0; )
|
|
39466
|
-
(r2 = i2[o2]) && (a2 && 4 ^ r2.compareDocumentPosition(a2) && a2.parentNode.insertBefore(r2, a2), a2 = r2);
|
|
39676
|
+
for (var t = this._groups, n2 = -1, e2 = t.length; ++n2 < e2; ) for (var r2, i2 = t[n2], o2 = i2.length - 1, a2 = i2[o2]; --o2 >= 0; ) (r2 = i2[o2]) && (a2 && 4 ^ r2.compareDocumentPosition(a2) && a2.parentNode.insertBefore(r2, a2), a2 = r2);
|
|
39467
39677
|
return this;
|
|
39468
39678
|
}, sort: function(t) {
|
|
39469
39679
|
function n2(n3, e3) {
|
|
@@ -39471,8 +39681,7 @@ yt.prototype = { constructor: yt, select: function(t) {
|
|
|
39471
39681
|
}
|
|
39472
39682
|
t || (t = N);
|
|
39473
39683
|
for (var e2 = this._groups, r2 = e2.length, i2 = new Array(r2), o2 = 0; o2 < r2; ++o2) {
|
|
39474
|
-
for (var a2, u2 = e2[o2], s2 = u2.length, c2 = i2[o2] = new Array(s2), l2 = 0; l2 < s2; ++l2)
|
|
39475
|
-
(a2 = u2[l2]) && (c2[l2] = a2);
|
|
39684
|
+
for (var a2, u2 = e2[o2], s2 = u2.length, c2 = i2[o2] = new Array(s2), l2 = 0; l2 < s2; ++l2) (a2 = u2[l2]) && (c2[l2] = a2);
|
|
39476
39685
|
c2.sort(n2);
|
|
39477
39686
|
}
|
|
39478
39687
|
return new yt(i2, this._parents).order();
|
|
@@ -39482,24 +39691,19 @@ yt.prototype = { constructor: yt, select: function(t) {
|
|
|
39482
39691
|
}, nodes: function() {
|
|
39483
39692
|
return Array.from(this);
|
|
39484
39693
|
}, node: function() {
|
|
39485
|
-
for (var t = this._groups, n2 = 0, e2 = t.length; n2 < e2; ++n2)
|
|
39486
|
-
|
|
39487
|
-
|
|
39488
|
-
|
|
39489
|
-
return a2;
|
|
39490
|
-
}
|
|
39694
|
+
for (var t = this._groups, n2 = 0, e2 = t.length; n2 < e2; ++n2) for (var r2 = t[n2], i2 = 0, o2 = r2.length; i2 < o2; ++i2) {
|
|
39695
|
+
var a2 = r2[i2];
|
|
39696
|
+
if (a2) return a2;
|
|
39697
|
+
}
|
|
39491
39698
|
return null;
|
|
39492
39699
|
}, size: function() {
|
|
39493
39700
|
let t = 0;
|
|
39494
|
-
for (const n2 of this)
|
|
39495
|
-
++t;
|
|
39701
|
+
for (const n2 of this) ++t;
|
|
39496
39702
|
return t;
|
|
39497
39703
|
}, empty: function() {
|
|
39498
39704
|
return !this.node();
|
|
39499
39705
|
}, each: function(t) {
|
|
39500
|
-
for (var n2 = this._groups, e2 = 0, r2 = n2.length; e2 < r2; ++e2)
|
|
39501
|
-
for (var i2, o2 = n2[e2], a2 = 0, u2 = o2.length; a2 < u2; ++a2)
|
|
39502
|
-
(i2 = o2[a2]) && t.call(i2, i2.__data__, a2, o2);
|
|
39706
|
+
for (var n2 = this._groups, e2 = 0, r2 = n2.length; e2 < r2; ++e2) for (var i2, o2 = n2[e2], a2 = 0, u2 = o2.length; a2 < u2; ++a2) (i2 = o2[a2]) && t.call(i2, i2.__data__, a2, o2);
|
|
39503
39707
|
return this;
|
|
39504
39708
|
}, attr: function(t, n2) {
|
|
39505
39709
|
var e2 = c(t);
|
|
@@ -39515,9 +39719,7 @@ yt.prototype = { constructor: yt, select: function(t) {
|
|
|
39515
39719
|
}, classed: function(t, n2) {
|
|
39516
39720
|
var e2 = F(t + "");
|
|
39517
39721
|
if (arguments.length < 2) {
|
|
39518
|
-
for (var r2 = z(this.node()), i2 = -1, o2 = e2.length; ++i2 < o2; )
|
|
39519
|
-
if (!r2.contains(e2[i2]))
|
|
39520
|
-
return false;
|
|
39722
|
+
for (var r2 = z(this.node()), i2 = -1, o2 = e2.length; ++i2 < o2; ) if (!r2.contains(e2[i2])) return false;
|
|
39521
39723
|
return true;
|
|
39522
39724
|
}
|
|
39523
39725
|
return this.each(("function" == typeof n2 ? W : n2 ? J : Q)(e2, n2));
|
|
@@ -39548,23 +39750,17 @@ yt.prototype = { constructor: yt, select: function(t) {
|
|
|
39548
39750
|
}, on: function(t, n2, e2) {
|
|
39549
39751
|
var r2, i2, o2 = lt(t + ""), a2 = o2.length;
|
|
39550
39752
|
if (!(arguments.length < 2)) {
|
|
39551
|
-
for (u2 = n2 ? ht : ft, r2 = 0; r2 < a2; ++r2)
|
|
39552
|
-
this.each(u2(o2[r2], n2, e2));
|
|
39753
|
+
for (u2 = n2 ? ht : ft, r2 = 0; r2 < a2; ++r2) this.each(u2(o2[r2], n2, e2));
|
|
39553
39754
|
return this;
|
|
39554
39755
|
}
|
|
39555
39756
|
var u2 = this.node().__on;
|
|
39556
39757
|
if (u2) {
|
|
39557
|
-
for (var s2, c2 = 0, l2 = u2.length; c2 < l2; ++c2)
|
|
39558
|
-
for (r2 = 0, s2 = u2[c2]; r2 < a2; ++r2)
|
|
39559
|
-
if ((i2 = o2[r2]).type === s2.type && i2.name === s2.name)
|
|
39560
|
-
return s2.value;
|
|
39758
|
+
for (var s2, c2 = 0, l2 = u2.length; c2 < l2; ++c2) for (r2 = 0, s2 = u2[c2]; r2 < a2; ++r2) if ((i2 = o2[r2]).type === s2.type && i2.name === s2.name) return s2.value;
|
|
39561
39759
|
}
|
|
39562
39760
|
}, dispatch: function(t, n2) {
|
|
39563
39761
|
return this.each(("function" == typeof n2 ? gt : dt)(t, n2));
|
|
39564
39762
|
}, [Symbol.iterator]: function* () {
|
|
39565
|
-
for (var t = this._groups, n2 = 0, e2 = t.length; n2 < e2; ++n2)
|
|
39566
|
-
for (var r2, i2 = t[n2], o2 = 0, a2 = i2.length; o2 < a2; ++o2)
|
|
39567
|
-
(r2 = i2[o2]) && (yield r2);
|
|
39763
|
+
for (var t = this._groups, n2 = 0, e2 = t.length; n2 < e2; ++n2) for (var r2, i2 = t[n2], o2 = 0, a2 = i2.length; o2 < a2; ++o2) (r2 = i2[o2]) && (yield r2);
|
|
39568
39764
|
} };
|
|
39569
39765
|
const wt = { passive: false }, xt = { capture: true, passive: false };
|
|
39570
39766
|
function bt(t) {
|
|
@@ -39621,38 +39817,34 @@ function Pt() {
|
|
|
39621
39817
|
function y2(t2, n3) {
|
|
39622
39818
|
if (o2.call(this, t2, n3)) {
|
|
39623
39819
|
var e2, r3, i3 = t2.changedTouches, u3 = a2.call(this, t2, n3), s3 = i3.length;
|
|
39624
|
-
for (e2 = 0; e2 < s3; ++e2)
|
|
39625
|
-
(r3 = w2(this, u3, t2, n3, i3[e2].identifier, i3[e2])) && (bt(t2), r3("start", t2, i3[e2]));
|
|
39820
|
+
for (e2 = 0; e2 < s3; ++e2) (r3 = w2(this, u3, t2, n3, i3[e2].identifier, i3[e2])) && (bt(t2), r3("start", t2, i3[e2]));
|
|
39626
39821
|
}
|
|
39627
39822
|
}
|
|
39628
39823
|
function m2(t2) {
|
|
39629
39824
|
var n3, e2, r3 = t2.changedTouches, i3 = r3.length;
|
|
39630
|
-
for (n3 = 0; n3 < i3; ++n3)
|
|
39631
|
-
(e2 = c2[r3[n3].identifier]) && (At(t2), e2("drag", t2, r3[n3]));
|
|
39825
|
+
for (n3 = 0; n3 < i3; ++n3) (e2 = c2[r3[n3].identifier]) && (At(t2), e2("drag", t2, r3[n3]));
|
|
39632
39826
|
}
|
|
39633
39827
|
function _2(t2) {
|
|
39634
39828
|
var n3, e2, r3 = t2.changedTouches, o3 = r3.length;
|
|
39635
39829
|
for (i2 && clearTimeout(i2), i2 = setTimeout(function() {
|
|
39636
39830
|
i2 = null;
|
|
39637
|
-
}, 500), n3 = 0; n3 < o3; ++n3)
|
|
39638
|
-
(e2 = c2[r3[n3].identifier]) && (bt(t2), e2("end", t2, r3[n3]));
|
|
39831
|
+
}, 500), n3 = 0; n3 < o3; ++n3) (e2 = c2[r3[n3].identifier]) && (bt(t2), e2("end", t2, r3[n3]));
|
|
39639
39832
|
}
|
|
39640
39833
|
function w2(t2, n3, e2, r3, i3, o3) {
|
|
39641
39834
|
var a3, s3, h4, d3 = l2.copy(), g3 = _t(o3 || e2, n3);
|
|
39642
|
-
if (null != (h4 = u2.call(t2, new Dt("beforestart", { sourceEvent: e2, target: p2, identifier: i3, active: f2, x: g3[0], y: g3[1], dx: 0, dy: 0, dispatch: d3 }), r3)))
|
|
39643
|
-
|
|
39644
|
-
|
|
39645
|
-
|
|
39646
|
-
|
|
39647
|
-
|
|
39648
|
-
|
|
39649
|
-
|
|
39650
|
-
|
|
39651
|
-
|
|
39652
|
-
|
|
39653
|
-
|
|
39654
|
-
|
|
39655
|
-
};
|
|
39835
|
+
if (null != (h4 = u2.call(t2, new Dt("beforestart", { sourceEvent: e2, target: p2, identifier: i3, active: f2, x: g3[0], y: g3[1], dx: 0, dy: 0, dispatch: d3 }), r3))) return a3 = h4.x - g3[0] || 0, s3 = h4.y - g3[1] || 0, function e3(o4, u3, l3) {
|
|
39836
|
+
var v3, y3 = g3;
|
|
39837
|
+
switch (o4) {
|
|
39838
|
+
case "start":
|
|
39839
|
+
c2[i3] = e3, v3 = f2++;
|
|
39840
|
+
break;
|
|
39841
|
+
case "end":
|
|
39842
|
+
delete c2[i3], --f2;
|
|
39843
|
+
case "drag":
|
|
39844
|
+
g3 = _t(l3 || u3, n3), v3 = f2;
|
|
39845
|
+
}
|
|
39846
|
+
d3.call(o4, t2, new Dt(o4, { sourceEvent: u3, subject: h4, target: p2, identifier: i3, active: v3, x: g3[0] + a3, y: g3[1] + s3, dx: g3[0] - y3[0], dy: g3[1] - y3[1], dispatch: d3 }), r3);
|
|
39847
|
+
};
|
|
39656
39848
|
}
|
|
39657
39849
|
return p2.filter = function(t2) {
|
|
39658
39850
|
return arguments.length ? (o2 = "function" == typeof t2 ? t2 : Et(!!t2), p2) : o2;
|
|
@@ -39692,17 +39884,15 @@ const zt = (t, n2, e2, r2) => {
|
|
|
39692
39884
|
if (Bt) {
|
|
39693
39885
|
Xt = Bt.datasetIndex, jt = Bt.index, qt = true;
|
|
39694
39886
|
let i2 = n2.data.datasets[Xt].data[jt];
|
|
39695
|
-
if ("radar" === Rt || "polarArea" === Rt)
|
|
39696
|
-
|
|
39697
|
-
|
|
39698
|
-
|
|
39699
|
-
|
|
39700
|
-
|
|
39701
|
-
}(t, n2);
|
|
39887
|
+
if ("radar" === Rt || "polarArea" === Rt) i2 = function(t2, n3) {
|
|
39888
|
+
let e3, r3, i3;
|
|
39889
|
+
t2.touches ? (e3 = t2.touches[0].clientX - n3.canvas.getBoundingClientRect().left, r3 = t2.touches[0].clientY - n3.canvas.getBoundingClientRect().top) : (e3 = t2.clientX - n3.canvas.getBoundingClientRect().left, r3 = t2.clientY - n3.canvas.getBoundingClientRect().top);
|
|
39890
|
+
let o2 = n3.scales[It], a2 = Math.sqrt(Math.pow(e3 - o2.xCenter, 2) + Math.pow(r3 - o2.yCenter, 2)), u2 = o2.drawingArea / (o2.max - o2.min);
|
|
39891
|
+
return i3 = o2.options.ticks.reverse ? o2.max - a2 / u2 : o2.min + a2 / u2, i3 = Ut(i3, n3.config.options.plugins.dragData.round), i3 = i3 > n3.scales[It].max ? n3.scales[It].max : i3, i3 = i3 < n3.scales[It].min ? n3.scales[It].min : i3, i3;
|
|
39892
|
+
}(t, n2);
|
|
39702
39893
|
else if (Lt) {
|
|
39703
39894
|
i2 = Ut(Ft(t, n2, Xt, jt) - Vt, e2.round);
|
|
39704
|
-
} else
|
|
39705
|
-
i2 = Ft(t, n2, Xt, jt);
|
|
39895
|
+
} else i2 = Ft(t, n2, Xt, jt);
|
|
39706
39896
|
(!r2 || "function" == typeof r2 && false !== r2(t, Xt, jt, i2)) && (n2.data.datasets[Xt].data[jt] = i2, n2.update("none"));
|
|
39707
39897
|
}
|
|
39708
39898
|
};
|
|
@@ -39721,8 +39911,7 @@ const Ht = { id: "dragdata", afterInit: function(t) {
|
|
|
39721
39911
|
}(() => n3.config.options.plugins.tooltip.animation);
|
|
39722
39912
|
const o2 = n3.data.datasets[r2], a2 = n3.getDatasetMeta(r2);
|
|
39723
39913
|
let u2 = o2.data[i2];
|
|
39724
|
-
if (kt = a2.xAxisID, Tt = a2.yAxisID, It = a2.rAxisID, false === o2.dragData || n3.config.options.scales[kt] && false === n3.config.options.scales[kt].dragData || n3.config.options.scales[Tt] && false === n3.config.options.scales[Tt].dragData || n3.config.options.scales[It] && false === n3.config.options.scales[It].rAxisID || false === o2.data[Bt.index].dragData)
|
|
39725
|
-
return void (Bt = null);
|
|
39914
|
+
if (kt = a2.xAxisID, Tt = a2.yAxisID, It = a2.rAxisID, false === o2.dragData || n3.config.options.scales[kt] && false === n3.config.options.scales[kt].dragData || n3.config.options.scales[Tt] && false === n3.config.options.scales[Tt].dragData || n3.config.options.scales[It] && false === n3.config.options.scales[It].rAxisID || false === o2.data[Bt.index].dragData) return void (Bt = null);
|
|
39726
39915
|
if ("bar" === Rt) {
|
|
39727
39916
|
Lt = n3.config.options.scales[kt].stacked;
|
|
39728
39917
|
const e4 = n3.data.datasets[0].data[0];
|
|
@@ -39737,8 +39926,7 @@ const Ht = { id: "dragdata", afterInit: function(t) {
|
|
|
39737
39926
|
const r2 = Bt.datasetIndex, i2 = Bt.index;
|
|
39738
39927
|
let o2 = function(t3, n4, e4) {
|
|
39739
39928
|
const r3 = t3.config.options.plugins.dragData;
|
|
39740
|
-
if (!r3.magnet)
|
|
39741
|
-
return t3.data.datasets[n4].data[e4];
|
|
39929
|
+
if (!r3.magnet) return t3.data.datasets[n4].data[e4];
|
|
39742
39930
|
{
|
|
39743
39931
|
const i3 = r3.magnet;
|
|
39744
39932
|
if (i3.to && "function" == typeof i3.to) {
|
|
@@ -39752,8 +39940,7 @@ const Ht = { id: "dragdata", afterInit: function(t) {
|
|
|
39752
39940
|
})(e2.sourceEvent, t, n2.onDragEnd)));
|
|
39753
39941
|
}
|
|
39754
39942
|
}, beforeEvent: function(t) {
|
|
39755
|
-
if (qt)
|
|
39756
|
-
return t.tooltip && t.tooltip.update(), false;
|
|
39943
|
+
if (qt) return t.tooltip && t.tooltip.update(), false;
|
|
39757
39944
|
} };
|
|
39758
39945
|
Chart.register(Ht);
|
|
39759
39946
|
const useBarChartConfig = (chartRef, chart2) => {
|
|
@@ -39976,8 +40163,7 @@ const getBarChartToolTips = (options) => {
|
|
|
39976
40163
|
const x2 = Array.isArray((_a3 = options.axes) == null ? void 0 : _a3.x) ? options.axes.x : [];
|
|
39977
40164
|
const y2 = Array.isArray((_b2 = options.axes) == null ? void 0 : _b2.y) ? options.axes.y : [];
|
|
39978
40165
|
const getAxisIndex = (axisID) => {
|
|
39979
|
-
if (!axisID)
|
|
39980
|
-
return 0;
|
|
40166
|
+
if (!axisID) return 0;
|
|
39981
40167
|
const match = axisID.match(/\d+$/);
|
|
39982
40168
|
return match ? parseInt(match[0], 10) - 1 : 0;
|
|
39983
40169
|
};
|
|
@@ -40608,8 +40794,7 @@ const gradientBackgroundPlugin = {
|
|
|
40608
40794
|
gradientColors,
|
|
40609
40795
|
direction = GradientDirection.BottomLeftToTopRight
|
|
40610
40796
|
} = gradientOptions ?? {};
|
|
40611
|
-
if (!display || !gradientColors || gradientColors.length === 0)
|
|
40612
|
-
return;
|
|
40797
|
+
if (!display || !gradientColors || gradientColors.length === 0) return;
|
|
40613
40798
|
const [x0, y0, x1, y1] = getGradientCoordinates(direction, chartArea);
|
|
40614
40799
|
const gradient = ctx.createLinearGradient(x0, y0, x1, y1);
|
|
40615
40800
|
gradientColors.forEach(({ offset, color: color2 }) => {
|
|
@@ -40705,9 +40890,13 @@ const ScatterChartWithLegend = (props) => {
|
|
|
40705
40890
|
return /* @__PURE__ */ jsx(LegendProvider, { options, children: /* @__PURE__ */ jsx(ScatterChart, { ...props }) });
|
|
40706
40891
|
};
|
|
40707
40892
|
export {
|
|
40893
|
+
AlignOptions,
|
|
40894
|
+
AnnotationType$1 as AnnotationType,
|
|
40708
40895
|
BarChartWithLegend as BarChart,
|
|
40709
40896
|
LineChartWithLegend as LineChart,
|
|
40710
40897
|
PieChartWithLegend as PieChart,
|
|
40898
|
+
PointStyle,
|
|
40899
|
+
Position,
|
|
40711
40900
|
ScatterChartWithLegend as ScatterChart,
|
|
40712
40901
|
initializeLineChart
|
|
40713
40902
|
};
|
|
@@ -40717,7 +40906,7 @@ export {
|
|
|
40717
40906
|
try {
|
|
40718
40907
|
if (typeof document != "undefined") {
|
|
40719
40908
|
var elementStyle = document.createElement("style");
|
|
40720
|
-
elementStyle.appendChild(document.createTextNode("html[data-theme='dark'] ._chart_e3qdd_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_e3qdd_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_e3qdd_1._fixedHeight_e3qdd_20 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_e3qdd_1._stretchHeight_e3qdd_26 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_e3qdd_1._squareAspectRatio_e3qdd_32 {\n aspect-ratio: 1;\n min-height: 0;\n min-width: 0;\n}\n._chart_e3qdd_1:focus {\n outline: none;\n}\n._chart_e3qdd_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_e3qdd_43 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_e3qdd_43 ._zoomReset_e3qdd_51 {\n margin-left: 10px;\n}\n._zoomForm_e3qdd_43 ._help_e3qdd_54 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_e3qdd_58 {\n width: auto;\n height: auto;\n}\n._table_e3qdd_62 {\n overflow: auto;\n}\n.
|
|
40909
|
+
elementStyle.appendChild(document.createTextNode("html[data-theme='dark'] ._chart_e3qdd_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_e3qdd_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_e3qdd_1._fixedHeight_e3qdd_20 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_e3qdd_1._stretchHeight_e3qdd_26 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_e3qdd_1._squareAspectRatio_e3qdd_32 {\n aspect-ratio: 1;\n min-height: 0;\n min-width: 0;\n}\n._chart_e3qdd_1:focus {\n outline: none;\n}\n._chart_e3qdd_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_e3qdd_43 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_e3qdd_43 ._zoomReset_e3qdd_51 {\n margin-left: 10px;\n}\n._zoomForm_e3qdd_43 ._help_e3qdd_54 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_e3qdd_58 {\n width: auto;\n height: auto;\n}\n._table_e3qdd_62 {\n overflow: auto;\n}\n._controls_1edjs_1 {\n display: flex;\n align-items: center;\n gap: var(--padding-xs);\n}\n._buttons_1edjs_6 {\n display: flex;\n flex-grow: 1;\n align-items: flex-start;\n justify-content: flex-end;\n margin-left: auto;\n gap: var(--padding-xxs);\n}\n._legend_wpro0_1 {\n position: absolute;\n opacity: 0.9;\n display: flex;\n flex-direction: column;\n z-index: 1;\n}\n._legend_wpro0_1._isDragging_wpro0_8 {\n opacity: 0;\n}\n._legendItems_wpro0_11 {\n background-color: var(--color-background-raised);\n border: 1px solid var(--color-border);\n padding: 4px 8px;\n border-radius: 2px;\n overflow-y: auto;\n max-height: 100%;\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._legendItems_wpro0_11::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-button {\n display: none;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n pointer-events: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n display: none;\n}\n._legendToggle_wpro0_50 {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50,\n._legend_wpro0_1:hover ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: block;\n}\n._legend_wpro0_1:active ._legendToggle_wpro0_50._legendToggle_wpro0_50:not(:hover) {\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n position: static;\n transform: none;\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: none;\n}\n._legendItem_wpro0_11 {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n user-select: none;\n cursor: pointer;\n font-size: 12px;\n line-height: 16px;\n}\n._legendItemSymbol_wpro0_80 {\n display: flex;\n align-items: center;\n height: 16px;\n position: relative;\n flex-shrink: 0;\n}\nhtml[data-theme='dark'] ._legendItemSymbol_wpro0_80._legendItemSymbol_wpro0_80 {\n filter: invert(1) hue-rotate(180deg);\n}\n._legendItemBox_wpro0_90 {\n width: 100%;\n height: 12px;\n display: block;\n}\n._legendItemLine_wpro0_95 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 0;\n width: 100%;\n transform: translateY(-50%);\n}\n._legendItemPoint_wpro0_103 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n._isHidden_wpro0_47 ._legendItemText_wpro0_110._legendItemText_wpro0_110 {\n text-decoration: line-through;\n}\n._scrollbars_wpro0_113 {\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-button {\n display: none;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._dropzoneContainer_wpro0_140 {\n position: absolute;\n}\n._dropzone_wpro0_140 {\n position: absolute;\n width: 50%;\n height: 50%;\n display: flex;\n}\n._dropzone_wpro0_140._left_wpro0_149 {\n left: 0;\n justify-content: flex-start;\n}\n._dropzone_wpro0_140._right_wpro0_153 {\n right: 0;\n justify-content: flex-end;\n}\n._dropzone_wpro0_140._top_wpro0_157 {\n top: 0;\n align-items: flex-start;\n}\n._dropzone_wpro0_140._bottom_wpro0_161 {\n bottom: 0;\n align-items: flex-end;\n}\n._dropzonePlaceholder_wpro0_165 {\n position: absolute;\n background-color: rgba(0, 0, 0, 0.05);\n display: none;\n}\n[data-theme='dark'] ._dropzonePlaceholder_wpro0_165 {\n background-color: rgba(255, 255, 255, 0.05);\n}\n._isActive_wpro0_173 ._dropzonePlaceholder_wpro0_165._dropzonePlaceholder_wpro0_165 {\n display: block;\n}\n._resizeContainer_wpro0_176 {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\nhtml[data-theme='dark'] ._chart_1jdnu_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1jdnu_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1jdnu_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1jdnu_1._fixedHeight_1jdnu_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1jdnu_1._stretchHeight_1jdnu_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1jdnu_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1jdnu_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1jdnu_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1jdnu_32 ._zoomReset_1jdnu_40 {\n margin-left: 10px;\n}\n._zoomForm_1jdnu_32 ._help_1jdnu_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1jdnu_47 {\n width: 'auto';\n height: 'auto';\n}\nhtml[data-theme='dark'] ._chart_x1sru_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_x1sru_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n}\n._chart_x1sru_1 ._canvas_x1sru_10 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_x1sru_1 ._canvas_x1sru_10 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_x1sru_1._fixedHeight_x1sru_19 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_x1sru_1._stretchHeight_x1sru_25 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_x1sru_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_x1sru_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_x1sru_38 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_x1sru_38 ._zoomReset_x1sru_46 {\n margin-left: 10px;\n}\n._zoomForm_x1sru_38 ._help_x1sru_49 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_x1sru_53 {\n width: auto;\n height: auto;\n}\n._actions_x1sru_57 {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n}\nhtml[data-theme='dark'] ._chart_1jdnu_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1jdnu_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1jdnu_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1jdnu_1._fixedHeight_1jdnu_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1jdnu_1._stretchHeight_1jdnu_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1jdnu_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1jdnu_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1jdnu_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1jdnu_32 ._zoomReset_1jdnu_40 {\n margin-left: 10px;\n}\n._zoomForm_1jdnu_32 ._help_1jdnu_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1jdnu_47 {\n width: 'auto';\n height: 'auto';\n}"));
|
|
40721
40910
|
document.head.appendChild(elementStyle);
|
|
40722
40911
|
}
|
|
40723
40912
|
} catch (e) {
|