@oliasoft-open-source/charts-library 6.0.0 → 6.1.0
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 +310 -289
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
35
35
|
}
|
|
36
36
|
return to;
|
|
37
37
|
};
|
|
38
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
38
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
39
39
|
value: mod,
|
|
40
40
|
enumerable: true
|
|
41
41
|
}) : target, mod));
|
|
@@ -1563,7 +1563,7 @@ var Defaults = class {
|
|
|
1563
1563
|
appliers.forEach((apply) => apply(this));
|
|
1564
1564
|
}
|
|
1565
1565
|
};
|
|
1566
|
-
var defaults$1 = /*
|
|
1566
|
+
var defaults$1 = /* #__PURE__ */ new Defaults({
|
|
1567
1567
|
_scriptable: (name) => !name.startsWith("on"),
|
|
1568
1568
|
_indexable: (name) => name !== "events",
|
|
1569
1569
|
hover: { _fallback: "interaction" },
|
|
@@ -1759,9 +1759,7 @@ function drawPointLegend(ctx, options, x, y, w) {
|
|
|
1759
1759
|
ctx.moveTo(x, y);
|
|
1760
1760
|
ctx.lineTo(x + Math.cos(rad) * (w ? w / 2 : radius), y + Math.sin(rad) * radius);
|
|
1761
1761
|
break;
|
|
1762
|
-
case false:
|
|
1763
|
-
ctx.closePath();
|
|
1764
|
-
break;
|
|
1762
|
+
case false: ctx.closePath();
|
|
1765
1763
|
}
|
|
1766
1764
|
ctx.fill();
|
|
1767
1765
|
if (options.borderWidth > 0) ctx.stroke();
|
|
@@ -1894,9 +1892,7 @@ var FONT_STYLE = /^(normal|italic|initial|inherit|unset|(oblique( -?[0-9]?[0-9]d
|
|
|
1894
1892
|
value = +matches[2];
|
|
1895
1893
|
switch (matches[3]) {
|
|
1896
1894
|
case "px": return value;
|
|
1897
|
-
case "%":
|
|
1898
|
-
value /= 100;
|
|
1899
|
-
break;
|
|
1895
|
+
case "%": value /= 100;
|
|
1900
1896
|
}
|
|
1901
1897
|
return size * value;
|
|
1902
1898
|
}
|
|
@@ -3078,7 +3074,7 @@ var Animator = class {
|
|
|
3078
3074
|
return this._charts.delete(chart);
|
|
3079
3075
|
}
|
|
3080
3076
|
};
|
|
3081
|
-
var animator = /*
|
|
3077
|
+
var animator = /* #__PURE__ */ new Animator();
|
|
3082
3078
|
var transparent = "transparent";
|
|
3083
3079
|
var interpolators = {
|
|
3084
3080
|
boolean(from, to, factor) {
|
|
@@ -3237,10 +3233,12 @@ var Animations = class {
|
|
|
3237
3233
|
const value = values[prop];
|
|
3238
3234
|
let animation = running[prop];
|
|
3239
3235
|
const cfg = animatedProps.get(prop);
|
|
3240
|
-
if (animation)
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3236
|
+
if (animation) {
|
|
3237
|
+
if (cfg && animation.active()) {
|
|
3238
|
+
animation.update(cfg, value, date);
|
|
3239
|
+
continue;
|
|
3240
|
+
} else animation.cancel();
|
|
3241
|
+
}
|
|
3244
3242
|
if (!cfg || !cfg.duration) {
|
|
3245
3243
|
target[prop] = value;
|
|
3246
3244
|
continue;
|
|
@@ -5462,10 +5460,12 @@ function initCanvas(canvas, aspectRatio) {
|
|
|
5462
5460
|
const displayWidth = readUsedSize(canvas, "width");
|
|
5463
5461
|
if (displayWidth !== void 0) canvas.width = displayWidth;
|
|
5464
5462
|
}
|
|
5465
|
-
if (isNullOrEmpty(renderHeight))
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5463
|
+
if (isNullOrEmpty(renderHeight)) {
|
|
5464
|
+
if (canvas.style.height === "") canvas.height = canvas.width / (aspectRatio || 2);
|
|
5465
|
+
else {
|
|
5466
|
+
const displayHeight = readUsedSize(canvas, "height");
|
|
5467
|
+
if (displayHeight !== void 0) canvas.height = displayHeight;
|
|
5468
|
+
}
|
|
5469
5469
|
}
|
|
5470
5470
|
return canvas;
|
|
5471
5471
|
}
|
|
@@ -6181,14 +6181,15 @@ var Scale = class Scale extends Element {
|
|
|
6181
6181
|
const offsetRight = this.right - this.getPixelForTick(this.ticks.length - 1);
|
|
6182
6182
|
let paddingLeft = 0;
|
|
6183
6183
|
let paddingRight = 0;
|
|
6184
|
-
if (isRotated)
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6184
|
+
if (isRotated) {
|
|
6185
|
+
if (labelsBelowTicks) {
|
|
6186
|
+
paddingLeft = cos * first.width;
|
|
6187
|
+
paddingRight = sin * last.height;
|
|
6188
|
+
} else {
|
|
6189
|
+
paddingLeft = sin * first.height;
|
|
6190
|
+
paddingRight = cos * last.width;
|
|
6191
|
+
}
|
|
6192
|
+
} else if (align === "start") paddingRight = last.width;
|
|
6192
6193
|
else if (align === "end") paddingLeft = first.width;
|
|
6193
6194
|
else if (align !== "inner") {
|
|
6194
6195
|
paddingLeft = first.width / 2;
|
|
@@ -6522,13 +6523,16 @@ var Scale = class Scale extends Element {
|
|
|
6522
6523
|
let tickTextAlign = textAlign;
|
|
6523
6524
|
if (isHorizontal) {
|
|
6524
6525
|
x = pixel;
|
|
6525
|
-
if (textAlign === "inner")
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6526
|
+
if (textAlign === "inner") {
|
|
6527
|
+
if (i === ilen - 1) tickTextAlign = !this.options.reverse ? "right" : "left";
|
|
6528
|
+
else if (i === 0) tickTextAlign = !this.options.reverse ? "left" : "right";
|
|
6529
|
+
else tickTextAlign = "center";
|
|
6530
|
+
}
|
|
6531
|
+
if (position === "top") {
|
|
6532
|
+
if (crossAlign === "near" || rotation !== 0) textOffset = -lineCount * lineHeight + lineHeight / 2;
|
|
6533
|
+
else if (crossAlign === "center") textOffset = -labelSizes.highest.height / 2 - halfCount * lineHeight + lineHeight;
|
|
6534
|
+
else textOffset = -labelSizes.highest.height + lineHeight / 2;
|
|
6535
|
+
} else if (crossAlign === "near" || rotation !== 0) textOffset = lineHeight / 2;
|
|
6532
6536
|
else if (crossAlign === "center") textOffset = labelSizes.highest.height / 2 - halfCount * lineHeight;
|
|
6533
6537
|
else textOffset = labelSizes.highest.height - lineCount * lineHeight;
|
|
6534
6538
|
if (mirror) textOffset *= -1;
|
|
@@ -6548,9 +6552,7 @@ var Scale = class Scale extends Element {
|
|
|
6548
6552
|
case "middle":
|
|
6549
6553
|
top -= height / 2;
|
|
6550
6554
|
break;
|
|
6551
|
-
case "bottom":
|
|
6552
|
-
top -= height;
|
|
6553
|
-
break;
|
|
6555
|
+
case "bottom": top -= height;
|
|
6554
6556
|
}
|
|
6555
6557
|
switch (textAlign) {
|
|
6556
6558
|
case "center":
|
|
@@ -6559,10 +6561,8 @@ var Scale = class Scale extends Element {
|
|
|
6559
6561
|
case "right":
|
|
6560
6562
|
left -= width;
|
|
6561
6563
|
break;
|
|
6562
|
-
case "inner":
|
|
6563
|
-
|
|
6564
|
-
else if (i > 0) left -= width / 2;
|
|
6565
|
-
break;
|
|
6564
|
+
case "inner": if (i === ilen - 1) left -= width;
|
|
6565
|
+
else if (i > 0) left -= width / 2;
|
|
6566
6566
|
}
|
|
6567
6567
|
backdrop = {
|
|
6568
6568
|
left,
|
|
@@ -6606,49 +6606,51 @@ var Scale = class Scale extends Element {
|
|
|
6606
6606
|
const widest = labelSizes.widest.width;
|
|
6607
6607
|
let textAlign;
|
|
6608
6608
|
let x;
|
|
6609
|
-
if (position === "left")
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
x = this.right - tickAndPadding;
|
|
6621
|
-
if (crossAlign === "near") textAlign = "right";
|
|
6622
|
-
else if (crossAlign === "center") {
|
|
6623
|
-
textAlign = "center";
|
|
6624
|
-
x -= widest / 2;
|
|
6625
|
-
} else {
|
|
6626
|
-
textAlign = "left";
|
|
6627
|
-
x = this.left;
|
|
6628
|
-
}
|
|
6629
|
-
}
|
|
6630
|
-
else if (position === "right") if (mirror) {
|
|
6631
|
-
x = this.left + padding;
|
|
6632
|
-
if (crossAlign === "near") textAlign = "right";
|
|
6633
|
-
else if (crossAlign === "center") {
|
|
6634
|
-
textAlign = "center";
|
|
6635
|
-
x -= widest / 2;
|
|
6609
|
+
if (position === "left") {
|
|
6610
|
+
if (mirror) {
|
|
6611
|
+
x = this.right + padding;
|
|
6612
|
+
if (crossAlign === "near") textAlign = "left";
|
|
6613
|
+
else if (crossAlign === "center") {
|
|
6614
|
+
textAlign = "center";
|
|
6615
|
+
x += widest / 2;
|
|
6616
|
+
} else {
|
|
6617
|
+
textAlign = "right";
|
|
6618
|
+
x += widest;
|
|
6619
|
+
}
|
|
6636
6620
|
} else {
|
|
6637
|
-
|
|
6638
|
-
|
|
6621
|
+
x = this.right - tickAndPadding;
|
|
6622
|
+
if (crossAlign === "near") textAlign = "right";
|
|
6623
|
+
else if (crossAlign === "center") {
|
|
6624
|
+
textAlign = "center";
|
|
6625
|
+
x -= widest / 2;
|
|
6626
|
+
} else {
|
|
6627
|
+
textAlign = "left";
|
|
6628
|
+
x = this.left;
|
|
6629
|
+
}
|
|
6639
6630
|
}
|
|
6640
|
-
} else {
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6631
|
+
} else if (position === "right") {
|
|
6632
|
+
if (mirror) {
|
|
6633
|
+
x = this.left + padding;
|
|
6634
|
+
if (crossAlign === "near") textAlign = "right";
|
|
6635
|
+
else if (crossAlign === "center") {
|
|
6636
|
+
textAlign = "center";
|
|
6637
|
+
x -= widest / 2;
|
|
6638
|
+
} else {
|
|
6639
|
+
textAlign = "left";
|
|
6640
|
+
x -= widest;
|
|
6641
|
+
}
|
|
6646
6642
|
} else {
|
|
6647
|
-
|
|
6648
|
-
|
|
6643
|
+
x = this.left + tickAndPadding;
|
|
6644
|
+
if (crossAlign === "near") textAlign = "left";
|
|
6645
|
+
else if (crossAlign === "center") {
|
|
6646
|
+
textAlign = "center";
|
|
6647
|
+
x += widest / 2;
|
|
6648
|
+
} else {
|
|
6649
|
+
textAlign = "right";
|
|
6650
|
+
x = this.right;
|
|
6651
|
+
}
|
|
6649
6652
|
}
|
|
6650
|
-
}
|
|
6651
|
-
else textAlign = "right";
|
|
6653
|
+
} else textAlign = "right";
|
|
6652
6654
|
return {
|
|
6653
6655
|
textAlign,
|
|
6654
6656
|
x
|
|
@@ -6996,7 +6998,7 @@ var Registry = class {
|
|
|
6996
6998
|
return item;
|
|
6997
6999
|
}
|
|
6998
7000
|
};
|
|
6999
|
-
var registry = /*
|
|
7001
|
+
var registry = /* #__PURE__ */ new Registry();
|
|
7000
7002
|
var PluginService = class {
|
|
7001
7003
|
constructor() {
|
|
7002
7004
|
this._init = void 0;
|
|
@@ -9631,13 +9633,17 @@ var Legend$1 = class extends Element {
|
|
|
9631
9633
|
ctx.lineWidth = lineWidth;
|
|
9632
9634
|
ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);
|
|
9633
9635
|
ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));
|
|
9634
|
-
if (labelOpts.usePointStyle)
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
|
|
9636
|
+
if (labelOpts.usePointStyle) {
|
|
9637
|
+
const drawOptions = {
|
|
9638
|
+
radius: boxHeight * Math.SQRT2 / 2,
|
|
9639
|
+
pointStyle: legendItem.pointStyle,
|
|
9640
|
+
rotation: legendItem.rotation,
|
|
9641
|
+
borderWidth: lineWidth
|
|
9642
|
+
};
|
|
9643
|
+
const centerX = rtlHelper.xPlus(x, boxWidth / 2);
|
|
9644
|
+
const centerY = y + halfFontSize;
|
|
9645
|
+
drawPointLegend(ctx, drawOptions, centerX, centerY, labelOpts.pointStyleWidth && boxWidth);
|
|
9646
|
+
} else {
|
|
9641
9647
|
const yBoxTop = y + Math.max((fontSize - boxHeight) / 2, 0);
|
|
9642
9648
|
const xBoxLeft = rtlHelper.leftForLtr(x, boxWidth);
|
|
9643
9649
|
const borderRadius = toTRBLCorners(legendItem.borderRadius);
|
|
@@ -9695,7 +9701,8 @@ var Legend$1 = class extends Element {
|
|
|
9695
9701
|
cursor.line++;
|
|
9696
9702
|
y = cursor.y = _alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[cursor.line].height);
|
|
9697
9703
|
}
|
|
9698
|
-
|
|
9704
|
+
const realX = rtlHelper.x(x);
|
|
9705
|
+
drawLegendBox(realX, y, legendItem);
|
|
9699
9706
|
x = _textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : this.right, opts.rtl);
|
|
9700
9707
|
fillText(rtlHelper.x(x), y, legendItem);
|
|
9701
9708
|
if (isHorizontal) cursor.x += width + padding;
|
|
@@ -10071,8 +10078,10 @@ var positioners$1 = {
|
|
|
10071
10078
|
}
|
|
10072
10079
|
};
|
|
10073
10080
|
function pushOrConcat(base, toPush) {
|
|
10074
|
-
if (toPush)
|
|
10075
|
-
|
|
10081
|
+
if (toPush) {
|
|
10082
|
+
if (isArray$1(toPush)) Array.prototype.push.apply(base, toPush);
|
|
10083
|
+
else base.push(toPush);
|
|
10084
|
+
}
|
|
10076
10085
|
return base;
|
|
10077
10086
|
}
|
|
10078
10087
|
function splitNewlines(str) {
|
|
@@ -11020,9 +11029,10 @@ function generateTicks$1(generationOptions, dataRange) {
|
|
|
11020
11029
|
if (maxDefined && tickValue > max) break;
|
|
11021
11030
|
ticks.push({ value: tickValue });
|
|
11022
11031
|
}
|
|
11023
|
-
if (maxDefined && includeBounds && niceMax !== max)
|
|
11024
|
-
|
|
11025
|
-
|
|
11032
|
+
if (maxDefined && includeBounds && niceMax !== max) {
|
|
11033
|
+
if (ticks.length && almostEquals(ticks[ticks.length - 1].value, max, relativeLabelSize(max, minSpacing, generationOptions))) ticks[ticks.length - 1].value = max;
|
|
11034
|
+
else ticks.push({ value: max });
|
|
11035
|
+
} else if (!maxDefined || niceMax === max) ticks.push({ value: niceMax });
|
|
11026
11036
|
return ticks;
|
|
11027
11037
|
}
|
|
11028
11038
|
function relativeLabelSize(value, minSpacing, { horizontal, minRotation }) {
|
|
@@ -11241,12 +11251,14 @@ var LogarithmicScale = class extends Scale {
|
|
|
11241
11251
|
let max = this.max;
|
|
11242
11252
|
const setMin = (v) => min = minDefined ? min : v;
|
|
11243
11253
|
const setMax = (v) => max = maxDefined ? max : v;
|
|
11244
|
-
if (min === max)
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11254
|
+
if (min === max) {
|
|
11255
|
+
if (min <= 0) {
|
|
11256
|
+
setMin(1);
|
|
11257
|
+
setMax(10);
|
|
11258
|
+
} else {
|
|
11259
|
+
setMin(changeExponent(min, -1));
|
|
11260
|
+
setMax(changeExponent(max, 1));
|
|
11261
|
+
}
|
|
11250
11262
|
}
|
|
11251
11263
|
if (min <= 0) setMin(changeExponent(max, -1));
|
|
11252
11264
|
if (max <= 0) setMax(changeExponent(min, 1));
|
|
@@ -11767,7 +11779,7 @@ var INTERVALS = {
|
|
|
11767
11779
|
size: 3154e7
|
|
11768
11780
|
}
|
|
11769
11781
|
};
|
|
11770
|
-
var UNITS = /*
|
|
11782
|
+
var UNITS = /* #__PURE__ */ Object.keys(INTERVALS);
|
|
11771
11783
|
function sorter(a, b) {
|
|
11772
11784
|
return a - b;
|
|
11773
11785
|
}
|
|
@@ -12248,7 +12260,7 @@ function ChartComponent(props, ref) {
|
|
|
12248
12260
|
renderChart();
|
|
12249
12261
|
return () => destroyChart();
|
|
12250
12262
|
}, []);
|
|
12251
|
-
return
|
|
12263
|
+
return /*#__PURE__*/ jsx("canvas", {
|
|
12252
12264
|
ref: canvasRef,
|
|
12253
12265
|
role: "img",
|
|
12254
12266
|
height,
|
|
@@ -12257,19 +12269,19 @@ function ChartComponent(props, ref) {
|
|
|
12257
12269
|
children: fallbackContent
|
|
12258
12270
|
});
|
|
12259
12271
|
}
|
|
12260
|
-
var Chart =
|
|
12272
|
+
var Chart = /*#__PURE__*/ forwardRef(ChartComponent);
|
|
12261
12273
|
function createTypedChart(type, registerables) {
|
|
12262
12274
|
Chart$1.register(registerables);
|
|
12263
|
-
return
|
|
12275
|
+
return /*#__PURE__*/ forwardRef((props, ref) => /*#__PURE__*/ jsx(Chart, {
|
|
12264
12276
|
...props,
|
|
12265
12277
|
ref,
|
|
12266
12278
|
type
|
|
12267
12279
|
}));
|
|
12268
12280
|
}
|
|
12269
|
-
var Line = /*
|
|
12270
|
-
var Bar = /*
|
|
12271
|
-
var Pie = /*
|
|
12272
|
-
var Scatter = /*
|
|
12281
|
+
var Line = /* #__PURE__ */ createTypedChart("line", LineController);
|
|
12282
|
+
var Bar = /* #__PURE__ */ createTypedChart("bar", BarController);
|
|
12283
|
+
var Pie = /* #__PURE__ */ createTypedChart("pie", PieController);
|
|
12284
|
+
var Scatter = /* #__PURE__ */ createTypedChart("scatter", ScatterController);
|
|
12273
12285
|
/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
12274
12286
|
* http://hammerjs.github.io/
|
|
12275
12287
|
*
|
|
@@ -12540,10 +12552,12 @@ var import_hammer = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exp
|
|
|
12540
12552
|
values[i] = val;
|
|
12541
12553
|
i++;
|
|
12542
12554
|
}
|
|
12543
|
-
if (sort)
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12555
|
+
if (sort) {
|
|
12556
|
+
if (!key) results = results.sort();
|
|
12557
|
+
else results = results.sort(function sortUniqueArray(a, b) {
|
|
12558
|
+
return a[key] > b[key];
|
|
12559
|
+
});
|
|
12560
|
+
}
|
|
12547
12561
|
return results;
|
|
12548
12562
|
}
|
|
12549
12563
|
/**
|
|
@@ -13580,14 +13594,16 @@ pointers: 1 },
|
|
|
13580
13594
|
var direction = input.direction;
|
|
13581
13595
|
var x = input.deltaX;
|
|
13582
13596
|
var y = input.deltaY;
|
|
13583
|
-
if (!(direction & options.direction))
|
|
13584
|
-
direction
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
|
|
13590
|
-
|
|
13597
|
+
if (!(direction & options.direction)) {
|
|
13598
|
+
if (options.direction & DIRECTION_HORIZONTAL) {
|
|
13599
|
+
direction = x === 0 ? DIRECTION_NONE : x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
|
|
13600
|
+
hasMoved = x != this.pX;
|
|
13601
|
+
distance = Math.abs(input.deltaX);
|
|
13602
|
+
} else {
|
|
13603
|
+
direction = y === 0 ? DIRECTION_NONE : y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
|
|
13604
|
+
hasMoved = y != this.pY;
|
|
13605
|
+
distance = Math.abs(input.deltaY);
|
|
13606
|
+
}
|
|
13591
13607
|
}
|
|
13592
13608
|
input.direction = direction;
|
|
13593
13609
|
return hasMoved && distance > options.threshold && direction & options.direction;
|
|
@@ -13804,13 +13820,15 @@ pointers: 1 },
|
|
|
13804
13820
|
if (!validMultiTap || !validInterval) this.count = 1;
|
|
13805
13821
|
else this.count += 1;
|
|
13806
13822
|
this._input = input;
|
|
13807
|
-
if (this.count % options.taps === 0)
|
|
13808
|
-
|
|
13809
|
-
|
|
13810
|
-
this.
|
|
13811
|
-
|
|
13812
|
-
|
|
13813
|
-
|
|
13823
|
+
if (this.count % options.taps === 0) {
|
|
13824
|
+
if (!this.hasRequireFailures()) return STATE_RECOGNIZED;
|
|
13825
|
+
else {
|
|
13826
|
+
this._timer = setTimeoutContext(function() {
|
|
13827
|
+
this.state = STATE_RECOGNIZED;
|
|
13828
|
+
this.tryEmit();
|
|
13829
|
+
}, options.interval, this);
|
|
13830
|
+
return STATE_BEGAN;
|
|
13831
|
+
}
|
|
13814
13832
|
}
|
|
13815
13833
|
}
|
|
13816
13834
|
return STATE_FAILED;
|
|
@@ -14452,13 +14470,13 @@ function panCategoryScale(scale, delta, limits) {
|
|
|
14452
14470
|
}
|
|
14453
14471
|
var OFFSETS = {
|
|
14454
14472
|
second: 500,
|
|
14455
|
-
minute:
|
|
14456
|
-
hour:
|
|
14457
|
-
day:
|
|
14458
|
-
week:
|
|
14459
|
-
month:
|
|
14460
|
-
quarter:
|
|
14461
|
-
year:
|
|
14473
|
+
minute: 3e4,
|
|
14474
|
+
hour: 18e5,
|
|
14475
|
+
day: 432e5,
|
|
14476
|
+
week: 3024e5,
|
|
14477
|
+
month: 1296e6,
|
|
14478
|
+
quarter: 5184e6,
|
|
14479
|
+
year: 157248e5
|
|
14462
14480
|
};
|
|
14463
14481
|
function panNumericalScale(scale, delta, limits, pan = false) {
|
|
14464
14482
|
const { min: prevStart, max: prevEnd, options } = scale;
|
|
@@ -15290,7 +15308,6 @@ function aligned(x, y, vx, vy, align) {
|
|
|
15290
15308
|
align *= Math.PI / 180;
|
|
15291
15309
|
vx = Math.cos(align);
|
|
15292
15310
|
vy = Math.sin(align);
|
|
15293
|
-
break;
|
|
15294
15311
|
}
|
|
15295
15312
|
return {
|
|
15296
15313
|
x,
|
|
@@ -15911,12 +15928,14 @@ var formatter = function(value) {
|
|
|
15911
15928
|
if (isNullOrUndef(value)) return null;
|
|
15912
15929
|
var label = value;
|
|
15913
15930
|
var keys, klen, k;
|
|
15914
|
-
if (isObject$1(value))
|
|
15915
|
-
|
|
15916
|
-
|
|
15917
|
-
|
|
15918
|
-
|
|
15919
|
-
|
|
15931
|
+
if (isObject$1(value)) {
|
|
15932
|
+
if (!isNullOrUndef(value.label)) label = value.label;
|
|
15933
|
+
else if (!isNullOrUndef(value.r)) label = value.r;
|
|
15934
|
+
else {
|
|
15935
|
+
label = "";
|
|
15936
|
+
keys = Object.keys(value);
|
|
15937
|
+
for (k = 0, klen = keys.length; k < klen; ++k) label += (k !== 0 ? ", " : "") + keys[k] + ": " + value[keys[k]];
|
|
15938
|
+
}
|
|
15920
15939
|
}
|
|
15921
15940
|
return "" + label;
|
|
15922
15941
|
};
|
|
@@ -16104,9 +16123,7 @@ var plugin = {
|
|
|
16104
16123
|
case "mouseout":
|
|
16105
16124
|
handleMoveEvents$1(chart, event);
|
|
16106
16125
|
break;
|
|
16107
|
-
case "click":
|
|
16108
|
-
handleClickEvents$1(chart, event);
|
|
16109
|
-
break;
|
|
16126
|
+
case "click": handleClickEvents$1(chart, event);
|
|
16110
16127
|
}
|
|
16111
16128
|
}
|
|
16112
16129
|
},
|
|
@@ -16340,8 +16357,10 @@ function requireVersion(pkg, min, ver, strict = true) {
|
|
|
16340
16357
|
for (const req of min.split(".")) {
|
|
16341
16358
|
const act = parts[i++];
|
|
16342
16359
|
if (parseInt(req, 10) < parseInt(act, 10)) break;
|
|
16343
|
-
if (isOlderPart(act, req))
|
|
16344
|
-
|
|
16360
|
+
if (isOlderPart(act, req)) {
|
|
16361
|
+
if (strict) throw new Error(`${pkg} v${ver} is not supported. v${min} or newer is required.`);
|
|
16362
|
+
else return false;
|
|
16363
|
+
}
|
|
16345
16364
|
}
|
|
16346
16365
|
return true;
|
|
16347
16366
|
}
|
|
@@ -16792,7 +16811,6 @@ function drawPointStyle(ctx, { x, y, radius, rotation, style, rad }) {
|
|
|
16792
16811
|
case "dash":
|
|
16793
16812
|
ctx.moveTo(x, y);
|
|
16794
16813
|
ctx.lineTo(x + Math.cos(rad) * radius, y + Math.sin(rad) * radius);
|
|
16795
|
-
break;
|
|
16796
16814
|
}
|
|
16797
16815
|
ctx.fill();
|
|
16798
16816
|
}
|
|
@@ -19539,9 +19557,7 @@ var reducer = (state, action) => {
|
|
|
19539
19557
|
draft.zoomEnabled = false;
|
|
19540
19558
|
}
|
|
19541
19559
|
break;
|
|
19542
|
-
case UPDATE_EDITED:
|
|
19543
|
-
draft.edited = action.payload;
|
|
19544
|
-
break;
|
|
19560
|
+
case UPDATE_EDITED: draft.edited = action.payload;
|
|
19545
19561
|
}
|
|
19546
19562
|
});
|
|
19547
19563
|
};
|
|
@@ -20993,7 +21009,8 @@ var getSuggestedAxisRange = ({ data, beginAtZero = false, autoAxisPadding = fals
|
|
|
20993
21009
|
const point = dataMax;
|
|
20994
21010
|
const padding = point * whiteSpacePercentage;
|
|
20995
21011
|
const minAxisValue = beginAtZero && !isNegative ? 0 : point - padding;
|
|
20996
|
-
const
|
|
21012
|
+
const maxAxisValue = beginAtZero && isNegative ? 0 : point + padding;
|
|
21013
|
+
const roundedMinAxisValue = round(maxAxisValue, 9);
|
|
20997
21014
|
const roundedMaxAxisValue = round(minAxisValue, 9);
|
|
20998
21015
|
return {
|
|
20999
21016
|
min: roundedMinAxisValue < 0 ? roundedMinAxisValue : roundedMaxAxisValue,
|
|
@@ -21049,7 +21066,7 @@ var getAxesDataFromMetasets = (generatedDatasets, scalesKeys, annotationsData) =
|
|
|
21049
21066
|
return (dataset?.data ?? []).map((point) => point[axisType]);
|
|
21050
21067
|
});
|
|
21051
21068
|
const annotationValues = annotations?.[axisKey] ?? [];
|
|
21052
|
-
acc[axisKey] = [
|
|
21069
|
+
acc[axisKey] = [.../* @__PURE__ */ new Set([...datasetValues, ...annotationValues])];
|
|
21053
21070
|
return acc;
|
|
21054
21071
|
}, {});
|
|
21055
21072
|
};
|
|
@@ -21502,9 +21519,7 @@ var getReferencePoint$1 = (chart, area, annotation) => {
|
|
|
21502
21519
|
y += Math.max(halfHeight, annotation?.radius ?? 0) + labelOffsetPx;
|
|
21503
21520
|
break;
|
|
21504
21521
|
case Position.Top:
|
|
21505
|
-
default:
|
|
21506
|
-
y -= Math.max(halfHeight, annotation?.radius ?? 0) + labelOffsetPx;
|
|
21507
|
-
break;
|
|
21522
|
+
default: y -= Math.max(halfHeight, annotation?.radius ?? 0) + labelOffsetPx;
|
|
21508
21523
|
}
|
|
21509
21524
|
return {
|
|
21510
21525
|
x: x + xAdjust,
|
|
@@ -22152,10 +22167,7 @@ var generateAnn = (ann, index) => {
|
|
|
22152
22167
|
case AnnotationType$1.LABEL:
|
|
22153
22168
|
handleLabelEnter(element, chart, ann);
|
|
22154
22169
|
break;
|
|
22155
|
-
case AnnotationType$1.POINT:
|
|
22156
|
-
handlePointEnter(element, chart, ann);
|
|
22157
|
-
break;
|
|
22158
|
-
default: break;
|
|
22170
|
+
case AnnotationType$1.POINT: handlePointEnter(element, chart, ann);
|
|
22159
22171
|
}
|
|
22160
22172
|
};
|
|
22161
22173
|
const leave = ({ element }, { chart }) => {
|
|
@@ -22169,10 +22181,7 @@ var generateAnn = (ann, index) => {
|
|
|
22169
22181
|
case AnnotationType$1.LABEL:
|
|
22170
22182
|
handleLabelLeave(element, chart, ann);
|
|
22171
22183
|
break;
|
|
22172
|
-
case AnnotationType$1.POINT:
|
|
22173
|
-
handlePointLeave(element, chart, ann);
|
|
22174
|
-
break;
|
|
22175
|
-
default: break;
|
|
22184
|
+
case AnnotationType$1.POINT: handlePointLeave(element, chart, ann);
|
|
22176
22185
|
}
|
|
22177
22186
|
};
|
|
22178
22187
|
const onDragStart = () => (cord, annotation) => ann?.onDragStart ? ann?.onDragStart(cord, annotation) : void 0;
|
|
@@ -22343,11 +22352,12 @@ var LegendProvider = ({ children, options, datasets }) => {
|
|
|
22343
22352
|
showAnnotations,
|
|
22344
22353
|
annotationsData
|
|
22345
22354
|
});
|
|
22346
|
-
const
|
|
22355
|
+
const initialState = {
|
|
22347
22356
|
...legendInitialState,
|
|
22348
22357
|
annotation,
|
|
22349
22358
|
datasets: initDSs
|
|
22350
|
-
}
|
|
22359
|
+
};
|
|
22360
|
+
const [state, dispatch] = useReducer(legendReducer, initialState);
|
|
22351
22361
|
const contextValue = useMemo(() => ({
|
|
22352
22362
|
state,
|
|
22353
22363
|
dispatch
|
|
@@ -23026,7 +23036,6 @@ var annotationLabel = (ctx, annotations, scales) => {
|
|
|
23026
23036
|
case Position.Right:
|
|
23027
23037
|
textX = centerX + padding;
|
|
23028
23038
|
textY = centerY;
|
|
23029
|
-
break;
|
|
23030
23039
|
}
|
|
23031
23040
|
ctx?.fillText?.(content, textX, textY);
|
|
23032
23041
|
ctx?.restore?.();
|
|
@@ -23190,9 +23199,7 @@ var getReferencePoint = (fromEl, connector) => {
|
|
|
23190
23199
|
x += halfWidth;
|
|
23191
23200
|
y += halfHeight;
|
|
23192
23201
|
break;
|
|
23193
|
-
default:
|
|
23194
|
-
y -= Math.max(halfHeight, radius) + labelOffset;
|
|
23195
|
-
break;
|
|
23202
|
+
default: y -= Math.max(halfHeight, radius) + labelOffset;
|
|
23196
23203
|
}
|
|
23197
23204
|
return {
|
|
23198
23205
|
x: x + xAdjust,
|
|
@@ -23944,12 +23951,13 @@ var lineMarkersPlugin = {
|
|
|
23944
23951
|
const dirIntoChart = side === LineMarkerSide.Left ? 1 : -1;
|
|
23945
23952
|
const groupedVerticalIndex = groupedVerticalIndexBySide[side] ?? 0;
|
|
23946
23953
|
const groupOffsetPx = item?.groupOffsetPx ?? 0;
|
|
23954
|
+
const xPx = isGroupedVertical ? baseXPx + dirIntoChart * groupedVerticalIndex * itemGapPx + dirIntoChart * groupOffsetPx : baseXPx;
|
|
23947
23955
|
geometry = computeVerticalLineGeometry({
|
|
23948
23956
|
chart,
|
|
23949
23957
|
chartArea,
|
|
23950
23958
|
item,
|
|
23951
23959
|
global: cfg,
|
|
23952
|
-
xPx
|
|
23960
|
+
xPx
|
|
23953
23961
|
});
|
|
23954
23962
|
if (geometry && isGroupedVertical) {
|
|
23955
23963
|
groupedVerticalIndexBySide[side] = groupedVerticalIndex + 1;
|
|
@@ -23958,21 +23966,23 @@ var lineMarkersPlugin = {
|
|
|
23958
23966
|
}
|
|
23959
23967
|
} else {
|
|
23960
23968
|
const stickToGroup = item?.stickToGroup ?? cfg?.stickToGroup ?? false;
|
|
23969
|
+
const groupAnchorXPx = (() => {
|
|
23970
|
+
const anchor = groupedAnchorBySide[side];
|
|
23971
|
+
if (!isFiniteNumber(anchor)) return void 0;
|
|
23972
|
+
return clamp(anchor, chartArea?.left, chartArea?.right);
|
|
23973
|
+
})();
|
|
23974
|
+
const previousGroupItemXPx = (() => {
|
|
23975
|
+
const prev = previousGroupedHorizontalEndBySide[side];
|
|
23976
|
+
if (!isFiniteNumber(prev)) return void 0;
|
|
23977
|
+
return clamp(prev, chartArea?.left, chartArea?.right);
|
|
23978
|
+
})();
|
|
23961
23979
|
geometry = computeHorizontalLineGeometry({
|
|
23962
23980
|
chart,
|
|
23963
23981
|
chartArea,
|
|
23964
23982
|
item,
|
|
23965
23983
|
global: cfg,
|
|
23966
|
-
groupAnchorXPx
|
|
23967
|
-
|
|
23968
|
-
if (!isFiniteNumber(anchor)) return void 0;
|
|
23969
|
-
return clamp(anchor, chartArea?.left, chartArea?.right);
|
|
23970
|
-
})(),
|
|
23971
|
-
previousGroupItemXPx: (() => {
|
|
23972
|
-
const prev = previousGroupedHorizontalEndBySide[side];
|
|
23973
|
-
if (!isFiniteNumber(prev)) return void 0;
|
|
23974
|
-
return clamp(prev, chartArea?.left, chartArea?.right);
|
|
23975
|
-
})()
|
|
23984
|
+
groupAnchorXPx,
|
|
23985
|
+
previousGroupItemXPx
|
|
23976
23986
|
});
|
|
23977
23987
|
if (geometry && stickToGroup) previousGroupedHorizontalEndBySide[side] = geometry.x2;
|
|
23978
23988
|
}
|
|
@@ -24388,7 +24398,7 @@ var getGeneratedLabels = (chart) => {
|
|
|
24388
24398
|
};
|
|
24389
24399
|
//#endregion
|
|
24390
24400
|
//#region src/components/common/hooks/use-generated-labels.ts
|
|
24391
|
-
var EXCLUDED_KEYS = new Set([
|
|
24401
|
+
var EXCLUDED_KEYS = /* @__PURE__ */ new Set([
|
|
24392
24402
|
"data",
|
|
24393
24403
|
"_meta",
|
|
24394
24404
|
"_parsed",
|
|
@@ -24397,11 +24407,7 @@ var EXCLUDED_KEYS = new Set([
|
|
|
24397
24407
|
]);
|
|
24398
24408
|
var useGeneratedLabels = (chartRef, generatedDatasets) => {
|
|
24399
24409
|
const [items, setItems] = useState([]);
|
|
24400
|
-
|
|
24401
|
-
const chart = chartRef?.current;
|
|
24402
|
-
if (!chart) return;
|
|
24403
|
-
setItems(getGeneratedLabels(chart));
|
|
24404
|
-
}, [useMemo(() => {
|
|
24410
|
+
const datasetHash = useMemo(() => {
|
|
24405
24411
|
if (!generatedDatasets?.length) return "";
|
|
24406
24412
|
return hash(generatedDatasets, {
|
|
24407
24413
|
excludeKeys: (key) => EXCLUDED_KEYS.has(key),
|
|
@@ -24409,7 +24415,13 @@ var useGeneratedLabels = (chartRef, generatedDatasets) => {
|
|
|
24409
24415
|
unorderedArrays: false,
|
|
24410
24416
|
respectType: false
|
|
24411
24417
|
});
|
|
24412
|
-
}, [generatedDatasets])
|
|
24418
|
+
}, [generatedDatasets]);
|
|
24419
|
+
useEffect(() => {
|
|
24420
|
+
const chart = chartRef?.current;
|
|
24421
|
+
if (!chart) return;
|
|
24422
|
+
const newItems = getGeneratedLabels(chart);
|
|
24423
|
+
setItems(newItems);
|
|
24424
|
+
}, [datasetHash, chartRef]);
|
|
24413
24425
|
return items;
|
|
24414
24426
|
};
|
|
24415
24427
|
/**
|
|
@@ -26537,7 +26549,7 @@ var require_helpers_dataset = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26537
26549
|
appliers.forEach((apply) => apply(this));
|
|
26538
26550
|
}
|
|
26539
26551
|
};
|
|
26540
|
-
var defaults = /*
|
|
26552
|
+
var defaults = /* #__PURE__ */ new Defaults({
|
|
26541
26553
|
_scriptable: (name) => !name.startsWith("on"),
|
|
26542
26554
|
_indexable: (name) => name !== "events",
|
|
26543
26555
|
hover: { _fallback: "interaction" },
|
|
@@ -26733,9 +26745,7 @@ var require_helpers_dataset = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26733
26745
|
ctx.moveTo(x, y);
|
|
26734
26746
|
ctx.lineTo(x + Math.cos(rad) * (w ? w / 2 : radius), y + Math.sin(rad) * radius);
|
|
26735
26747
|
break;
|
|
26736
|
-
case false:
|
|
26737
|
-
ctx.closePath();
|
|
26738
|
-
break;
|
|
26748
|
+
case false: ctx.closePath();
|
|
26739
26749
|
}
|
|
26740
26750
|
ctx.fill();
|
|
26741
26751
|
if (options.borderWidth > 0) ctx.stroke();
|
|
@@ -26868,9 +26878,7 @@ var require_helpers_dataset = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
26868
26878
|
value = +matches[2];
|
|
26869
26879
|
switch (matches[3]) {
|
|
26870
26880
|
case "px": return value;
|
|
26871
|
-
case "%":
|
|
26872
|
-
value /= 100;
|
|
26873
|
-
break;
|
|
26881
|
+
case "%": value /= 100;
|
|
26874
26882
|
}
|
|
26875
26883
|
return size * value;
|
|
26876
26884
|
}
|
|
@@ -28194,7 +28202,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
28194
28202
|
return this._charts.delete(chart);
|
|
28195
28203
|
}
|
|
28196
28204
|
};
|
|
28197
|
-
var animator = /*
|
|
28205
|
+
var animator = /* #__PURE__ */ new Animator();
|
|
28198
28206
|
var transparent = "transparent";
|
|
28199
28207
|
var interpolators = {
|
|
28200
28208
|
boolean(from, to, factor) {
|
|
@@ -28353,10 +28361,12 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
28353
28361
|
const value = values[prop];
|
|
28354
28362
|
let animation = running[prop];
|
|
28355
28363
|
const cfg = animatedProps.get(prop);
|
|
28356
|
-
if (animation)
|
|
28357
|
-
|
|
28358
|
-
|
|
28359
|
-
|
|
28364
|
+
if (animation) {
|
|
28365
|
+
if (cfg && animation.active()) {
|
|
28366
|
+
animation.update(cfg, value, date);
|
|
28367
|
+
continue;
|
|
28368
|
+
} else animation.cancel();
|
|
28369
|
+
}
|
|
28360
28370
|
if (!cfg || !cfg.duration) {
|
|
28361
28371
|
target[prop] = value;
|
|
28362
28372
|
continue;
|
|
@@ -30296,7 +30306,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
30296
30306
|
return Math.max(border, firstPoint, lastPoint) / 2;
|
|
30297
30307
|
}
|
|
30298
30308
|
};
|
|
30299
|
-
var controllers =
|
|
30309
|
+
var controllers = /*#__PURE__*/ Object.freeze({
|
|
30300
30310
|
__proto__: null,
|
|
30301
30311
|
BarController,
|
|
30302
30312
|
BubbleController,
|
|
@@ -30901,10 +30911,12 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
30901
30911
|
const displayWidth = helpers_dataset.readUsedSize(canvas, "width");
|
|
30902
30912
|
if (displayWidth !== void 0) canvas.width = displayWidth;
|
|
30903
30913
|
}
|
|
30904
|
-
if (isNullOrEmpty(renderHeight))
|
|
30905
|
-
|
|
30906
|
-
|
|
30907
|
-
|
|
30914
|
+
if (isNullOrEmpty(renderHeight)) {
|
|
30915
|
+
if (canvas.style.height === "") canvas.height = canvas.width / (aspectRatio || 2);
|
|
30916
|
+
else {
|
|
30917
|
+
const displayHeight = helpers_dataset.readUsedSize(canvas, "height");
|
|
30918
|
+
if (displayHeight !== void 0) canvas.height = displayHeight;
|
|
30919
|
+
}
|
|
30908
30920
|
}
|
|
30909
30921
|
return canvas;
|
|
30910
30922
|
}
|
|
@@ -31620,14 +31632,15 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31620
31632
|
const offsetRight = this.right - this.getPixelForTick(this.ticks.length - 1);
|
|
31621
31633
|
let paddingLeft = 0;
|
|
31622
31634
|
let paddingRight = 0;
|
|
31623
|
-
if (isRotated)
|
|
31624
|
-
|
|
31625
|
-
|
|
31626
|
-
|
|
31627
|
-
|
|
31628
|
-
|
|
31629
|
-
|
|
31630
|
-
|
|
31635
|
+
if (isRotated) {
|
|
31636
|
+
if (labelsBelowTicks) {
|
|
31637
|
+
paddingLeft = cos * first.width;
|
|
31638
|
+
paddingRight = sin * last.height;
|
|
31639
|
+
} else {
|
|
31640
|
+
paddingLeft = sin * first.height;
|
|
31641
|
+
paddingRight = cos * last.width;
|
|
31642
|
+
}
|
|
31643
|
+
} else if (align === "start") paddingRight = last.width;
|
|
31631
31644
|
else if (align === "end") paddingLeft = first.width;
|
|
31632
31645
|
else if (align !== "inner") {
|
|
31633
31646
|
paddingLeft = first.width / 2;
|
|
@@ -31961,13 +31974,16 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31961
31974
|
let tickTextAlign = textAlign;
|
|
31962
31975
|
if (isHorizontal) {
|
|
31963
31976
|
x = pixel;
|
|
31964
|
-
if (textAlign === "inner")
|
|
31965
|
-
|
|
31966
|
-
|
|
31967
|
-
|
|
31968
|
-
|
|
31969
|
-
|
|
31970
|
-
|
|
31977
|
+
if (textAlign === "inner") {
|
|
31978
|
+
if (i === ilen - 1) tickTextAlign = !this.options.reverse ? "right" : "left";
|
|
31979
|
+
else if (i === 0) tickTextAlign = !this.options.reverse ? "left" : "right";
|
|
31980
|
+
else tickTextAlign = "center";
|
|
31981
|
+
}
|
|
31982
|
+
if (position === "top") {
|
|
31983
|
+
if (crossAlign === "near" || rotation !== 0) textOffset = -lineCount * lineHeight + lineHeight / 2;
|
|
31984
|
+
else if (crossAlign === "center") textOffset = -labelSizes.highest.height / 2 - halfCount * lineHeight + lineHeight;
|
|
31985
|
+
else textOffset = -labelSizes.highest.height + lineHeight / 2;
|
|
31986
|
+
} else if (crossAlign === "near" || rotation !== 0) textOffset = lineHeight / 2;
|
|
31971
31987
|
else if (crossAlign === "center") textOffset = labelSizes.highest.height / 2 - halfCount * lineHeight;
|
|
31972
31988
|
else textOffset = labelSizes.highest.height - lineCount * lineHeight;
|
|
31973
31989
|
if (mirror) textOffset *= -1;
|
|
@@ -31987,9 +32003,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31987
32003
|
case "middle":
|
|
31988
32004
|
top -= height / 2;
|
|
31989
32005
|
break;
|
|
31990
|
-
case "bottom":
|
|
31991
|
-
top -= height;
|
|
31992
|
-
break;
|
|
32006
|
+
case "bottom": top -= height;
|
|
31993
32007
|
}
|
|
31994
32008
|
switch (textAlign) {
|
|
31995
32009
|
case "center":
|
|
@@ -31998,10 +32012,8 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
31998
32012
|
case "right":
|
|
31999
32013
|
left -= width;
|
|
32000
32014
|
break;
|
|
32001
|
-
case "inner":
|
|
32002
|
-
|
|
32003
|
-
else if (i > 0) left -= width / 2;
|
|
32004
|
-
break;
|
|
32015
|
+
case "inner": if (i === ilen - 1) left -= width;
|
|
32016
|
+
else if (i > 0) left -= width / 2;
|
|
32005
32017
|
}
|
|
32006
32018
|
backdrop = {
|
|
32007
32019
|
left,
|
|
@@ -32045,49 +32057,51 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32045
32057
|
const widest = labelSizes.widest.width;
|
|
32046
32058
|
let textAlign;
|
|
32047
32059
|
let x;
|
|
32048
|
-
if (position === "left")
|
|
32049
|
-
|
|
32050
|
-
|
|
32051
|
-
|
|
32052
|
-
|
|
32053
|
-
|
|
32054
|
-
|
|
32055
|
-
|
|
32056
|
-
|
|
32057
|
-
|
|
32058
|
-
|
|
32059
|
-
x = this.right - tickAndPadding;
|
|
32060
|
-
if (crossAlign === "near") textAlign = "right";
|
|
32061
|
-
else if (crossAlign === "center") {
|
|
32062
|
-
textAlign = "center";
|
|
32063
|
-
x -= widest / 2;
|
|
32064
|
-
} else {
|
|
32065
|
-
textAlign = "left";
|
|
32066
|
-
x = this.left;
|
|
32067
|
-
}
|
|
32068
|
-
}
|
|
32069
|
-
else if (position === "right") if (mirror) {
|
|
32070
|
-
x = this.left + padding;
|
|
32071
|
-
if (crossAlign === "near") textAlign = "right";
|
|
32072
|
-
else if (crossAlign === "center") {
|
|
32073
|
-
textAlign = "center";
|
|
32074
|
-
x -= widest / 2;
|
|
32060
|
+
if (position === "left") {
|
|
32061
|
+
if (mirror) {
|
|
32062
|
+
x = this.right + padding;
|
|
32063
|
+
if (crossAlign === "near") textAlign = "left";
|
|
32064
|
+
else if (crossAlign === "center") {
|
|
32065
|
+
textAlign = "center";
|
|
32066
|
+
x += widest / 2;
|
|
32067
|
+
} else {
|
|
32068
|
+
textAlign = "right";
|
|
32069
|
+
x += widest;
|
|
32070
|
+
}
|
|
32075
32071
|
} else {
|
|
32076
|
-
|
|
32077
|
-
|
|
32072
|
+
x = this.right - tickAndPadding;
|
|
32073
|
+
if (crossAlign === "near") textAlign = "right";
|
|
32074
|
+
else if (crossAlign === "center") {
|
|
32075
|
+
textAlign = "center";
|
|
32076
|
+
x -= widest / 2;
|
|
32077
|
+
} else {
|
|
32078
|
+
textAlign = "left";
|
|
32079
|
+
x = this.left;
|
|
32080
|
+
}
|
|
32078
32081
|
}
|
|
32079
|
-
} else {
|
|
32080
|
-
|
|
32081
|
-
|
|
32082
|
-
|
|
32083
|
-
|
|
32084
|
-
|
|
32082
|
+
} else if (position === "right") {
|
|
32083
|
+
if (mirror) {
|
|
32084
|
+
x = this.left + padding;
|
|
32085
|
+
if (crossAlign === "near") textAlign = "right";
|
|
32086
|
+
else if (crossAlign === "center") {
|
|
32087
|
+
textAlign = "center";
|
|
32088
|
+
x -= widest / 2;
|
|
32089
|
+
} else {
|
|
32090
|
+
textAlign = "left";
|
|
32091
|
+
x -= widest;
|
|
32092
|
+
}
|
|
32085
32093
|
} else {
|
|
32086
|
-
|
|
32087
|
-
|
|
32094
|
+
x = this.left + tickAndPadding;
|
|
32095
|
+
if (crossAlign === "near") textAlign = "left";
|
|
32096
|
+
else if (crossAlign === "center") {
|
|
32097
|
+
textAlign = "center";
|
|
32098
|
+
x += widest / 2;
|
|
32099
|
+
} else {
|
|
32100
|
+
textAlign = "right";
|
|
32101
|
+
x = this.right;
|
|
32102
|
+
}
|
|
32088
32103
|
}
|
|
32089
|
-
}
|
|
32090
|
-
else textAlign = "right";
|
|
32104
|
+
} else textAlign = "right";
|
|
32091
32105
|
return {
|
|
32092
32106
|
textAlign,
|
|
32093
32107
|
x
|
|
@@ -32436,7 +32450,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
32436
32450
|
return item;
|
|
32437
32451
|
}
|
|
32438
32452
|
};
|
|
32439
|
-
var registry = /*
|
|
32453
|
+
var registry = /* #__PURE__ */ new Registry();
|
|
32440
32454
|
var PluginService = class {
|
|
32441
32455
|
constructor() {
|
|
32442
32456
|
this._init = void 0;
|
|
@@ -34317,7 +34331,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34317
34331
|
return axis === "x" ? this.width / 2 : this.height / 2;
|
|
34318
34332
|
}
|
|
34319
34333
|
};
|
|
34320
|
-
var elements =
|
|
34334
|
+
var elements = /*#__PURE__*/ Object.freeze({
|
|
34321
34335
|
__proto__: null,
|
|
34322
34336
|
ArcElement,
|
|
34323
34337
|
BarElement,
|
|
@@ -34333,7 +34347,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
34333
34347
|
"rgb(153, 102, 255)",
|
|
34334
34348
|
"rgb(201, 203, 207)"
|
|
34335
34349
|
];
|
|
34336
|
-
var BACKGROUND_COLORS = /*
|
|
34350
|
+
var BACKGROUND_COLORS = /* #__PURE__ */ BORDER_COLORS.map((color) => color.replace("rgb(", "rgba(").replace(")", ", 0.5)"));
|
|
34337
34351
|
function getBorderColor(i) {
|
|
34338
34352
|
return BORDER_COLORS[i % BORDER_COLORS.length];
|
|
34339
34353
|
}
|
|
@@ -35393,7 +35407,8 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
35393
35407
|
cursor.line++;
|
|
35394
35408
|
y = cursor.y = helpers_dataset._alignStartEnd(align, this.top + titleHeight + padding, this.bottom - columnSizes[cursor.line].height);
|
|
35395
35409
|
}
|
|
35396
|
-
|
|
35410
|
+
const realX = rtlHelper.x(x);
|
|
35411
|
+
drawLegendBox(realX, y, legendItem);
|
|
35397
35412
|
x = helpers_dataset._textX(textAlign, x + boxWidth + halfFontSize, isHorizontal ? x + width : this.right, opts.rtl);
|
|
35398
35413
|
fillText(rtlHelper.x(x), y, legendItem);
|
|
35399
35414
|
if (isHorizontal) cursor.x += width + padding;
|
|
@@ -35808,8 +35823,10 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
35808
35823
|
}
|
|
35809
35824
|
};
|
|
35810
35825
|
function pushOrConcat(base, toPush) {
|
|
35811
|
-
if (toPush)
|
|
35812
|
-
|
|
35826
|
+
if (toPush) {
|
|
35827
|
+
if (helpers_dataset.isArray(toPush)) Array.prototype.push.apply(base, toPush);
|
|
35828
|
+
else base.push(toPush);
|
|
35829
|
+
}
|
|
35813
35830
|
return base;
|
|
35814
35831
|
}
|
|
35815
35832
|
function splitNewlines(str) {
|
|
@@ -36608,7 +36625,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36608
36625
|
},
|
|
36609
36626
|
additionalOptionScopes: ["interaction"]
|
|
36610
36627
|
};
|
|
36611
|
-
var plugins =
|
|
36628
|
+
var plugins = /*#__PURE__*/ Object.freeze({
|
|
36612
36629
|
__proto__: null,
|
|
36613
36630
|
Colors: plugin_colors,
|
|
36614
36631
|
Decimation: plugin_decimation,
|
|
@@ -36767,9 +36784,10 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36767
36784
|
if (maxDefined && tickValue > max) break;
|
|
36768
36785
|
ticks.push({ value: tickValue });
|
|
36769
36786
|
}
|
|
36770
|
-
if (maxDefined && includeBounds && niceMax !== max)
|
|
36771
|
-
|
|
36772
|
-
|
|
36787
|
+
if (maxDefined && includeBounds && niceMax !== max) {
|
|
36788
|
+
if (ticks.length && helpers_dataset.almostEquals(ticks[ticks.length - 1].value, max, relativeLabelSize(max, minSpacing, generationOptions))) ticks[ticks.length - 1].value = max;
|
|
36789
|
+
else ticks.push({ value: max });
|
|
36790
|
+
} else if (!maxDefined || niceMax === max) ticks.push({ value: niceMax });
|
|
36773
36791
|
return ticks;
|
|
36774
36792
|
}
|
|
36775
36793
|
function relativeLabelSize(value, minSpacing, { horizontal, minRotation }) {
|
|
@@ -36988,12 +37006,14 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
36988
37006
|
let max = this.max;
|
|
36989
37007
|
const setMin = (v) => min = minDefined ? min : v;
|
|
36990
37008
|
const setMax = (v) => max = maxDefined ? max : v;
|
|
36991
|
-
if (min === max)
|
|
36992
|
-
|
|
36993
|
-
|
|
36994
|
-
|
|
36995
|
-
|
|
36996
|
-
|
|
37009
|
+
if (min === max) {
|
|
37010
|
+
if (min <= 0) {
|
|
37011
|
+
setMin(1);
|
|
37012
|
+
setMax(10);
|
|
37013
|
+
} else {
|
|
37014
|
+
setMin(changeExponent(min, -1));
|
|
37015
|
+
setMax(changeExponent(max, 1));
|
|
37016
|
+
}
|
|
36997
37017
|
}
|
|
36998
37018
|
if (min <= 0) setMin(changeExponent(max, -1));
|
|
36999
37019
|
if (max <= 0) setMax(changeExponent(min, 1));
|
|
@@ -37514,7 +37534,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
37514
37534
|
size: 3154e7
|
|
37515
37535
|
}
|
|
37516
37536
|
};
|
|
37517
|
-
var UNITS = /*
|
|
37537
|
+
var UNITS = /* #__PURE__ */ Object.keys(INTERVALS);
|
|
37518
37538
|
function sorter(a, b) {
|
|
37519
37539
|
return a - b;
|
|
37520
37540
|
}
|
|
@@ -37910,7 +37930,7 @@ var require_chart = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
37910
37930
|
return interpolate(this._table, decimal * this._tableRange + this._minPos, true);
|
|
37911
37931
|
}
|
|
37912
37932
|
};
|
|
37913
|
-
var scales =
|
|
37933
|
+
var scales = /*#__PURE__*/ Object.freeze({
|
|
37914
37934
|
__proto__: null,
|
|
37915
37935
|
CategoryScale,
|
|
37916
37936
|
LinearScale,
|
|
@@ -38981,12 +39001,14 @@ var getBarChartDataLabels = (options) => {
|
|
|
38981
39001
|
const dataElement = context.chart.data.datasets[datasetIndex].data[dataIndex];
|
|
38982
39002
|
let dataLabel = "";
|
|
38983
39003
|
if (typeof dataElement === "number") dataLabel = Number.isInteger(dataElement) ? dataElement : dataElement.toFixed(2);
|
|
38984
|
-
if (Array.isArray(dataElement))
|
|
38985
|
-
|
|
38986
|
-
|
|
38987
|
-
|
|
38988
|
-
|
|
38989
|
-
|
|
39004
|
+
if (Array.isArray(dataElement)) {
|
|
39005
|
+
if (dataElement.length === 2) {
|
|
39006
|
+
const sum = dataElement[1] - dataElement[0];
|
|
39007
|
+
dataLabel = sum < 0 ? round(sum, 2) : `+${round(sum, 2)}`;
|
|
39008
|
+
} else dataLabel = dataElement.reduce((acc, curr, i) => {
|
|
39009
|
+
return i === 0 ? `${acc} ${curr}` : `${acc}, ${curr}`;
|
|
39010
|
+
}, "");
|
|
39011
|
+
}
|
|
38990
39012
|
return dataLabel;
|
|
38991
39013
|
};
|
|
38992
39014
|
const beginAtNotZeroAlign = reverse ? AlignOptions.End : AlignOptions.Start;
|
|
@@ -39709,12 +39731,11 @@ var ScatterChartWithLegend = (props) => {
|
|
|
39709
39731
|
//#region src/components/common/helpers/get-grouped-color-scheme/get-grouped-color-scheme.ts
|
|
39710
39732
|
extend([lchPlugin]);
|
|
39711
39733
|
var MIN_LIGHTNESS = 15;
|
|
39712
|
-
var MAX_LIGHTNESS = 95;
|
|
39713
39734
|
var getGroupedColorScheme = (length, startingColor) => {
|
|
39714
39735
|
if (length === 1) return [startingColor];
|
|
39715
39736
|
const { h: hue, c: chroma } = colord(startingColor).toLch();
|
|
39716
39737
|
return Array.from({ length }, (_, index) => {
|
|
39717
|
-
return `lch(${MIN_LIGHTNESS +
|
|
39738
|
+
return `lch(${MIN_LIGHTNESS + 80 / length * (index + .5)} ${chroma} ${hue})`;
|
|
39718
39739
|
});
|
|
39719
39740
|
};
|
|
39720
39741
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliasoft-open-source/charts-library",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "React Chart Library (based on Chart.js and react-chart-js-2)",
|
|
5
5
|
"homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
|
|
6
6
|
"bugs": {
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@types/object-hash": "^3.0.6",
|
|
51
51
|
"@types/react": "^18.2.24",
|
|
52
52
|
"@types/react-dom": "^18.3.7",
|
|
53
|
-
"@vitejs/plugin-react": "^6.0
|
|
54
|
-
"@vitest/coverage-v8": "4.1.
|
|
53
|
+
"@vitejs/plugin-react": "^6.1.0",
|
|
54
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
55
55
|
"classnames": "^2.5.1",
|
|
56
56
|
"es-toolkit": "^1.44.0",
|
|
57
57
|
"http-server": "^14.1.1",
|
|
@@ -61,17 +61,17 @@
|
|
|
61
61
|
"less": "^4.3.0",
|
|
62
62
|
"lint-staged": "^15.5.2",
|
|
63
63
|
"normalize.css": "^8.0.1",
|
|
64
|
-
"oxfmt": "^0.
|
|
65
|
-
"oxlint": "^1.
|
|
64
|
+
"oxfmt": "^0.64.0",
|
|
65
|
+
"oxlint": "^1.79.0",
|
|
66
66
|
"react": "^18.2.0",
|
|
67
67
|
"react-dom": "^18.2.0",
|
|
68
68
|
"storybook": "^10.4.0",
|
|
69
69
|
"typescript": "^6.0.3",
|
|
70
|
-
"vite": "8.
|
|
71
|
-
"vite-plugin-css-injected-by-js": "^5.0.
|
|
72
|
-
"vite-plugin-dts": "^5.0.
|
|
70
|
+
"vite": "^8.2.2",
|
|
71
|
+
"vite-plugin-css-injected-by-js": "^5.0.2",
|
|
72
|
+
"vite-plugin-dts": "^5.0.3",
|
|
73
73
|
"vite-plugin-svgr": "^5.2.0",
|
|
74
|
-
"vitest": "^4.1.
|
|
74
|
+
"vitest": "^4.1.11",
|
|
75
75
|
"node": "runtime:26.6.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"lint-staged": {
|
|
87
87
|
"*": [
|
|
88
|
-
"oxlint
|
|
88
|
+
"oxlint --fix --no-error-on-unmatched-pattern",
|
|
89
89
|
"oxfmt --no-error-on-unmatched-pattern"
|
|
90
90
|
]
|
|
91
91
|
},
|