@oliasoft-open-source/charts-library 4.0.4 → 4.1.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +961 -866
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart.d.ts +2 -2
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +16 -2
- package/dist/src/components/bar-chart/utils/use-bar-chart-config.d.ts +7 -18
- package/dist/src/components/common/common.interface.d.ts +21 -0
- package/dist/src/components/common/enums.d.ts +5 -0
- package/dist/src/components/common/helpers/chart-utils.d.ts +1 -1
- package/dist/src/components/common/helpers/download-pgn.d.ts +4 -0
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +52 -20
- package/dist/src/components/common/helpers/to-annotation.d.ts +4 -0
- package/dist/src/components/common/hooks/use-generated-labels.d.ts +4 -0
- package/dist/src/components/{line-chart → common}/hooks/use-legend-state.d.ts +6 -12
- package/dist/src/components/common/hooks/use-legend.d.ts +5 -0
- package/dist/src/components/common/legend-component/legend-interface.d.ts +46 -0
- package/dist/src/components/common/legend-component/legend-item/LegendItemLine.d.ts +5 -0
- package/dist/src/components/common/legend-component/legend-item/legend-item.d.ts +3 -0
- package/dist/src/components/common/legend-component/legend.d.ts +3 -0
- package/dist/src/components/common/legend-component/state/legend-action-types.d.ts +3 -0
- package/dist/src/components/common/legend-component/state/legend-context.d.ts +12 -0
- package/dist/src/components/common/legend-component/state/legend-state-reducer.d.ts +26 -0
- package/dist/src/components/{line-chart/legend → common/legend-component/utils}/create-style-object.d.ts +3 -2
- package/dist/src/components/common/legend-component/utils/get-generated-labels.d.ts +2 -0
- package/dist/src/components/line-chart/line-chart.d.ts +2 -2
- package/dist/src/components/line-chart/line-chart.interface.d.ts +2 -0
- package/dist/src/components/pie-chart/pie-chart.d.ts +2 -7
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +7 -0
- package/dist/src/components/pie-chart/use-pie-chart-config.d.ts +2 -2
- package/package.json +3 -3
- package/dist/src/components/line-chart/hooks/use-generated-labels.d.ts +0 -4
- package/dist/src/components/line-chart/legend/legend-constants.d.ts +0 -1
- package/dist/src/components/line-chart/legend/legend-interface.d.ts +0 -39
- package/dist/src/components/line-chart/legend/legend-item.d.ts +0 -3
- package/dist/src/components/line-chart/legend/legend.d.ts +0 -3
- /package/dist/src/components/{line-chart/legend → common/legend-component}/legend-dropzone.d.ts +0 -0
- /package/dist/src/components/{line-chart/legend → common/legend-component}/legend-panel.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -13742,13 +13742,13 @@ var hammer = { exports: {} };
|
|
|
13742
13742
|
* @returns {String} value
|
|
13743
13743
|
*/
|
|
13744
13744
|
compute: function() {
|
|
13745
|
-
var
|
|
13745
|
+
var actions2 = [];
|
|
13746
13746
|
each2(this.manager.recognizers, function(recognizer) {
|
|
13747
13747
|
if (boolOrFn(recognizer.options.enable, [recognizer])) {
|
|
13748
|
-
|
|
13748
|
+
actions2 = actions2.concat(recognizer.getTouchAction());
|
|
13749
13749
|
}
|
|
13750
13750
|
});
|
|
13751
|
-
return cleanTouchActions(
|
|
13751
|
+
return cleanTouchActions(actions2.join(" "));
|
|
13752
13752
|
},
|
|
13753
13753
|
/**
|
|
13754
13754
|
* this method is called on each input cycle and provides the preventing of the browser behavior
|
|
@@ -13761,10 +13761,10 @@ var hammer = { exports: {} };
|
|
|
13761
13761
|
srcEvent.preventDefault();
|
|
13762
13762
|
return;
|
|
13763
13763
|
}
|
|
13764
|
-
var
|
|
13765
|
-
var hasNone = inStr(
|
|
13766
|
-
var hasPanY = inStr(
|
|
13767
|
-
var hasPanX = inStr(
|
|
13764
|
+
var actions2 = this.actions;
|
|
13765
|
+
var hasNone = inStr(actions2, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
|
|
13766
|
+
var hasPanY = inStr(actions2, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
|
|
13767
|
+
var hasPanX = inStr(actions2, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
|
|
13768
13768
|
if (hasNone) {
|
|
13769
13769
|
var isTapPointer = input.pointers.length === 1;
|
|
13770
13770
|
var isTapMovement = input.distance < 2;
|
|
@@ -13789,19 +13789,19 @@ var hammer = { exports: {} };
|
|
|
13789
13789
|
srcEvent.preventDefault();
|
|
13790
13790
|
}
|
|
13791
13791
|
};
|
|
13792
|
-
function cleanTouchActions(
|
|
13793
|
-
if (inStr(
|
|
13792
|
+
function cleanTouchActions(actions2) {
|
|
13793
|
+
if (inStr(actions2, TOUCH_ACTION_NONE)) {
|
|
13794
13794
|
return TOUCH_ACTION_NONE;
|
|
13795
13795
|
}
|
|
13796
|
-
var hasPanX = inStr(
|
|
13797
|
-
var hasPanY = inStr(
|
|
13796
|
+
var hasPanX = inStr(actions2, TOUCH_ACTION_PAN_X);
|
|
13797
|
+
var hasPanY = inStr(actions2, TOUCH_ACTION_PAN_Y);
|
|
13798
13798
|
if (hasPanX && hasPanY) {
|
|
13799
13799
|
return TOUCH_ACTION_NONE;
|
|
13800
13800
|
}
|
|
13801
13801
|
if (hasPanX || hasPanY) {
|
|
13802
13802
|
return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
|
|
13803
13803
|
}
|
|
13804
|
-
if (inStr(
|
|
13804
|
+
if (inStr(actions2, TOUCH_ACTION_MANIPULATION)) {
|
|
13805
13805
|
return TOUCH_ACTION_MANIPULATION;
|
|
13806
13806
|
}
|
|
13807
13807
|
return TOUCH_ACTION_AUTO;
|
|
@@ -14117,14 +14117,14 @@ var hammer = { exports: {} };
|
|
|
14117
14117
|
},
|
|
14118
14118
|
getTouchAction: function() {
|
|
14119
14119
|
var direction = this.options.direction;
|
|
14120
|
-
var
|
|
14120
|
+
var actions2 = [];
|
|
14121
14121
|
if (direction & DIRECTION_HORIZONTAL) {
|
|
14122
|
-
|
|
14122
|
+
actions2.push(TOUCH_ACTION_PAN_Y);
|
|
14123
14123
|
}
|
|
14124
14124
|
if (direction & DIRECTION_VERTICAL) {
|
|
14125
|
-
|
|
14125
|
+
actions2.push(TOUCH_ACTION_PAN_X);
|
|
14126
14126
|
}
|
|
14127
|
-
return
|
|
14127
|
+
return actions2;
|
|
14128
14128
|
},
|
|
14129
14129
|
directionTest: function(input) {
|
|
14130
14130
|
var options = this.options;
|
|
@@ -19405,9 +19405,9 @@ class DragDropManagerImpl {
|
|
|
19405
19405
|
}
|
|
19406
19406
|
};
|
|
19407
19407
|
}
|
|
19408
|
-
const
|
|
19409
|
-
return Object.keys(
|
|
19410
|
-
const action =
|
|
19408
|
+
const actions2 = createDragDropActions(this);
|
|
19409
|
+
return Object.keys(actions2).reduce((boundActions, key) => {
|
|
19410
|
+
const action = actions2[key];
|
|
19411
19411
|
boundActions[key] = bindActionCreator(action);
|
|
19412
19412
|
return boundActions;
|
|
19413
19413
|
}, {});
|
|
@@ -22049,7 +22049,7 @@ const HTML5Backend = function createBackend(manager, context, options) {
|
|
|
22049
22049
|
return new HTML5BackendImpl(manager, context, options);
|
|
22050
22050
|
};
|
|
22051
22051
|
const chart$2 = "_chart_e3qdd_1";
|
|
22052
|
-
const canvas = "_canvas_e3qdd_11";
|
|
22052
|
+
const canvas$1 = "_canvas_e3qdd_11";
|
|
22053
22053
|
const fixedHeight$2 = "_fixedHeight_e3qdd_20";
|
|
22054
22054
|
const stretchHeight$2 = "_stretchHeight_e3qdd_26";
|
|
22055
22055
|
const squareAspectRatio = "_squareAspectRatio_e3qdd_32";
|
|
@@ -22060,7 +22060,7 @@ const autoWeight$2 = "_autoWeight_e3qdd_58";
|
|
|
22060
22060
|
const table = "_table_e3qdd_62";
|
|
22061
22061
|
const styles$4 = {
|
|
22062
22062
|
chart: chart$2,
|
|
22063
|
-
canvas,
|
|
22063
|
+
canvas: canvas$1,
|
|
22064
22064
|
fixedHeight: fixedHeight$2,
|
|
22065
22065
|
stretchHeight: stretchHeight$2,
|
|
22066
22066
|
squareAspectRatio,
|
|
@@ -22187,11 +22187,11 @@ var Position = /* @__PURE__ */ ((Position2) => {
|
|
|
22187
22187
|
Position2["BottomRight"] = "bottom-right";
|
|
22188
22188
|
return Position2;
|
|
22189
22189
|
})(Position || {});
|
|
22190
|
-
var ChartType = /* @__PURE__ */ ((ChartType2) => {
|
|
22190
|
+
var ChartType$1 = /* @__PURE__ */ ((ChartType2) => {
|
|
22191
22191
|
ChartType2["Line"] = "line";
|
|
22192
22192
|
ChartType2["Bar"] = "bar";
|
|
22193
22193
|
return ChartType2;
|
|
22194
|
-
})(ChartType || {});
|
|
22194
|
+
})(ChartType$1 || {});
|
|
22195
22195
|
var CursorStyle = /* @__PURE__ */ ((CursorStyle2) => {
|
|
22196
22196
|
CursorStyle2["Pointer"] = "pointer";
|
|
22197
22197
|
CursorStyle2["Initial"] = "initial";
|
|
@@ -22783,6 +22783,9 @@ function TbList(props) {
|
|
|
22783
22783
|
function TbRuler(props) {
|
|
22784
22784
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M5 4h14a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1h-7a1 1 0 0 0 -1 1v7a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1" } }, { "tag": "path", "attr": { "d": "M4 8l2 0" } }, { "tag": "path", "attr": { "d": "M4 12l3 0" } }, { "tag": "path", "attr": { "d": "M4 16l2 0" } }, { "tag": "path", "attr": { "d": "M8 4l0 2" } }, { "tag": "path", "attr": { "d": "M12 4l0 3" } }, { "tag": "path", "attr": { "d": "M16 4l0 2" } }] })(props);
|
|
22785
22785
|
}
|
|
22786
|
+
function TbSquareFilled(props) {
|
|
22787
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M19 2h-14a3 3 0 0 0 -3 3v14a3 3 0 0 0 3 3h14a3 3 0 0 0 3 -3v-14a3 3 0 0 0 -3 -3z", "strokeWidth": "0", "fill": "currentColor" } }] })(props);
|
|
22788
|
+
}
|
|
22786
22789
|
function TbX(props) {
|
|
22787
22790
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M18 6l-12 12" } }, { "tag": "path", "attr": { "d": "M6 6l12 12" } }] })(props);
|
|
22788
22791
|
}
|
|
@@ -23841,6 +23844,24 @@ var dist = { exports: {} };
|
|
|
23841
23844
|
});
|
|
23842
23845
|
})(dist);
|
|
23843
23846
|
var distExports = dist.exports;
|
|
23847
|
+
const downloadPgn = (chartRef, state) => {
|
|
23848
|
+
var _a2;
|
|
23849
|
+
const chart2 = chartRef.current;
|
|
23850
|
+
const canvasElement = (_a2 = chart2 == null ? void 0 : chart2.canvas) == null ? void 0 : _a2.parentElement;
|
|
23851
|
+
if (!canvasElement)
|
|
23852
|
+
return;
|
|
23853
|
+
const { ctx } = chart2;
|
|
23854
|
+
ctx.save();
|
|
23855
|
+
ctx.globalCompositeOperation = "destination-over";
|
|
23856
|
+
const isDark = document.body.dataset.theme === "dark";
|
|
23857
|
+
ctx.fillStyle = isDark ? "black" : "white";
|
|
23858
|
+
ctx.fillRect(0, 0, chart2.width, chart2.height);
|
|
23859
|
+
ctx.restore();
|
|
23860
|
+
const fileName = getChartFileName(state == null ? void 0 : state.axes);
|
|
23861
|
+
toPng(canvasElement).then((dataUrl) => {
|
|
23862
|
+
distExports.triggerBase64Download(dataUrl, fileName);
|
|
23863
|
+
});
|
|
23864
|
+
};
|
|
23844
23865
|
const useChartFunctions = ({
|
|
23845
23866
|
chartRef,
|
|
23846
23867
|
state,
|
|
@@ -23877,24 +23898,10 @@ const useChartFunctions = ({
|
|
|
23877
23898
|
},
|
|
23878
23899
|
[]
|
|
23879
23900
|
);
|
|
23880
|
-
const handleDownload = useCallback(
|
|
23881
|
-
|
|
23882
|
-
|
|
23883
|
-
|
|
23884
|
-
if (!canvasElement)
|
|
23885
|
-
return;
|
|
23886
|
-
const { ctx } = chart2;
|
|
23887
|
-
ctx.save();
|
|
23888
|
-
ctx.globalCompositeOperation = "destination-over";
|
|
23889
|
-
const isDark = document.body.dataset.theme === "dark";
|
|
23890
|
-
ctx.fillStyle = isDark ? "black" : "white";
|
|
23891
|
-
ctx.fillRect(0, 0, chart2.width, chart2.height);
|
|
23892
|
-
ctx.restore();
|
|
23893
|
-
const fileName = getChartFileName(state.axes);
|
|
23894
|
-
toPng(canvasElement).then((dataUrl) => {
|
|
23895
|
-
distExports.triggerBase64Download(dataUrl, fileName);
|
|
23896
|
-
});
|
|
23897
|
-
}, [chartRef, state.axes]);
|
|
23901
|
+
const handleDownload = useCallback(
|
|
23902
|
+
() => downloadPgn(chartRef, state),
|
|
23903
|
+
[chartRef, state.axes]
|
|
23904
|
+
);
|
|
23898
23905
|
const handleKeyDown = useCallback(
|
|
23899
23906
|
(event) => {
|
|
23900
23907
|
var _a2, _b2, _c2, _d2, _e2;
|
|
@@ -24417,576 +24424,85 @@ const Controls = ({
|
|
|
24417
24424
|
subheaderComponent
|
|
24418
24425
|
] });
|
|
24419
24426
|
};
|
|
24420
|
-
|
|
24421
|
-
|
|
24422
|
-
|
|
24423
|
-
|
|
24424
|
-
|
|
24425
|
-
|
|
24426
|
-
|
|
24427
|
-
|
|
24428
|
-
|
|
24429
|
-
|
|
24430
|
-
top: 0,
|
|
24431
|
-
left: 0,
|
|
24432
|
-
bottom: 0,
|
|
24433
|
-
right: 0
|
|
24434
|
-
};
|
|
24435
|
-
function useMeasure() {
|
|
24436
|
-
var _a2 = useState(null), element = _a2[0], ref = _a2[1];
|
|
24437
|
-
var _b2 = useState(defaultState), rect = _b2[0], setRect = _b2[1];
|
|
24438
|
-
var observer = useMemo(function() {
|
|
24439
|
-
return new window.ResizeObserver(function(entries) {
|
|
24440
|
-
if (entries[0]) {
|
|
24441
|
-
var _a3 = entries[0].contentRect, x2 = _a3.x, y2 = _a3.y, width = _a3.width, height = _a3.height, top_1 = _a3.top, left2 = _a3.left, bottom2 = _a3.bottom, right2 = _a3.right;
|
|
24442
|
-
setRect({ x: x2, y: y2, width, height, top: top_1, left: left2, bottom: bottom2, right: right2 });
|
|
24443
|
-
}
|
|
24444
|
-
});
|
|
24445
|
-
}, []);
|
|
24446
|
-
useIsomorphicLayoutEffect$1(function() {
|
|
24447
|
-
if (!element)
|
|
24448
|
-
return;
|
|
24449
|
-
observer.observe(element);
|
|
24450
|
-
return function() {
|
|
24451
|
-
observer.disconnect();
|
|
24452
|
-
};
|
|
24453
|
-
}, [element]);
|
|
24454
|
-
return [ref, rect];
|
|
24455
|
-
}
|
|
24456
|
-
const useMeasure$1 = isBrowser && typeof window.ResizeObserver !== "undefined" ? useMeasure : function() {
|
|
24457
|
-
return [noop, defaultState];
|
|
24458
|
-
};
|
|
24459
|
-
const legend = "_legend_wpro0_1";
|
|
24460
|
-
const isDragging = "_isDragging_wpro0_8";
|
|
24461
|
-
const legendItems = "_legendItems_wpro0_11";
|
|
24462
|
-
const isHidden = "_isHidden_wpro0_47";
|
|
24463
|
-
const legendToggle = "_legendToggle_wpro0_50";
|
|
24464
|
-
const legendItem = "_legendItem_wpro0_11";
|
|
24465
|
-
const legendItemSymbol = "_legendItemSymbol_wpro0_80";
|
|
24466
|
-
const legendItemBox = "_legendItemBox_wpro0_90";
|
|
24467
|
-
const legendItemLine = "_legendItemLine_wpro0_95";
|
|
24468
|
-
const legendItemPoint = "_legendItemPoint_wpro0_103";
|
|
24469
|
-
const legendItemText = "_legendItemText_wpro0_110";
|
|
24470
|
-
const scrollbars = "_scrollbars_wpro0_113";
|
|
24471
|
-
const dropzoneContainer = "_dropzoneContainer_wpro0_140";
|
|
24472
|
-
const dropzone = "_dropzone_wpro0_140";
|
|
24473
|
-
const left = "_left_wpro0_149";
|
|
24474
|
-
const right = "_right_wpro0_153";
|
|
24475
|
-
const top = "_top_wpro0_157";
|
|
24476
|
-
const bottom = "_bottom_wpro0_161";
|
|
24477
|
-
const dropzonePlaceholder = "_dropzonePlaceholder_wpro0_165";
|
|
24478
|
-
const isActive = "_isActive_wpro0_173";
|
|
24479
|
-
const resizeContainer = "_resizeContainer_wpro0_176";
|
|
24480
|
-
const styles$2 = {
|
|
24481
|
-
legend,
|
|
24482
|
-
isDragging,
|
|
24483
|
-
legendItems,
|
|
24484
|
-
isHidden,
|
|
24485
|
-
legendToggle,
|
|
24486
|
-
legendItem,
|
|
24487
|
-
legendItemSymbol,
|
|
24488
|
-
legendItemBox,
|
|
24489
|
-
legendItemLine,
|
|
24490
|
-
legendItemPoint,
|
|
24491
|
-
legendItemText,
|
|
24492
|
-
scrollbars,
|
|
24493
|
-
dropzoneContainer,
|
|
24494
|
-
dropzone,
|
|
24495
|
-
left,
|
|
24496
|
-
right,
|
|
24497
|
-
top,
|
|
24498
|
-
bottom,
|
|
24499
|
-
dropzonePlaceholder,
|
|
24500
|
-
isActive,
|
|
24501
|
-
resizeContainer
|
|
24502
|
-
};
|
|
24503
|
-
const circleSvg = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTIiIGZpbGw9ImN1cnJlbnRDb2xvciIgLz48L3N2Zz4=";
|
|
24504
|
-
const rectSvg = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHJlY3QgeD0iMiIgeT0iMiIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIiBmaWxsPSJjdXJyZW50Q29sb3IiIC8+PC9zdmc+";
|
|
24505
|
-
const rectRotSvg = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHJlY3QgeD0iMyIgeT0iMyIgd2lkdGg9IjE4IiBoZWlnaHQ9IjE4IiBmaWxsPSJjdXJyZW50Q29sb3IiIHRyYW5zZm9ybT0ncm90YXRlKDQ1IDEyIDEyKScgLz48L3N2Zz4=";
|
|
24506
|
-
const triangleSvg = "data:image/svg+xml;base64,PHN2ZyAgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0ibTAgMGgyNHYyNGgtMjR6Ii8+PC9jbGlwUGF0aD48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxwYXRoIGQ9Im0yMi43OTk4IDIyLjA2MjNoLTIxLjU5OTZjLS4yMTA2Ni4wMDAxLS40MTc2MTctLjA1NTQtLjYwMDA2Ny0uMTYwNy0uMTgyNDUxLS4xMDUzLS4zMzM5NjUtLjI1NjctLjQzOTMxMS0uNDM5Mi0uMTA1MzQ2NC0uMTgyNC0uMTYwODEyMjgtLjM4OTMtLjE2MDgyMi0uNnMuMDU1NDM3Mi0uNDE3Ni4xNjA3NjctLjZsMTAuNzk5ODMzLTE4LjcwNTE4Yy4xMTM5LS4xNzEzNy4yNjg0LS4zMTE5MS40NDk3LS40MDkxMy4xODE0LS4wOTcyMi4zODM5LS4xNDgwOS41ODk3LS4xNDgwOXMuNDA4My4wNTA4Ny41ODk3LjE0ODA5Yy4xODEzLjA5NzIyLjMzNTguMjM3NzYuNDQ5Ny40MDkxM2wxMC43OTk4IDE4LjcwNTE4Yy4xMDU0LjE4MjQuMTYwOC4zODkzLjE2MDguNnMtLjA1NTUuNDE3Ni0uMTYwOC42Yy0uMTA1NC4xODI1LS4yNTY5LjMzMzktLjQzOTMuNDM5Mi0uMTgyNS4xMDUzLS4zODk0LjE2MDgtLjYwMDEuMTYwN3oiIGZpbGw9ImN1cnJlbnRDb2xvciIvPjwvZz48L3N2Zz4=";
|
|
24507
|
-
const LEGEND_SYMBOL_SIZE = 16;
|
|
24508
|
-
const LegendItemLine = ({ dataset }) => {
|
|
24509
|
-
const { borderColor, borderDash, borderWidth } = dataset;
|
|
24510
|
-
const offset = borderDash.length ? (LEGEND_SYMBOL_SIZE - borderDash[0]) / 2 % (borderDash[0] + borderDash[1]) * -1 : 0;
|
|
24511
|
-
return /* @__PURE__ */ jsx("span", { className: styles$2.legendItemLine, children: /* @__PURE__ */ jsx(
|
|
24512
|
-
"svg",
|
|
24513
|
-
{
|
|
24514
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
24515
|
-
viewBox: `0 0 ${LEGEND_SYMBOL_SIZE} ${LEGEND_SYMBOL_SIZE}`,
|
|
24516
|
-
children: /* @__PURE__ */ jsx(
|
|
24517
|
-
"line",
|
|
24518
|
-
{
|
|
24519
|
-
x1: "0",
|
|
24520
|
-
y1: "50%",
|
|
24521
|
-
x2: "100%",
|
|
24522
|
-
y2: "50%",
|
|
24523
|
-
stroke: borderColor,
|
|
24524
|
-
strokeWidth: borderWidth,
|
|
24525
|
-
strokeDasharray: borderDash,
|
|
24526
|
-
strokeDashoffset: offset
|
|
24527
|
-
}
|
|
24528
|
-
)
|
|
24529
|
-
}
|
|
24530
|
-
) });
|
|
24427
|
+
const TextLabelPosition = {
|
|
24428
|
+
TOP_LEFT: "top-left",
|
|
24429
|
+
TOP_CENTER: "top-center",
|
|
24430
|
+
TOP_RIGHT: "top-right",
|
|
24431
|
+
MIDDLE_LEFT: "middle-left",
|
|
24432
|
+
MIDDLE_CENTER: "middle-center",
|
|
24433
|
+
MIDDLE_RIGHT: "middle-right",
|
|
24434
|
+
BOTTOM_LEFT: "bottom-left",
|
|
24435
|
+
BOTTOM_CENTER: "bottom-center",
|
|
24436
|
+
BOTTOM_RIGHT: "bottom-right"
|
|
24531
24437
|
};
|
|
24532
|
-
const
|
|
24533
|
-
|
|
24534
|
-
|
|
24535
|
-
|
|
24536
|
-
|
|
24537
|
-
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
rectRot: rectRotSvg,
|
|
24541
|
-
rect: rectSvg
|
|
24542
|
-
};
|
|
24543
|
-
return /* @__PURE__ */ jsx("span", { className: styles$2.legendItemPoint, children: /* @__PURE__ */ jsx(
|
|
24544
|
-
Icon,
|
|
24545
|
-
{
|
|
24546
|
-
icon: icons[pointStyle] || circleSvg,
|
|
24547
|
-
size,
|
|
24548
|
-
color: pointBackgroundColor
|
|
24438
|
+
const defaultAxis = (position) => ({
|
|
24439
|
+
label: "",
|
|
24440
|
+
position,
|
|
24441
|
+
color: "",
|
|
24442
|
+
unit: {
|
|
24443
|
+
options: [],
|
|
24444
|
+
selectedUnit: "",
|
|
24445
|
+
setSelectedUnit: () => {
|
|
24549
24446
|
}
|
|
24550
|
-
) });
|
|
24551
|
-
};
|
|
24552
|
-
const LegendItemBox = ({ dataset }) => {
|
|
24553
|
-
const { backgroundColor } = dataset;
|
|
24554
|
-
const style = { backgroundColor };
|
|
24555
|
-
return /* @__PURE__ */ jsx("span", { className: styles$2.legendItemBox, style });
|
|
24556
|
-
};
|
|
24557
|
-
const LegendItemSymbol = ({ dataset }) => {
|
|
24558
|
-
const { annotationType, showLine } = dataset;
|
|
24559
|
-
switch (annotationType) {
|
|
24560
|
-
case AnnotationType.Box:
|
|
24561
|
-
case AnnotationType.Ellipse:
|
|
24562
|
-
return /* @__PURE__ */ jsx(LegendItemBox, { dataset });
|
|
24563
|
-
case AnnotationType.Line:
|
|
24564
|
-
return /* @__PURE__ */ jsx(LegendItemLine, { dataset });
|
|
24565
|
-
default:
|
|
24566
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24567
|
-
showLine && /* @__PURE__ */ jsx(LegendItemLine, { dataset }),
|
|
24568
|
-
/* @__PURE__ */ jsx(LegendItemPoint, { dataset })
|
|
24569
|
-
] });
|
|
24570
24447
|
}
|
|
24571
|
-
};
|
|
24572
|
-
const
|
|
24573
|
-
|
|
24574
|
-
|
|
24575
|
-
|
|
24576
|
-
|
|
24577
|
-
|
|
24578
|
-
|
|
24579
|
-
|
|
24580
|
-
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
|
|
24584
|
-
|
|
24585
|
-
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
)
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
|
|
24606
|
-
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
(
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
(
|
|
24628
|
-
|
|
24629
|
-
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
24630
|
-
const { datasets } = (chartInstance == null ? void 0 : chartInstance.data) || {};
|
|
24631
|
-
const dataset = (datasets == null ? void 0 : datasets[datasetIndex]) ?? {};
|
|
24632
|
-
const meta = chartInstance == null ? void 0 : chartInstance.getDatasetMeta(datasetIndex);
|
|
24633
|
-
const isDatasetVisible = (chartInstance == null ? void 0 : chartInstance.isDatasetVisible(datasetIndex)) ?? true;
|
|
24634
|
-
upsertHiddenState({
|
|
24635
|
-
label: dataset.label ?? "",
|
|
24636
|
-
datasetIndex,
|
|
24637
|
-
hidden: isDatasetVisible
|
|
24638
|
-
});
|
|
24639
|
-
chartInstance == null ? void 0 : chartInstance.setDatasetVisibility(datasetIndex, !isDatasetVisible);
|
|
24640
|
-
if (annotations.controlAnnotation && (dataset == null ? void 0 : dataset.isAnnotation)) {
|
|
24641
|
-
const { annotationIndex } = dataset;
|
|
24642
|
-
dispatch({ type: TOGGLE_ANNOTATION, payload: { annotationIndex } });
|
|
24643
|
-
}
|
|
24644
|
-
if (dataset == null ? void 0 : dataset.displayGroup) {
|
|
24645
|
-
datasets == null ? void 0 : datasets.forEach((ds, ix) => {
|
|
24646
|
-
if (ds.displayGroup !== dataset.displayGroup)
|
|
24647
|
-
return;
|
|
24648
|
-
if (chartInstance && meta) {
|
|
24649
|
-
chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
|
|
24650
|
-
}
|
|
24651
|
-
});
|
|
24652
|
-
}
|
|
24653
|
-
if (onLegendClick) {
|
|
24654
|
-
const legendState = legendItem2.hidden ?? false;
|
|
24655
|
-
onLegendClick(legendItem2 == null ? void 0 : legendItem2.text, legendState);
|
|
24656
|
-
}
|
|
24657
|
-
chartInstance == null ? void 0 : chartInstance.update();
|
|
24658
|
-
},
|
|
24659
|
-
[chartRef, annotations, onLegendClick, hiddenStates]
|
|
24660
|
-
);
|
|
24661
|
-
const legend2 = useMemo(
|
|
24662
|
-
() => getLegend(options, legendClick),
|
|
24663
|
-
[legendEnabled]
|
|
24664
|
-
);
|
|
24665
|
-
const customLegendPlugin = useMemo(
|
|
24666
|
-
() => ({
|
|
24667
|
-
[CUSTOM_LEGEND_PLUGIN_NAME]: (customLegend == null ? void 0 : customLegend.customLegendPlugin) && {
|
|
24668
|
-
containerID: customLegend == null ? void 0 : customLegend.customLegendContainerID
|
|
24669
|
-
}
|
|
24670
|
-
}),
|
|
24671
|
-
[customLegend]
|
|
24672
|
-
);
|
|
24673
|
-
return {
|
|
24674
|
-
legendClick,
|
|
24675
|
-
hiddenStates,
|
|
24676
|
-
legend: legend2,
|
|
24677
|
-
customLegendPlugin,
|
|
24678
|
-
upsertHiddenState,
|
|
24679
|
-
clearNonExistentDatasets
|
|
24680
|
-
};
|
|
24681
|
-
};
|
|
24682
|
-
const LEGEND_MARGIN = 4;
|
|
24683
|
-
const createLegendStyle = (legendPosition, chart2) => {
|
|
24684
|
-
const { height = 0, width = 0, chartArea } = chart2;
|
|
24685
|
-
const { top: top2, left: left2, bottom: bottom2, right: right2 } = chartArea;
|
|
24686
|
-
return {
|
|
24687
|
-
left: legendPosition.includes("left") ? left2 : void 0,
|
|
24688
|
-
right: legendPosition.includes("right") ? width - right2 : void 0,
|
|
24689
|
-
top: legendPosition.includes("top") ? top2 : void 0,
|
|
24690
|
-
bottom: legendPosition.includes("bottom") ? height - bottom2 : void 0,
|
|
24691
|
-
maxHeight: 0.5 * (bottom2 - top2 - LEGEND_MARGIN * 2),
|
|
24692
|
-
maxWidth: 0.5 * (right2 - left2 - LEGEND_MARGIN * 2),
|
|
24693
|
-
margin: LEGEND_MARGIN
|
|
24694
|
-
};
|
|
24695
|
-
};
|
|
24696
|
-
const getGeneratedLabels = (chart2) => {
|
|
24697
|
-
var _a2, _b2, _c2, _d2, _e2;
|
|
24698
|
-
return ((_e2 = (_d2 = (_c2 = (_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.legend) == null ? void 0 : _c2.labels) == null ? void 0 : _d2.generateLabels) == null ? void 0 : _e2.call(_d2, chart2)) ?? [];
|
|
24699
|
-
};
|
|
24700
|
-
const useGeneratedLabels = (chartRef, generatedDatasets) => {
|
|
24701
|
-
const [items, setItems] = useState([]);
|
|
24702
|
-
useEffect(() => {
|
|
24703
|
-
const chart2 = chartRef.current;
|
|
24704
|
-
if (!chart2)
|
|
24705
|
-
return;
|
|
24706
|
-
const newItems = getGeneratedLabels(chart2);
|
|
24707
|
-
setItems(newItems);
|
|
24708
|
-
}, [generatedDatasets, chartRef]);
|
|
24709
|
-
return items;
|
|
24710
|
-
};
|
|
24711
|
-
const LegendItems = ({
|
|
24712
|
-
items,
|
|
24713
|
-
hiddenStates,
|
|
24714
|
-
datasets,
|
|
24715
|
-
legendClick
|
|
24716
|
-
}) => /* @__PURE__ */ jsx("div", { className: styles$2.legendItems, children: items.map((item) => {
|
|
24717
|
-
var _a2;
|
|
24718
|
-
if (datasets[item.datasetIndex].hideLegend) {
|
|
24719
|
-
return null;
|
|
24720
|
-
}
|
|
24721
|
-
const hiddenState = ((_a2 = hiddenStates.find((state) => state.label === item.text)) == null ? void 0 : _a2.hidden) ?? false;
|
|
24722
|
-
return /* @__PURE__ */ jsx(
|
|
24723
|
-
LegendItem,
|
|
24724
|
-
{
|
|
24725
|
-
hidden: hiddenState,
|
|
24726
|
-
dataset: datasets[item.datasetIndex],
|
|
24727
|
-
handleClick: (_2) => legendClick(_2, item)
|
|
24728
|
-
},
|
|
24729
|
-
`${item.datasetIndex}-hidden-${item.hidden}`
|
|
24730
|
-
);
|
|
24731
|
-
}) });
|
|
24732
|
-
const LegendPanel = forwardRef((props, ref) => {
|
|
24733
|
-
const {
|
|
24734
|
-
legendPosition,
|
|
24735
|
-
chartRef,
|
|
24736
|
-
state,
|
|
24737
|
-
options,
|
|
24738
|
-
dispatch,
|
|
24739
|
-
generatedDatasets,
|
|
24740
|
-
isDragging: isDragging2
|
|
24741
|
-
} = props;
|
|
24742
|
-
const { legendEnabled } = state;
|
|
24743
|
-
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
24744
|
-
if (!chart2)
|
|
24745
|
-
return null;
|
|
24746
|
-
const {
|
|
24747
|
-
data: { datasets }
|
|
24748
|
-
} = chart2;
|
|
24749
|
-
const { legendClick, hiddenStates, clearNonExistentDatasets } = useLegendState({
|
|
24750
|
-
chartRef,
|
|
24751
|
-
options,
|
|
24752
|
-
state,
|
|
24753
|
-
dispatch
|
|
24754
|
-
});
|
|
24755
|
-
const { onToggleLegend } = useToggleHandlers(dispatch);
|
|
24756
|
-
const items = useGeneratedLabels(chartRef, generatedDatasets);
|
|
24757
|
-
const style = createLegendStyle(legendPosition, chart2);
|
|
24758
|
-
useEffect(() => {
|
|
24759
|
-
clearNonExistentDatasets(generatedDatasets);
|
|
24760
|
-
}, [generatedDatasets]);
|
|
24761
|
-
return /* @__PURE__ */ jsxs(
|
|
24762
|
-
"div",
|
|
24763
|
-
{
|
|
24764
|
-
ref,
|
|
24765
|
-
className: cx(
|
|
24766
|
-
styles$2.legend,
|
|
24767
|
-
!legendEnabled && styles$2.isHidden,
|
|
24768
|
-
isDragging2 && styles$2.isDragging
|
|
24769
|
-
),
|
|
24770
|
-
style,
|
|
24771
|
-
children: [
|
|
24772
|
-
/* @__PURE__ */ jsx("div", { className: styles$2.legendToggle, children: /* @__PURE__ */ jsx(
|
|
24773
|
-
Button,
|
|
24774
|
-
{
|
|
24775
|
-
onClick: onToggleLegend,
|
|
24776
|
-
small: true,
|
|
24777
|
-
round: true,
|
|
24778
|
-
icon: legendEnabled ? /* @__PURE__ */ jsx(TbX, {}) : /* @__PURE__ */ jsx(TbList, {})
|
|
24779
|
-
}
|
|
24780
|
-
) }),
|
|
24781
|
-
/* @__PURE__ */ jsx(
|
|
24782
|
-
LegendItems,
|
|
24783
|
-
{
|
|
24784
|
-
items,
|
|
24785
|
-
hiddenStates,
|
|
24786
|
-
datasets,
|
|
24787
|
-
legendClick
|
|
24788
|
-
}
|
|
24789
|
-
)
|
|
24790
|
-
]
|
|
24791
|
-
}
|
|
24792
|
-
);
|
|
24793
|
-
});
|
|
24794
|
-
const LegendDropZone = (legendDropZoneProps) => {
|
|
24795
|
-
const { position, onDrop, placeholderSize } = legendDropZoneProps;
|
|
24796
|
-
const [{ isOver, canDrop }, dropRef] = useDrop(() => ({
|
|
24797
|
-
accept: "legend",
|
|
24798
|
-
drop: onDrop,
|
|
24799
|
-
collect: (monitor) => ({
|
|
24800
|
-
isOver: monitor.isOver(),
|
|
24801
|
-
canDrop: monitor.canDrop()
|
|
24802
|
-
})
|
|
24803
|
-
}));
|
|
24804
|
-
const isActive2 = isOver && canDrop;
|
|
24805
|
-
return /* @__PURE__ */ jsx(
|
|
24806
|
-
"div",
|
|
24807
|
-
{
|
|
24808
|
-
ref: dropRef,
|
|
24809
|
-
className: cx(
|
|
24810
|
-
styles$2.dropzone,
|
|
24811
|
-
isActive2 && styles$2.isActive,
|
|
24812
|
-
position.includes("left") && styles$2.left,
|
|
24813
|
-
position.includes("right") && styles$2.right,
|
|
24814
|
-
position.includes("top") && styles$2.top,
|
|
24815
|
-
position.includes("bottom") && styles$2.bottom
|
|
24816
|
-
),
|
|
24817
|
-
children: /* @__PURE__ */ jsx(
|
|
24818
|
-
"div",
|
|
24819
|
-
{
|
|
24820
|
-
className: styles$2.dropzonePlaceholder,
|
|
24821
|
-
style: { ...placeholderSize, margin: LEGEND_MARGIN }
|
|
24822
|
-
}
|
|
24823
|
-
)
|
|
24824
|
-
}
|
|
24825
|
-
);
|
|
24826
|
-
};
|
|
24827
|
-
const LegendDropZones = (legendDropZonesProps) => {
|
|
24828
|
-
const { chartArea, setLegendPosition, isDragging: isDragging2, placeholderSize } = legendDropZonesProps;
|
|
24829
|
-
const positions2 = [
|
|
24830
|
-
Position.TopLeft,
|
|
24831
|
-
Position.TopRight,
|
|
24832
|
-
Position.BottomLeft,
|
|
24833
|
-
Position.BottomRight
|
|
24834
|
-
];
|
|
24835
|
-
const { top: top2, left: left2, width, height } = chartArea;
|
|
24836
|
-
return /* @__PURE__ */ jsx(
|
|
24837
|
-
"div",
|
|
24838
|
-
{
|
|
24839
|
-
className: styles$2.dropzoneContainer,
|
|
24840
|
-
style: {
|
|
24841
|
-
top: top2,
|
|
24842
|
-
left: left2,
|
|
24843
|
-
width,
|
|
24844
|
-
height,
|
|
24845
|
-
zIndex: isDragging2 ? 0 : -1
|
|
24846
|
-
// Position dropzones behind chart when not needed
|
|
24847
|
-
},
|
|
24848
|
-
children: positions2.map((position) => /* @__PURE__ */ jsx(
|
|
24849
|
-
LegendDropZone,
|
|
24850
|
-
{
|
|
24851
|
-
position,
|
|
24852
|
-
onDrop: () => setLegendPosition(position),
|
|
24853
|
-
placeholderSize
|
|
24854
|
-
},
|
|
24855
|
-
position
|
|
24856
|
-
))
|
|
24857
|
-
}
|
|
24858
|
-
);
|
|
24859
|
-
};
|
|
24860
|
-
const Legend2 = ({
|
|
24861
|
-
chartRef,
|
|
24862
|
-
state,
|
|
24863
|
-
options,
|
|
24864
|
-
dispatch,
|
|
24865
|
-
generatedDatasets
|
|
24866
|
-
}) => {
|
|
24867
|
-
const [measureRef] = useMeasure$1();
|
|
24868
|
-
const resizeRef = measureRef;
|
|
24869
|
-
const panelRef = useRef(null);
|
|
24870
|
-
const chart2 = chartRef.current;
|
|
24871
|
-
const [legendPosition, setLegendPosition] = useState(options.legend.position);
|
|
24872
|
-
const panelRect = panelRef.current ? panelRef.current.getBoundingClientRect() : null;
|
|
24873
|
-
const panelSize = { width: panelRect == null ? void 0 : panelRect.width, height: panelRect == null ? void 0 : panelRect.height };
|
|
24874
|
-
const [{ isDragging: isDragging2 }, dragRef] = useDrag(() => ({
|
|
24875
|
-
type: "legend",
|
|
24876
|
-
collect: (monitor) => ({
|
|
24877
|
-
isDragging: monitor.isDragging()
|
|
24878
|
-
})
|
|
24879
|
-
}));
|
|
24880
|
-
if (!chart2)
|
|
24881
|
-
return null;
|
|
24882
|
-
const { chartArea } = chart2;
|
|
24883
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24884
|
-
/* @__PURE__ */ jsx("div", { ref: resizeRef, className: styles$2.resizeContainer }),
|
|
24885
|
-
/* @__PURE__ */ jsx(
|
|
24886
|
-
LegendPanel,
|
|
24887
|
-
{
|
|
24888
|
-
legendPosition,
|
|
24889
|
-
chartRef,
|
|
24890
|
-
state,
|
|
24891
|
-
options,
|
|
24892
|
-
dispatch,
|
|
24893
|
-
generatedDatasets,
|
|
24894
|
-
isDragging: isDragging2,
|
|
24895
|
-
ref: (r2) => {
|
|
24896
|
-
dragRef(r2);
|
|
24897
|
-
panelRef.current = r2;
|
|
24898
|
-
}
|
|
24899
|
-
}
|
|
24900
|
-
),
|
|
24901
|
-
/* @__PURE__ */ jsx(
|
|
24902
|
-
LegendDropZones,
|
|
24903
|
-
{
|
|
24904
|
-
chartArea,
|
|
24905
|
-
setLegendPosition: (position) => setLegendPosition(position),
|
|
24906
|
-
isDragging: isDragging2,
|
|
24907
|
-
placeholderSize: panelSize
|
|
24908
|
-
}
|
|
24909
|
-
)
|
|
24910
|
-
] });
|
|
24911
|
-
};
|
|
24912
|
-
const TextLabelPosition = {
|
|
24913
|
-
TOP_LEFT: "top-left",
|
|
24914
|
-
TOP_CENTER: "top-center",
|
|
24915
|
-
TOP_RIGHT: "top-right",
|
|
24916
|
-
MIDDLE_LEFT: "middle-left",
|
|
24917
|
-
MIDDLE_CENTER: "middle-center",
|
|
24918
|
-
MIDDLE_RIGHT: "middle-right",
|
|
24919
|
-
BOTTOM_LEFT: "bottom-left",
|
|
24920
|
-
BOTTOM_CENTER: "bottom-center",
|
|
24921
|
-
BOTTOM_RIGHT: "bottom-right"
|
|
24922
|
-
};
|
|
24923
|
-
const defaultAxis = (position) => ({
|
|
24924
|
-
label: "",
|
|
24925
|
-
position,
|
|
24926
|
-
color: "",
|
|
24927
|
-
unit: {
|
|
24928
|
-
options: [],
|
|
24929
|
-
selectedUnit: "",
|
|
24930
|
-
setSelectedUnit: () => {
|
|
24931
|
-
}
|
|
24932
|
-
}
|
|
24933
|
-
});
|
|
24934
|
-
const defaultAxes$1 = (axes) => ({
|
|
24935
|
-
x: (axes == null ? void 0 : axes.x) || [defaultAxis("bottom")],
|
|
24936
|
-
y: (axes == null ? void 0 : axes.y) || [defaultAxis("left")]
|
|
24937
|
-
});
|
|
24938
|
-
const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
24939
|
-
chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
|
|
24940
|
-
reverse: (options == null ? void 0 : options.reverse) || false,
|
|
24941
|
-
beginAtZero: (options == null ? void 0 : options.beginAtZero) ?? false,
|
|
24942
|
-
stepSize: options == null ? void 0 : options.stepSize,
|
|
24943
|
-
suggestedMin: options == null ? void 0 : options.suggestedMin,
|
|
24944
|
-
suggestedMax: options == null ? void 0 : options.suggestedMax,
|
|
24945
|
-
range: options == null ? void 0 : options.range,
|
|
24946
|
-
autoAxisPadding: (options == null ? void 0 : options.autoAxisPadding) ?? false
|
|
24947
|
-
});
|
|
24948
|
-
const defaultChartStyling$2 = (options) => ({
|
|
24949
|
-
width: options == null ? void 0 : options.width,
|
|
24950
|
-
height: options == null ? void 0 : options.height,
|
|
24951
|
-
maintainAspectRatio: (options == null ? void 0 : options.maintainAspectRatio) ?? false,
|
|
24952
|
-
staticChartHeight: (options == null ? void 0 : options.staticChartHeight) ?? false,
|
|
24953
|
-
performanceMode: (options == null ? void 0 : options.performanceMode) ?? true,
|
|
24954
|
-
squareAspectRatio: (options == null ? void 0 : options.squareAspectRatio) ?? false,
|
|
24955
|
-
layoutPadding: (options == null ? void 0 : options.layoutPadding) || {
|
|
24956
|
-
top: 0,
|
|
24957
|
-
bottom: 20,
|
|
24958
|
-
left: 0,
|
|
24959
|
-
right: 0
|
|
24960
|
-
}
|
|
24961
|
-
});
|
|
24962
|
-
const defaultTooltip$2 = (tooltip) => ({
|
|
24963
|
-
tooltips: (tooltip == null ? void 0 : tooltip.tooltips) ?? true,
|
|
24964
|
-
showLabelsInTooltips: (tooltip == null ? void 0 : tooltip.showLabelsInTooltips) ?? false,
|
|
24965
|
-
hideSimulationName: (tooltip == null ? void 0 : tooltip.hideSimulationName) ?? false
|
|
24966
|
-
});
|
|
24967
|
-
const defaultGraph$2 = (graph) => ({
|
|
24968
|
-
lineTension: (graph == null ? void 0 : graph.lineTension) ?? 0.01,
|
|
24969
|
-
spanGaps: (graph == null ? void 0 : graph.spanGaps) ?? false,
|
|
24970
|
-
showDataLabels: (graph == null ? void 0 : graph.showDataLabels) ?? false,
|
|
24971
|
-
showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) ?? false
|
|
24972
|
-
});
|
|
24973
|
-
const defaultAnnotations$1 = (annotations) => {
|
|
24974
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
24975
|
-
return {
|
|
24976
|
-
labelAnnotation: {
|
|
24977
|
-
showLabel: ((_a2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _a2.showLabel) ?? false,
|
|
24978
|
-
text: ((_b2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _b2.text) ?? "",
|
|
24979
|
-
position: ((_c2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _c2.position) ?? TextLabelPosition.BOTTOM_RIGHT,
|
|
24980
|
-
fontSize: ((_d2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _d2.fontSize) ?? 12,
|
|
24981
|
-
xOffset: ((_e2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _e2.xOffset) ?? 5,
|
|
24982
|
-
yOffset: ((_f2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _f2.yOffset) ?? 5,
|
|
24983
|
-
maxWidth: ((_g2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _g2.maxWidth) ?? 300,
|
|
24984
|
-
lineHeight: ((_h2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _h2.lineHeight) ?? 12
|
|
24985
|
-
},
|
|
24986
|
-
showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? false,
|
|
24987
|
-
controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) ?? false,
|
|
24988
|
-
annotationsData: (annotations == null ? void 0 : annotations.annotationsData) ?? []
|
|
24989
|
-
};
|
|
24448
|
+
});
|
|
24449
|
+
const defaultAxes$1 = (axes) => ({
|
|
24450
|
+
x: (axes == null ? void 0 : axes.x) || [defaultAxis("bottom")],
|
|
24451
|
+
y: (axes == null ? void 0 : axes.y) || [defaultAxis("left")]
|
|
24452
|
+
});
|
|
24453
|
+
const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
24454
|
+
chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
|
|
24455
|
+
reverse: (options == null ? void 0 : options.reverse) || false,
|
|
24456
|
+
beginAtZero: (options == null ? void 0 : options.beginAtZero) ?? false,
|
|
24457
|
+
stepSize: options == null ? void 0 : options.stepSize,
|
|
24458
|
+
suggestedMin: options == null ? void 0 : options.suggestedMin,
|
|
24459
|
+
suggestedMax: options == null ? void 0 : options.suggestedMax,
|
|
24460
|
+
range: options == null ? void 0 : options.range,
|
|
24461
|
+
autoAxisPadding: (options == null ? void 0 : options.autoAxisPadding) ?? false
|
|
24462
|
+
});
|
|
24463
|
+
const defaultChartStyling$2 = (options) => ({
|
|
24464
|
+
width: options == null ? void 0 : options.width,
|
|
24465
|
+
height: options == null ? void 0 : options.height,
|
|
24466
|
+
maintainAspectRatio: (options == null ? void 0 : options.maintainAspectRatio) ?? false,
|
|
24467
|
+
staticChartHeight: (options == null ? void 0 : options.staticChartHeight) ?? false,
|
|
24468
|
+
performanceMode: (options == null ? void 0 : options.performanceMode) ?? true,
|
|
24469
|
+
squareAspectRatio: (options == null ? void 0 : options.squareAspectRatio) ?? false,
|
|
24470
|
+
layoutPadding: (options == null ? void 0 : options.layoutPadding) || {
|
|
24471
|
+
top: 0,
|
|
24472
|
+
bottom: 20,
|
|
24473
|
+
left: 0,
|
|
24474
|
+
right: 0
|
|
24475
|
+
}
|
|
24476
|
+
});
|
|
24477
|
+
const defaultTooltip$2 = (tooltip) => ({
|
|
24478
|
+
tooltips: (tooltip == null ? void 0 : tooltip.tooltips) ?? true,
|
|
24479
|
+
showLabelsInTooltips: (tooltip == null ? void 0 : tooltip.showLabelsInTooltips) ?? false,
|
|
24480
|
+
hideSimulationName: (tooltip == null ? void 0 : tooltip.hideSimulationName) ?? false,
|
|
24481
|
+
scientificNotation: (tooltip == null ? void 0 : tooltip.scientificNotation) ?? true
|
|
24482
|
+
});
|
|
24483
|
+
const defaultGraph$2 = (graph) => ({
|
|
24484
|
+
lineTension: (graph == null ? void 0 : graph.lineTension) ?? 0.01,
|
|
24485
|
+
spanGaps: (graph == null ? void 0 : graph.spanGaps) ?? false,
|
|
24486
|
+
showDataLabels: (graph == null ? void 0 : graph.showDataLabels) ?? false,
|
|
24487
|
+
showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) ?? false
|
|
24488
|
+
});
|
|
24489
|
+
const defaultAnnotations$1 = (annotations) => {
|
|
24490
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
24491
|
+
return {
|
|
24492
|
+
labelAnnotation: {
|
|
24493
|
+
showLabel: ((_a2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _a2.showLabel) ?? false,
|
|
24494
|
+
text: ((_b2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _b2.text) ?? "",
|
|
24495
|
+
position: ((_c2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _c2.position) ?? TextLabelPosition.BOTTOM_RIGHT,
|
|
24496
|
+
fontSize: ((_d2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _d2.fontSize) ?? 12,
|
|
24497
|
+
xOffset: ((_e2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _e2.xOffset) ?? 5,
|
|
24498
|
+
yOffset: ((_f2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _f2.yOffset) ?? 5,
|
|
24499
|
+
maxWidth: ((_g2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _g2.maxWidth) ?? 300,
|
|
24500
|
+
lineHeight: ((_h2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _h2.lineHeight) ?? 12
|
|
24501
|
+
},
|
|
24502
|
+
showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? false,
|
|
24503
|
+
controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) ?? false,
|
|
24504
|
+
annotationsData: (annotations == null ? void 0 : annotations.annotationsData) ?? []
|
|
24505
|
+
};
|
|
24990
24506
|
};
|
|
24991
24507
|
const defaultLegend$2 = (legend2) => ({
|
|
24992
24508
|
display: (legend2 == null ? void 0 : legend2.display) ?? true,
|
|
@@ -25475,102 +24991,22 @@ const getLineChartDataLabels = (options) => {
|
|
|
25475
24991
|
formatter: (_2, context) => context.dataset.data[context.dataIndex].label || ""
|
|
25476
24992
|
} : { display: false };
|
|
25477
24993
|
};
|
|
25478
|
-
const annotationEnter = (element, chart2) => {
|
|
25479
|
-
var _a2;
|
|
25480
|
-
if ((_a2 = element.options.scaleID) == null ? void 0 : _a2.includes(AxisType.X)) {
|
|
25481
|
-
if (element.options.label) {
|
|
25482
|
-
element.options.label.xAdjust = chart2.chartArea.left;
|
|
25483
|
-
}
|
|
25484
|
-
}
|
|
25485
|
-
element.options.borderWidth = BORDER_WIDTH.HOVERED;
|
|
25486
|
-
if (element.options.label) {
|
|
25487
|
-
element.label.options.display = true;
|
|
25488
|
-
element.options.label.enabled = true;
|
|
25489
|
-
}
|
|
25490
|
-
chart2.draw();
|
|
25491
|
-
chart2.canvas.style.cursor = CursorStyle.Pointer;
|
|
25492
|
-
return true;
|
|
25493
|
-
};
|
|
25494
|
-
const annotationLeave = (element, chart2) => {
|
|
25495
|
-
element.options.borderWidth = BORDER_WIDTH.INITIAL;
|
|
25496
|
-
if (element.options.label) {
|
|
25497
|
-
element.label.options.display = false;
|
|
25498
|
-
element.options.label.enabled = false;
|
|
25499
|
-
}
|
|
25500
|
-
chart2.draw();
|
|
25501
|
-
chart2.canvas.style.cursor = CursorStyle.Initial;
|
|
25502
|
-
return true;
|
|
25503
|
-
};
|
|
25504
|
-
const generateAnnotations = (options, state) => {
|
|
25505
|
-
const { annotationsData } = (options == null ? void 0 : options.annotations) || {};
|
|
25506
|
-
return annotationsData == null ? void 0 : annotationsData.reduce((acc, curr, i2) => {
|
|
25507
|
-
var _a2;
|
|
25508
|
-
if (!((_a2 = state == null ? void 0 : state.showAnnotationLineIndex) == null ? void 0 : _a2.includes(i2))) {
|
|
25509
|
-
return { ...acc };
|
|
25510
|
-
}
|
|
25511
|
-
const scaleID = (curr == null ? void 0 : curr.annotationAxis) ?? void 0;
|
|
25512
|
-
const color2 = (curr == null ? void 0 : curr.color) || COLORS[i2];
|
|
25513
|
-
const type = (curr == null ? void 0 : curr.type) || "line";
|
|
25514
|
-
const adjustScaleRange2 = curr == null ? void 0 : curr.adjustScaleRange;
|
|
25515
|
-
const borderColor = type === "line" ? color2 : "transparent";
|
|
25516
|
-
const borderWidth = type === "line" ? BORDER_WIDTH.INITIAL : 0;
|
|
25517
|
-
const borderDash = ANNOTATION_DASH;
|
|
25518
|
-
const label = type === "line" ? {
|
|
25519
|
-
backgroundColor: color2,
|
|
25520
|
-
content: curr == null ? void 0 : curr.label,
|
|
25521
|
-
display: false,
|
|
25522
|
-
position: Position.Top
|
|
25523
|
-
} : {
|
|
25524
|
-
content: curr == null ? void 0 : curr.label,
|
|
25525
|
-
display: true,
|
|
25526
|
-
font: { weight: "normal" }
|
|
25527
|
-
};
|
|
25528
|
-
const enter = ({ element }, { chart: chart2 }) => {
|
|
25529
|
-
if (type !== "line")
|
|
25530
|
-
return;
|
|
25531
|
-
annotationEnter(element, chart2);
|
|
25532
|
-
};
|
|
25533
|
-
const leave = ({ element }, { chart: chart2 }) => {
|
|
25534
|
-
if (type !== "line")
|
|
25535
|
-
return;
|
|
25536
|
-
annotationLeave(element, chart2);
|
|
25537
|
-
};
|
|
25538
|
-
const annotation2 = {
|
|
25539
|
-
...curr,
|
|
25540
|
-
id: `${curr == null ? void 0 : curr.label}-${curr == null ? void 0 : curr.value}-${i2}`,
|
|
25541
|
-
scaleID,
|
|
25542
|
-
label,
|
|
25543
|
-
backgroundColor: color2,
|
|
25544
|
-
borderColor,
|
|
25545
|
-
borderWidth,
|
|
25546
|
-
borderDash,
|
|
25547
|
-
type,
|
|
25548
|
-
adjustScaleRange: adjustScaleRange2,
|
|
25549
|
-
enter,
|
|
25550
|
-
leave
|
|
25551
|
-
};
|
|
25552
|
-
return { ...acc, [`annotation${i2 + 1}`]: annotation2 };
|
|
25553
|
-
}, {});
|
|
25554
|
-
};
|
|
25555
|
-
const getAnnotation = (options, state) => {
|
|
25556
|
-
const { showAnnotations, annotationsData } = (options == null ? void 0 : options.annotations) || {};
|
|
25557
|
-
const shouldGenerateAnnotations = showAnnotations && (annotationsData == null ? void 0 : annotationsData.length);
|
|
25558
|
-
const annotations = shouldGenerateAnnotations ? generateAnnotations(options, state) : {};
|
|
25559
|
-
return { annotations };
|
|
25560
|
-
};
|
|
25561
24994
|
const getUnitsFromLabel = (label) => {
|
|
25562
24995
|
const matches = label.match(/\[(.*)\]/g);
|
|
25563
24996
|
const units = matches && matches.length > 0 ? matches[0] : "";
|
|
25564
24997
|
return units;
|
|
25565
24998
|
};
|
|
25566
|
-
const customFormatNumber = (labelNumber) => {
|
|
24999
|
+
const customFormatNumber = (labelNumber, scientificNotation) => {
|
|
25567
25000
|
let roundOptions = {};
|
|
25568
|
-
if (
|
|
25001
|
+
if (!scientificNotation) {
|
|
25002
|
+
roundOptions = { scientific: false };
|
|
25003
|
+
} else if (Math.abs(labelNumber) < LOWER_BOUND || Math.abs(labelNumber) > UPPER_BOUND) {
|
|
25569
25004
|
roundOptions = { roundScientificCoefficient: 3 };
|
|
25570
25005
|
}
|
|
25571
25006
|
return displayNumber(roundByMagnitude(labelNumber), roundOptions);
|
|
25572
25007
|
};
|
|
25573
25008
|
const getLineChartToolTips = (options) => {
|
|
25009
|
+
const { scientificNotation } = options.tooltip;
|
|
25574
25010
|
const getTooltipLabels = ({
|
|
25575
25011
|
xAxisID = "",
|
|
25576
25012
|
yAxisID = ""
|
|
@@ -25600,7 +25036,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25600
25036
|
const labels = getTooltipLabels(tooltipItem[0].dataset);
|
|
25601
25037
|
const { titleLabel, titleAxisLabel } = labels ?? {};
|
|
25602
25038
|
const formattedValue = titleLabel === TooltipLabel.Y ? tooltipItem[0].parsed.y : tooltipItem[0].parsed.x;
|
|
25603
|
-
const roundedValue = customFormatNumber(formattedValue);
|
|
25039
|
+
const roundedValue = customFormatNumber(formattedValue, scientificNotation);
|
|
25604
25040
|
return `${roundedValue} ${titleAxisLabel}`;
|
|
25605
25041
|
};
|
|
25606
25042
|
const labelCallback = (tooltipItem) => {
|
|
@@ -25610,7 +25046,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25610
25046
|
const { valueLabel = "", valueAxisLabel = "" } = labels ?? {};
|
|
25611
25047
|
const getTooltipItemValue = () => {
|
|
25612
25048
|
const labelNumber = valueLabel === TooltipLabel.X ? tooltipItem.parsed.x : tooltipItem.parsed.y;
|
|
25613
|
-
return customFormatNumber(labelNumber);
|
|
25049
|
+
return customFormatNumber(labelNumber, scientificNotation);
|
|
25614
25050
|
};
|
|
25615
25051
|
const tooltipItemValue = getTooltipItemValue();
|
|
25616
25052
|
const units = getUnitsFromLabel(valueAxisLabel);
|
|
@@ -25660,6 +25096,267 @@ const getDraggableData = (options) => {
|
|
|
25660
25096
|
}
|
|
25661
25097
|
} : {};
|
|
25662
25098
|
};
|
|
25099
|
+
const UPSERT_HIDDEN_STATE = "UPSERT_HIDDEN_STATE";
|
|
25100
|
+
const TOGGLE_ANNOTATION_VISIBILITY = "TOGGLE_ANNOTATION_VISIBILITY";
|
|
25101
|
+
const legendInitialState = {
|
|
25102
|
+
hiddenStates: [],
|
|
25103
|
+
annotation: [],
|
|
25104
|
+
visibleAnnotationsIndexes: []
|
|
25105
|
+
};
|
|
25106
|
+
const legendReducer = (state, action) => {
|
|
25107
|
+
switch (action.type) {
|
|
25108
|
+
case UPSERT_HIDDEN_STATE: {
|
|
25109
|
+
const { label, hidden, datasetIndex } = action.payload;
|
|
25110
|
+
const existingIndex = state.hiddenStates.findIndex(
|
|
25111
|
+
(hs) => hs.label === label && hs.datasetIndex === datasetIndex
|
|
25112
|
+
);
|
|
25113
|
+
const newHiddenStates = [...state.hiddenStates];
|
|
25114
|
+
if (existingIndex !== -1) {
|
|
25115
|
+
newHiddenStates[existingIndex] = { label, hidden, datasetIndex };
|
|
25116
|
+
} else {
|
|
25117
|
+
newHiddenStates.push({ label, hidden, datasetIndex });
|
|
25118
|
+
}
|
|
25119
|
+
return {
|
|
25120
|
+
...state,
|
|
25121
|
+
hiddenStates: newHiddenStates
|
|
25122
|
+
};
|
|
25123
|
+
}
|
|
25124
|
+
case TOGGLE_ANNOTATION_VISIBILITY: {
|
|
25125
|
+
const index2 = action.payload;
|
|
25126
|
+
const newVisibleIndexes = state.visibleAnnotationsIndexes.includes(index2) ? state.visibleAnnotationsIndexes.filter((i2) => i2 !== index2) : [...state.visibleAnnotationsIndexes, index2];
|
|
25127
|
+
const annotation2 = state.annotation.map(
|
|
25128
|
+
(el) => el.annotationIndex === index2 ? { ...el, display: !el.display } : el
|
|
25129
|
+
);
|
|
25130
|
+
return {
|
|
25131
|
+
...state,
|
|
25132
|
+
annotation: annotation2,
|
|
25133
|
+
visibleAnnotationsIndexes: newVisibleIndexes
|
|
25134
|
+
};
|
|
25135
|
+
}
|
|
25136
|
+
default:
|
|
25137
|
+
return state;
|
|
25138
|
+
}
|
|
25139
|
+
};
|
|
25140
|
+
const annotationEnter = (element, chart2) => {
|
|
25141
|
+
var _a2;
|
|
25142
|
+
if ((_a2 = element.options.scaleID) == null ? void 0 : _a2.includes(AxisType.X)) {
|
|
25143
|
+
if (element.options.label) {
|
|
25144
|
+
element.options.label.xAdjust = chart2.chartArea.left;
|
|
25145
|
+
}
|
|
25146
|
+
}
|
|
25147
|
+
element.options.borderWidth = BORDER_WIDTH.HOVERED;
|
|
25148
|
+
if (element.options.label) {
|
|
25149
|
+
element.label.options.display = true;
|
|
25150
|
+
element.options.label.enabled = true;
|
|
25151
|
+
}
|
|
25152
|
+
chart2.draw();
|
|
25153
|
+
chart2.canvas.style.cursor = CursorStyle.Pointer;
|
|
25154
|
+
return true;
|
|
25155
|
+
};
|
|
25156
|
+
const annotationLeave = (element, chart2) => {
|
|
25157
|
+
element.options.borderWidth = BORDER_WIDTH.INITIAL;
|
|
25158
|
+
if (element.options.label) {
|
|
25159
|
+
element.label.options.display = false;
|
|
25160
|
+
element.options.label.enabled = false;
|
|
25161
|
+
}
|
|
25162
|
+
chart2.draw();
|
|
25163
|
+
chart2.canvas.style.cursor = CursorStyle.Initial;
|
|
25164
|
+
return true;
|
|
25165
|
+
};
|
|
25166
|
+
const generateAnnotations = (annotationsData, visibleAnnotationsIndexes) => {
|
|
25167
|
+
return annotationsData == null ? void 0 : annotationsData.map((ann, idx) => {
|
|
25168
|
+
if (visibleAnnotationsIndexes == null ? void 0 : visibleAnnotationsIndexes.includes(idx)) {
|
|
25169
|
+
const scaleID = (ann == null ? void 0 : ann.annotationAxis) ?? void 0;
|
|
25170
|
+
const color2 = (ann == null ? void 0 : ann.color) || COLORS[idx];
|
|
25171
|
+
const type = (ann == null ? void 0 : ann.type) || "line";
|
|
25172
|
+
const adjustScaleRange2 = ann == null ? void 0 : ann.adjustScaleRange;
|
|
25173
|
+
const borderColor = type === "line" ? color2 : "transparent";
|
|
25174
|
+
const borderWidth = type === "line" ? BORDER_WIDTH.INITIAL : 0;
|
|
25175
|
+
const borderDash = ANNOTATION_DASH;
|
|
25176
|
+
const label = type === "line" ? {
|
|
25177
|
+
backgroundColor: color2,
|
|
25178
|
+
content: ann == null ? void 0 : ann.label,
|
|
25179
|
+
display: false,
|
|
25180
|
+
position: Position.Top
|
|
25181
|
+
} : {
|
|
25182
|
+
content: ann == null ? void 0 : ann.label,
|
|
25183
|
+
display: true,
|
|
25184
|
+
font: { weight: "normal" }
|
|
25185
|
+
};
|
|
25186
|
+
const enter = ({
|
|
25187
|
+
element
|
|
25188
|
+
}, {
|
|
25189
|
+
chart: chart2
|
|
25190
|
+
}) => {
|
|
25191
|
+
if (type !== "line")
|
|
25192
|
+
return;
|
|
25193
|
+
annotationEnter(element, chart2);
|
|
25194
|
+
};
|
|
25195
|
+
const leave = ({
|
|
25196
|
+
element
|
|
25197
|
+
}, {
|
|
25198
|
+
chart: chart2
|
|
25199
|
+
}) => {
|
|
25200
|
+
if (type !== "line")
|
|
25201
|
+
return;
|
|
25202
|
+
annotationLeave(element, chart2);
|
|
25203
|
+
};
|
|
25204
|
+
return {
|
|
25205
|
+
...ann,
|
|
25206
|
+
display: true,
|
|
25207
|
+
annotationIndex: idx,
|
|
25208
|
+
id: `${ann == null ? void 0 : ann.label}-${ann == null ? void 0 : ann.value}-${idx}`,
|
|
25209
|
+
scaleID,
|
|
25210
|
+
label,
|
|
25211
|
+
backgroundColor: color2,
|
|
25212
|
+
borderColor,
|
|
25213
|
+
borderWidth,
|
|
25214
|
+
borderDash,
|
|
25215
|
+
type,
|
|
25216
|
+
adjustScaleRange: adjustScaleRange2,
|
|
25217
|
+
enter,
|
|
25218
|
+
leave
|
|
25219
|
+
};
|
|
25220
|
+
}
|
|
25221
|
+
});
|
|
25222
|
+
};
|
|
25223
|
+
const getAnnotation = ({
|
|
25224
|
+
showAnnotations,
|
|
25225
|
+
annotationsData,
|
|
25226
|
+
visibleAnnotationsIndexes
|
|
25227
|
+
}) => {
|
|
25228
|
+
const shouldGenerateAnnotations = showAnnotations && annotationsData && (annotationsData == null ? void 0 : annotationsData.length);
|
|
25229
|
+
return shouldGenerateAnnotations ? generateAnnotations(annotationsData, visibleAnnotationsIndexes) ?? [] : [];
|
|
25230
|
+
};
|
|
25231
|
+
const LegendContext = createContext$2(void 0);
|
|
25232
|
+
const LegendProvider = ({ children, options }) => {
|
|
25233
|
+
const { showAnnotations = true, annotationsData = [] } = (options == null ? void 0 : options.annotations) ?? {};
|
|
25234
|
+
const visibleAnnotationsIndexes = setAnnotations(annotationsData);
|
|
25235
|
+
const annotation2 = getAnnotation({
|
|
25236
|
+
showAnnotations,
|
|
25237
|
+
annotationsData,
|
|
25238
|
+
visibleAnnotationsIndexes
|
|
25239
|
+
});
|
|
25240
|
+
const initialState2 = {
|
|
25241
|
+
...legendInitialState,
|
|
25242
|
+
annotation: annotation2,
|
|
25243
|
+
visibleAnnotationsIndexes
|
|
25244
|
+
};
|
|
25245
|
+
const [state, dispatch] = useReducer(
|
|
25246
|
+
legendReducer,
|
|
25247
|
+
initialState2
|
|
25248
|
+
);
|
|
25249
|
+
const contextValue = useMemo(() => ({ state, dispatch }), [state, dispatch]);
|
|
25250
|
+
return /* @__PURE__ */ jsx(LegendContext.Provider, { value: contextValue, children });
|
|
25251
|
+
};
|
|
25252
|
+
const useLegend = () => {
|
|
25253
|
+
const context = useContext(LegendContext);
|
|
25254
|
+
if (context === void 0) {
|
|
25255
|
+
throw new Error("useLegend must be used within a LegendProvider");
|
|
25256
|
+
}
|
|
25257
|
+
return context;
|
|
25258
|
+
};
|
|
25259
|
+
const useLegendState = ({ chartRef, options }) => {
|
|
25260
|
+
const [hiddenStatesLocal, setHiddenStatesLocal] = useState(
|
|
25261
|
+
[]
|
|
25262
|
+
);
|
|
25263
|
+
const { state, dispatch } = useLegend();
|
|
25264
|
+
const {
|
|
25265
|
+
annotations,
|
|
25266
|
+
interactions: { onLegendClick },
|
|
25267
|
+
legend: { customLegend }
|
|
25268
|
+
} = options ?? {};
|
|
25269
|
+
const upsertHiddenState = useCallback(
|
|
25270
|
+
({ label, datasetIndex, hidden }) => {
|
|
25271
|
+
setHiddenStatesLocal((prevStates) => {
|
|
25272
|
+
const existingIndex = prevStates.findIndex(
|
|
25273
|
+
(state2) => state2.label === label
|
|
25274
|
+
);
|
|
25275
|
+
const newStates = [...prevStates];
|
|
25276
|
+
const newState = { label, datasetIndex, hidden };
|
|
25277
|
+
if (existingIndex !== -1) {
|
|
25278
|
+
newStates[existingIndex] = newState;
|
|
25279
|
+
} else {
|
|
25280
|
+
newStates.push(newState);
|
|
25281
|
+
}
|
|
25282
|
+
return newStates;
|
|
25283
|
+
});
|
|
25284
|
+
dispatch({ type: UPSERT_HIDDEN_STATE, payload: hiddenStatesLocal });
|
|
25285
|
+
},
|
|
25286
|
+
[dispatch]
|
|
25287
|
+
);
|
|
25288
|
+
const legendClick = useCallback(
|
|
25289
|
+
(_2, legendItem2) => {
|
|
25290
|
+
const { datasetIndex = 0 } = legendItem2;
|
|
25291
|
+
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
25292
|
+
const { datasets } = (chartInstance == null ? void 0 : chartInstance.data) || {};
|
|
25293
|
+
const dataset = (datasets == null ? void 0 : datasets[datasetIndex]) ?? {};
|
|
25294
|
+
const meta = chartInstance == null ? void 0 : chartInstance.getDatasetMeta(datasetIndex);
|
|
25295
|
+
const isDatasetVisible = (chartInstance == null ? void 0 : chartInstance.isDatasetVisible(datasetIndex)) ?? true;
|
|
25296
|
+
upsertHiddenState({
|
|
25297
|
+
label: dataset.label ?? "",
|
|
25298
|
+
datasetIndex,
|
|
25299
|
+
hidden: isDatasetVisible
|
|
25300
|
+
});
|
|
25301
|
+
chartInstance == null ? void 0 : chartInstance.setDatasetVisibility(datasetIndex, !isDatasetVisible);
|
|
25302
|
+
if ((annotations == null ? void 0 : annotations.controlAnnotation) && (dataset == null ? void 0 : dataset.isAnnotation)) {
|
|
25303
|
+
const { annotationIndex = -1 } = dataset;
|
|
25304
|
+
dispatch({
|
|
25305
|
+
type: TOGGLE_ANNOTATION_VISIBILITY,
|
|
25306
|
+
payload: annotationIndex
|
|
25307
|
+
});
|
|
25308
|
+
}
|
|
25309
|
+
if (dataset == null ? void 0 : dataset.displayGroup) {
|
|
25310
|
+
datasets == null ? void 0 : datasets.forEach((ds, ix) => {
|
|
25311
|
+
if (ds.displayGroup !== dataset.displayGroup)
|
|
25312
|
+
return;
|
|
25313
|
+
if (chartInstance && meta) {
|
|
25314
|
+
chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
|
|
25315
|
+
}
|
|
25316
|
+
});
|
|
25317
|
+
}
|
|
25318
|
+
if (onLegendClick) {
|
|
25319
|
+
const legendState = legendItem2.hidden ?? false;
|
|
25320
|
+
onLegendClick(legendItem2 == null ? void 0 : legendItem2.text, legendState);
|
|
25321
|
+
}
|
|
25322
|
+
chartInstance == null ? void 0 : chartInstance.update();
|
|
25323
|
+
},
|
|
25324
|
+
[chartRef, annotations, onLegendClick, state.hiddenStates]
|
|
25325
|
+
);
|
|
25326
|
+
const legend2 = useMemo(
|
|
25327
|
+
() => getLegend(options, legendClick),
|
|
25328
|
+
[options, legendClick]
|
|
25329
|
+
);
|
|
25330
|
+
const customLegendPlugin = useMemo(
|
|
25331
|
+
() => ({
|
|
25332
|
+
[CUSTOM_LEGEND_PLUGIN_NAME]: (customLegend == null ? void 0 : customLegend.customLegendPlugin) && {
|
|
25333
|
+
containerID: customLegend == null ? void 0 : customLegend.customLegendContainerID
|
|
25334
|
+
}
|
|
25335
|
+
}),
|
|
25336
|
+
[customLegend]
|
|
25337
|
+
);
|
|
25338
|
+
return {
|
|
25339
|
+
legendClick,
|
|
25340
|
+
hiddenStates: hiddenStatesLocal,
|
|
25341
|
+
legend: legend2,
|
|
25342
|
+
customLegendPlugin,
|
|
25343
|
+
upsertHiddenState,
|
|
25344
|
+
visibleAnnotationsIndexes: state.visibleAnnotationsIndexes
|
|
25345
|
+
};
|
|
25346
|
+
};
|
|
25347
|
+
const toAnnotationObject = (annotationArr = []) => {
|
|
25348
|
+
let annotations = {};
|
|
25349
|
+
if (annotationArr.length) {
|
|
25350
|
+
annotations = annotationArr.reduce(
|
|
25351
|
+
(acc, annotation2, idx) => {
|
|
25352
|
+
acc[`annotation${idx + 1}`] = annotation2;
|
|
25353
|
+
return acc;
|
|
25354
|
+
},
|
|
25355
|
+
{}
|
|
25356
|
+
);
|
|
25357
|
+
}
|
|
25358
|
+
return { annotations };
|
|
25359
|
+
};
|
|
25663
25360
|
const useChartOptions = ({
|
|
25664
25361
|
chartRef,
|
|
25665
25362
|
state,
|
|
@@ -25683,13 +25380,7 @@ const useChartOptions = ({
|
|
|
25683
25380
|
},
|
|
25684
25381
|
chartStyling: { layoutPadding }
|
|
25685
25382
|
} = options;
|
|
25686
|
-
const {
|
|
25687
|
-
enableDragPoints,
|
|
25688
|
-
zoomEnabled,
|
|
25689
|
-
panEnabled,
|
|
25690
|
-
lineEnabled,
|
|
25691
|
-
showAnnotationLineIndex
|
|
25692
|
-
} = state;
|
|
25383
|
+
const { enableDragPoints, zoomEnabled, panEnabled, lineEnabled } = state;
|
|
25693
25384
|
const [hoveredPoint, setHoveredPoint] = useState(
|
|
25694
25385
|
null
|
|
25695
25386
|
);
|
|
@@ -25700,18 +25391,11 @@ const useChartOptions = ({
|
|
|
25700
25391
|
dispatch,
|
|
25701
25392
|
generatedDatasets
|
|
25702
25393
|
});
|
|
25703
|
-
const {
|
|
25704
|
-
|
|
25705
|
-
|
|
25706
|
-
state,
|
|
25707
|
-
dispatch
|
|
25708
|
-
});
|
|
25394
|
+
const { legend: legend2, customLegendPlugin } = useLegendState({ chartRef, options });
|
|
25395
|
+
const { state: legendState } = useLegend();
|
|
25396
|
+
const { annotation: annotation2 } = legendState;
|
|
25709
25397
|
const datalabels = getLineChartDataLabels(options);
|
|
25710
25398
|
const tooltip = getLineChartToolTips(options);
|
|
25711
|
-
const annotation2 = useMemo(
|
|
25712
|
-
() => getAnnotation(options, state),
|
|
25713
|
-
[showAnnotationLineIndex, legendClick]
|
|
25714
|
-
);
|
|
25715
25399
|
const scales = useMemo(
|
|
25716
25400
|
() => autoScale(options, state, generatedDatasets, chartRef),
|
|
25717
25401
|
[options, state, generatedDatasets, chartRef]
|
|
@@ -25748,7 +25432,7 @@ const useChartOptions = ({
|
|
|
25748
25432
|
);
|
|
25749
25433
|
const plugins = {
|
|
25750
25434
|
datalabels,
|
|
25751
|
-
annotation: annotation2,
|
|
25435
|
+
annotation: toAnnotationObject(annotation2),
|
|
25752
25436
|
zoom: { pan: panOptions, zoom: zoomOptions },
|
|
25753
25437
|
tooltip,
|
|
25754
25438
|
legend: { ...legend2, display: false },
|
|
@@ -26103,48 +25787,458 @@ const chartAreaTextPlugin = {
|
|
|
26103
25787
|
position
|
|
26104
25788
|
});
|
|
26105
25789
|
}
|
|
26106
|
-
};
|
|
26107
|
-
var defaultTranslations = /* @__PURE__ */ ((defaultTranslations2) => {
|
|
26108
|
-
defaultTranslations2["label"] = "Label";
|
|
26109
|
-
defaultTranslations2["pointsLines"] = "Points & lines";
|
|
26110
|
-
defaultTranslations2["linesOnly"] = "Lines only";
|
|
26111
|
-
defaultTranslations2["pointsOnly"] = "Points only";
|
|
26112
|
-
defaultTranslations2["axesOptions"] = "Axes options";
|
|
26113
|
-
defaultTranslations2["resetAxes"] = "Reset Axes";
|
|
26114
|
-
defaultTranslations2["done"] = "Done";
|
|
26115
|
-
defaultTranslations2["downloadAsPNG"] = "Download as PNG";
|
|
26116
|
-
defaultTranslations2["showChart"] = "Show chart";
|
|
26117
|
-
defaultTranslations2["showTable"] = "Show table";
|
|
26118
|
-
defaultTranslations2["dragToZoom"] = "Drag to zoom";
|
|
26119
|
-
defaultTranslations2["dragToPan"] = "Drag to pan";
|
|
26120
|
-
defaultTranslations2["dragToMovePoints"] = "Drag to move points";
|
|
26121
|
-
defaultTranslations2["dragDisabled"] = "Drag disabled";
|
|
26122
|
-
defaultTranslations2["hideLegend"] = "Hide Legend";
|
|
26123
|
-
defaultTranslations2["showLegend"] = "Show Legend";
|
|
26124
|
-
defaultTranslations2["mustHaveAValue"] = "Must have a value";
|
|
26125
|
-
defaultTranslations2["mustBeANumber"] = "Must be a number";
|
|
26126
|
-
defaultTranslations2["mustBeLessThanMax"] = "Must be less than max";
|
|
26127
|
-
defaultTranslations2["mustBeGreaterThanMin"] = "Must be greater than min";
|
|
26128
|
-
defaultTranslations2["doubleClickToReset"] = "Double click on canvas to reset";
|
|
26129
|
-
defaultTranslations2["orDoubleClickToCanvas"] = "or double click on canvas";
|
|
26130
|
-
return defaultTranslations2;
|
|
26131
|
-
})(defaultTranslations || {});
|
|
26132
|
-
const getTranslations = (translations = {}) => {
|
|
26133
|
-
return Object.keys(defaultTranslations).reduce(
|
|
26134
|
-
(acc, key) => ({
|
|
26135
|
-
...acc,
|
|
26136
|
-
[key]: translations[key] || defaultTranslations[key]
|
|
26137
|
-
}),
|
|
26138
|
-
{}
|
|
25790
|
+
};
|
|
25791
|
+
var defaultTranslations = /* @__PURE__ */ ((defaultTranslations2) => {
|
|
25792
|
+
defaultTranslations2["label"] = "Label";
|
|
25793
|
+
defaultTranslations2["pointsLines"] = "Points & lines";
|
|
25794
|
+
defaultTranslations2["linesOnly"] = "Lines only";
|
|
25795
|
+
defaultTranslations2["pointsOnly"] = "Points only";
|
|
25796
|
+
defaultTranslations2["axesOptions"] = "Axes options";
|
|
25797
|
+
defaultTranslations2["resetAxes"] = "Reset Axes";
|
|
25798
|
+
defaultTranslations2["done"] = "Done";
|
|
25799
|
+
defaultTranslations2["downloadAsPNG"] = "Download as PNG";
|
|
25800
|
+
defaultTranslations2["showChart"] = "Show chart";
|
|
25801
|
+
defaultTranslations2["showTable"] = "Show table";
|
|
25802
|
+
defaultTranslations2["dragToZoom"] = "Drag to zoom";
|
|
25803
|
+
defaultTranslations2["dragToPan"] = "Drag to pan";
|
|
25804
|
+
defaultTranslations2["dragToMovePoints"] = "Drag to move points";
|
|
25805
|
+
defaultTranslations2["dragDisabled"] = "Drag disabled";
|
|
25806
|
+
defaultTranslations2["hideLegend"] = "Hide Legend";
|
|
25807
|
+
defaultTranslations2["showLegend"] = "Show Legend";
|
|
25808
|
+
defaultTranslations2["mustHaveAValue"] = "Must have a value";
|
|
25809
|
+
defaultTranslations2["mustBeANumber"] = "Must be a number";
|
|
25810
|
+
defaultTranslations2["mustBeLessThanMax"] = "Must be less than max";
|
|
25811
|
+
defaultTranslations2["mustBeGreaterThanMin"] = "Must be greater than min";
|
|
25812
|
+
defaultTranslations2["doubleClickToReset"] = "Double click on canvas to reset";
|
|
25813
|
+
defaultTranslations2["orDoubleClickToCanvas"] = "or double click on canvas";
|
|
25814
|
+
return defaultTranslations2;
|
|
25815
|
+
})(defaultTranslations || {});
|
|
25816
|
+
const getTranslations = (translations = {}) => {
|
|
25817
|
+
return Object.keys(defaultTranslations).reduce(
|
|
25818
|
+
(acc, key) => ({
|
|
25819
|
+
...acc,
|
|
25820
|
+
[key]: translations[key] || defaultTranslations[key]
|
|
25821
|
+
}),
|
|
25822
|
+
{}
|
|
25823
|
+
);
|
|
25824
|
+
};
|
|
25825
|
+
const config = {
|
|
25826
|
+
[INIT_KEYS.TRANSLATIONS]: getTranslations(),
|
|
25827
|
+
[INIT_KEYS.LANGUAGE_KEY]: "en"
|
|
25828
|
+
};
|
|
25829
|
+
const getConfig = (key = "") => key ? config[key] : config;
|
|
25830
|
+
const setConfig = (key, newValue) => {
|
|
25831
|
+
config[key] = newValue;
|
|
25832
|
+
};
|
|
25833
|
+
var noop = function() {
|
|
25834
|
+
};
|
|
25835
|
+
var isBrowser = typeof window !== "undefined";
|
|
25836
|
+
var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
|
|
25837
|
+
const useIsomorphicLayoutEffect$1 = useIsomorphicLayoutEffect;
|
|
25838
|
+
var defaultState = {
|
|
25839
|
+
x: 0,
|
|
25840
|
+
y: 0,
|
|
25841
|
+
width: 0,
|
|
25842
|
+
height: 0,
|
|
25843
|
+
top: 0,
|
|
25844
|
+
left: 0,
|
|
25845
|
+
bottom: 0,
|
|
25846
|
+
right: 0
|
|
25847
|
+
};
|
|
25848
|
+
function useMeasure() {
|
|
25849
|
+
var _a2 = useState(null), element = _a2[0], ref = _a2[1];
|
|
25850
|
+
var _b2 = useState(defaultState), rect = _b2[0], setRect = _b2[1];
|
|
25851
|
+
var observer = useMemo(function() {
|
|
25852
|
+
return new window.ResizeObserver(function(entries) {
|
|
25853
|
+
if (entries[0]) {
|
|
25854
|
+
var _a3 = entries[0].contentRect, x2 = _a3.x, y2 = _a3.y, width = _a3.width, height = _a3.height, top_1 = _a3.top, left2 = _a3.left, bottom2 = _a3.bottom, right2 = _a3.right;
|
|
25855
|
+
setRect({ x: x2, y: y2, width, height, top: top_1, left: left2, bottom: bottom2, right: right2 });
|
|
25856
|
+
}
|
|
25857
|
+
});
|
|
25858
|
+
}, []);
|
|
25859
|
+
useIsomorphicLayoutEffect$1(function() {
|
|
25860
|
+
if (!element)
|
|
25861
|
+
return;
|
|
25862
|
+
observer.observe(element);
|
|
25863
|
+
return function() {
|
|
25864
|
+
observer.disconnect();
|
|
25865
|
+
};
|
|
25866
|
+
}, [element]);
|
|
25867
|
+
return [ref, rect];
|
|
25868
|
+
}
|
|
25869
|
+
const useMeasure$1 = isBrowser && typeof window.ResizeObserver !== "undefined" ? useMeasure : function() {
|
|
25870
|
+
return [noop, defaultState];
|
|
25871
|
+
};
|
|
25872
|
+
const legend = "_legend_wpro0_1";
|
|
25873
|
+
const isDragging = "_isDragging_wpro0_8";
|
|
25874
|
+
const legendItems = "_legendItems_wpro0_11";
|
|
25875
|
+
const isHidden = "_isHidden_wpro0_47";
|
|
25876
|
+
const legendToggle = "_legendToggle_wpro0_50";
|
|
25877
|
+
const legendItem = "_legendItem_wpro0_11";
|
|
25878
|
+
const legendItemSymbol = "_legendItemSymbol_wpro0_80";
|
|
25879
|
+
const legendItemBox = "_legendItemBox_wpro0_90";
|
|
25880
|
+
const legendItemLine = "_legendItemLine_wpro0_95";
|
|
25881
|
+
const legendItemPoint = "_legendItemPoint_wpro0_103";
|
|
25882
|
+
const legendItemText = "_legendItemText_wpro0_110";
|
|
25883
|
+
const scrollbars = "_scrollbars_wpro0_113";
|
|
25884
|
+
const dropzoneContainer = "_dropzoneContainer_wpro0_140";
|
|
25885
|
+
const dropzone = "_dropzone_wpro0_140";
|
|
25886
|
+
const left = "_left_wpro0_149";
|
|
25887
|
+
const right = "_right_wpro0_153";
|
|
25888
|
+
const top = "_top_wpro0_157";
|
|
25889
|
+
const bottom = "_bottom_wpro0_161";
|
|
25890
|
+
const dropzonePlaceholder = "_dropzonePlaceholder_wpro0_165";
|
|
25891
|
+
const isActive = "_isActive_wpro0_173";
|
|
25892
|
+
const resizeContainer = "_resizeContainer_wpro0_176";
|
|
25893
|
+
const styles$2 = {
|
|
25894
|
+
legend,
|
|
25895
|
+
isDragging,
|
|
25896
|
+
legendItems,
|
|
25897
|
+
isHidden,
|
|
25898
|
+
legendToggle,
|
|
25899
|
+
legendItem,
|
|
25900
|
+
legendItemSymbol,
|
|
25901
|
+
legendItemBox,
|
|
25902
|
+
legendItemLine,
|
|
25903
|
+
legendItemPoint,
|
|
25904
|
+
legendItemText,
|
|
25905
|
+
scrollbars,
|
|
25906
|
+
dropzoneContainer,
|
|
25907
|
+
dropzone,
|
|
25908
|
+
left,
|
|
25909
|
+
right,
|
|
25910
|
+
top,
|
|
25911
|
+
bottom,
|
|
25912
|
+
dropzonePlaceholder,
|
|
25913
|
+
isActive,
|
|
25914
|
+
resizeContainer
|
|
25915
|
+
};
|
|
25916
|
+
var ChartType = /* @__PURE__ */ ((ChartType2) => {
|
|
25917
|
+
ChartType2["LINE"] = "line";
|
|
25918
|
+
ChartType2["BAR"] = "bar";
|
|
25919
|
+
ChartType2["PIE"] = "pie";
|
|
25920
|
+
return ChartType2;
|
|
25921
|
+
})(ChartType || {});
|
|
25922
|
+
const circleSvg = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTIiIGZpbGw9ImN1cnJlbnRDb2xvciIgLz48L3N2Zz4=";
|
|
25923
|
+
const rectSvg = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHJlY3QgeD0iMiIgeT0iMiIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIiBmaWxsPSJjdXJyZW50Q29sb3IiIC8+PC9zdmc+";
|
|
25924
|
+
const rectRotSvg = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHJlY3QgeD0iMyIgeT0iMyIgd2lkdGg9IjE4IiBoZWlnaHQ9IjE4IiBmaWxsPSJjdXJyZW50Q29sb3IiIHRyYW5zZm9ybT0ncm90YXRlKDQ1IDEyIDEyKScgLz48L3N2Zz4=";
|
|
25925
|
+
const triangleSvg = "data:image/svg+xml;base64,PHN2ZyAgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiB3aWR0aD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0ibTAgMGgyNHYyNGgtMjR6Ii8+PC9jbGlwUGF0aD48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxwYXRoIGQ9Im0yMi43OTk4IDIyLjA2MjNoLTIxLjU5OTZjLS4yMTA2Ni4wMDAxLS40MTc2MTctLjA1NTQtLjYwMDA2Ny0uMTYwNy0uMTgyNDUxLS4xMDUzLS4zMzM5NjUtLjI1NjctLjQzOTMxMS0uNDM5Mi0uMTA1MzQ2NC0uMTgyNC0uMTYwODEyMjgtLjM4OTMtLjE2MDgyMi0uNnMuMDU1NDM3Mi0uNDE3Ni4xNjA3NjctLjZsMTAuNzk5ODMzLTE4LjcwNTE4Yy4xMTM5LS4xNzEzNy4yNjg0LS4zMTE5MS40NDk3LS40MDkxMy4xODE0LS4wOTcyMi4zODM5LS4xNDgwOS41ODk3LS4xNDgwOXMuNDA4My4wNTA4Ny41ODk3LjE0ODA5Yy4xODEzLjA5NzIyLjMzNTguMjM3NzYuNDQ5Ny40MDkxM2wxMC43OTk4IDE4LjcwNTE4Yy4xMDU0LjE4MjQuMTYwOC4zODkzLjE2MDguNnMtLjA1NTUuNDE3Ni0uMTYwOC42Yy0uMTA1NC4xODI1LS4yNTY5LjMzMzktLjQzOTMuNDM5Mi0uMTgyNS4xMDUzLS4zODk0LjE2MDgtLjYwMDEuMTYwN3oiIGZpbGw9ImN1cnJlbnRDb2xvciIvPjwvZz48L3N2Zz4=";
|
|
25926
|
+
const LEGEND_SYMBOL_SIZE$1 = 16;
|
|
25927
|
+
const LineItem = ({ dataset }) => {
|
|
25928
|
+
var _a2;
|
|
25929
|
+
const { borderColor, borderDash, borderWidth } = dataset;
|
|
25930
|
+
const offset = borderDash.length ? (LEGEND_SYMBOL_SIZE$1 - borderDash[0]) / 2 % (borderDash[0] + borderDash[1]) * -1 : 0;
|
|
25931
|
+
const borderDashString = ((_a2 = dataset.borderDash) == null ? void 0 : _a2.join(" ")) || "";
|
|
25932
|
+
return /* @__PURE__ */ jsx("span", { className: styles$2.legendItemLine, children: /* @__PURE__ */ jsx(
|
|
25933
|
+
"svg",
|
|
25934
|
+
{
|
|
25935
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
25936
|
+
viewBox: `0 0 ${LEGEND_SYMBOL_SIZE$1} ${LEGEND_SYMBOL_SIZE$1}`,
|
|
25937
|
+
children: /* @__PURE__ */ jsx(
|
|
25938
|
+
"line",
|
|
25939
|
+
{
|
|
25940
|
+
x1: "0",
|
|
25941
|
+
y1: "50%",
|
|
25942
|
+
x2: "100%",
|
|
25943
|
+
y2: "50%",
|
|
25944
|
+
stroke: borderColor,
|
|
25945
|
+
strokeWidth: borderWidth,
|
|
25946
|
+
strokeDasharray: borderDashString,
|
|
25947
|
+
strokeDashoffset: offset
|
|
25948
|
+
}
|
|
25949
|
+
)
|
|
25950
|
+
}
|
|
25951
|
+
) });
|
|
25952
|
+
};
|
|
25953
|
+
const PointItem = ({ dataset }) => {
|
|
25954
|
+
const { pointBackgroundColor, pointRadius, pointStyle = "" } = dataset;
|
|
25955
|
+
if (!pointRadius)
|
|
25956
|
+
return null;
|
|
25957
|
+
const size = pointRadius * 2;
|
|
25958
|
+
const icons = {
|
|
25959
|
+
circle: circleSvg,
|
|
25960
|
+
triangle: triangleSvg,
|
|
25961
|
+
rectRot: rectRotSvg,
|
|
25962
|
+
rect: rectSvg
|
|
25963
|
+
};
|
|
25964
|
+
return /* @__PURE__ */ jsx("span", { className: styles$2.legendItemPoint, children: /* @__PURE__ */ jsx(
|
|
25965
|
+
Icon,
|
|
25966
|
+
{
|
|
25967
|
+
icon: icons[pointStyle] || circleSvg,
|
|
25968
|
+
size,
|
|
25969
|
+
color: pointBackgroundColor
|
|
25970
|
+
}
|
|
25971
|
+
) });
|
|
25972
|
+
};
|
|
25973
|
+
const BoxItem = ({ dataset }) => {
|
|
25974
|
+
const { backgroundColor } = dataset;
|
|
25975
|
+
const style = { backgroundColor };
|
|
25976
|
+
return /* @__PURE__ */ jsx("span", { className: styles$2.legendItemBox, style });
|
|
25977
|
+
};
|
|
25978
|
+
const LegendItemLine = ({ dataset }) => {
|
|
25979
|
+
const { annotationType, showLine } = dataset;
|
|
25980
|
+
switch (annotationType) {
|
|
25981
|
+
case AnnotationType.Box:
|
|
25982
|
+
case AnnotationType.Ellipse:
|
|
25983
|
+
return /* @__PURE__ */ jsx(BoxItem, { dataset });
|
|
25984
|
+
case AnnotationType.Line:
|
|
25985
|
+
return /* @__PURE__ */ jsx(LineItem, { dataset });
|
|
25986
|
+
default:
|
|
25987
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25988
|
+
showLine && /* @__PURE__ */ jsx(LineItem, { dataset }),
|
|
25989
|
+
/* @__PURE__ */ jsx(PointItem, { dataset })
|
|
25990
|
+
] });
|
|
25991
|
+
}
|
|
25992
|
+
};
|
|
25993
|
+
const LEGEND_SYMBOL_SIZE = 16;
|
|
25994
|
+
const renderLegendItemSymbol = (dataset, chartType) => {
|
|
25995
|
+
switch (chartType) {
|
|
25996
|
+
case ChartType.LINE:
|
|
25997
|
+
return /* @__PURE__ */ jsx(LegendItemLine, { dataset });
|
|
25998
|
+
case ChartType.BAR:
|
|
25999
|
+
return /* @__PURE__ */ jsx("span", { className: styles$2.legendItemBox, children: /* @__PURE__ */ jsx(TbSquareFilled, { color: dataset.borderColor }) });
|
|
26000
|
+
case ChartType.PIE:
|
|
26001
|
+
return /* @__PURE__ */ jsx("span", { className: styles$2.legendItemPoint, children: /* @__PURE__ */ jsx(Icon, { icon: circleSvg }) });
|
|
26002
|
+
default:
|
|
26003
|
+
return null;
|
|
26004
|
+
}
|
|
26005
|
+
};
|
|
26006
|
+
const LegendItem = ({
|
|
26007
|
+
hidden,
|
|
26008
|
+
dataset,
|
|
26009
|
+
handleClick,
|
|
26010
|
+
chartType
|
|
26011
|
+
}) => {
|
|
26012
|
+
return /* @__PURE__ */ jsxs(
|
|
26013
|
+
"div",
|
|
26014
|
+
{
|
|
26015
|
+
className: cx(styles$2.legendItem, hidden && styles$2.isHidden),
|
|
26016
|
+
onClick: handleClick,
|
|
26017
|
+
children: [
|
|
26018
|
+
/* @__PURE__ */ jsx(
|
|
26019
|
+
"span",
|
|
26020
|
+
{
|
|
26021
|
+
className: styles$2.legendItemSymbol,
|
|
26022
|
+
style: { width: LEGEND_SYMBOL_SIZE },
|
|
26023
|
+
children: renderLegendItemSymbol(dataset, chartType)
|
|
26024
|
+
}
|
|
26025
|
+
),
|
|
26026
|
+
/* @__PURE__ */ jsx("span", { className: styles$2.legendItemText, children: dataset.label })
|
|
26027
|
+
]
|
|
26028
|
+
}
|
|
26029
|
+
);
|
|
26030
|
+
};
|
|
26031
|
+
const getGeneratedLabels = (chart2) => {
|
|
26032
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
26033
|
+
return ((_e2 = (_d2 = (_c2 = (_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.legend) == null ? void 0 : _c2.labels) == null ? void 0 : _d2.generateLabels) == null ? void 0 : _e2.call(_d2, chart2)) ?? [];
|
|
26034
|
+
};
|
|
26035
|
+
const useGeneratedLabels = (chartRef, generatedDatasets) => {
|
|
26036
|
+
const [items, setItems] = useState([]);
|
|
26037
|
+
useEffect(() => {
|
|
26038
|
+
const chart2 = chartRef.current;
|
|
26039
|
+
if (!chart2)
|
|
26040
|
+
return;
|
|
26041
|
+
const newItems = getGeneratedLabels(chart2);
|
|
26042
|
+
setItems(newItems);
|
|
26043
|
+
}, [generatedDatasets, chartRef]);
|
|
26044
|
+
return items;
|
|
26045
|
+
};
|
|
26046
|
+
const LEGEND_MARGIN = 4;
|
|
26047
|
+
const createLegendStyle = (legendPosition, chart2) => {
|
|
26048
|
+
const { height = 0, width = 0, chartArea } = chart2 ?? {};
|
|
26049
|
+
const { top: top2 = 0, left: left2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = chartArea ?? {};
|
|
26050
|
+
return {
|
|
26051
|
+
left: legendPosition.includes("left") ? left2 : void 0,
|
|
26052
|
+
right: legendPosition.includes("right") ? width - right2 : void 0,
|
|
26053
|
+
top: legendPosition.includes("top") ? top2 : void 0,
|
|
26054
|
+
bottom: legendPosition.includes("bottom") ? height - bottom2 : void 0,
|
|
26055
|
+
maxHeight: 0.5 * (bottom2 - top2 - LEGEND_MARGIN * 2),
|
|
26056
|
+
maxWidth: 0.9 * (right2 - left2 - LEGEND_MARGIN * 2),
|
|
26057
|
+
margin: LEGEND_MARGIN
|
|
26058
|
+
};
|
|
26059
|
+
};
|
|
26060
|
+
const LegendItems = ({
|
|
26061
|
+
items,
|
|
26062
|
+
hiddenStates,
|
|
26063
|
+
datasets,
|
|
26064
|
+
legendClick,
|
|
26065
|
+
chartType
|
|
26066
|
+
}) => /* @__PURE__ */ jsx("div", { className: styles$2.legendItems, children: items.map((item) => {
|
|
26067
|
+
var _a2;
|
|
26068
|
+
if (datasets[item.datasetIndex].hideLegend) {
|
|
26069
|
+
return null;
|
|
26070
|
+
}
|
|
26071
|
+
const hiddenState = ((_a2 = hiddenStates.find((state) => state.label === item.text)) == null ? void 0 : _a2.hidden) ?? false;
|
|
26072
|
+
return /* @__PURE__ */ jsx(
|
|
26073
|
+
LegendItem,
|
|
26074
|
+
{
|
|
26075
|
+
hidden: hiddenState,
|
|
26076
|
+
dataset: datasets[item.datasetIndex],
|
|
26077
|
+
handleClick: (_2) => legendClick(_2, item),
|
|
26078
|
+
chartType
|
|
26079
|
+
},
|
|
26080
|
+
`${item.datasetIndex}-hidden-${item.hidden}`
|
|
26081
|
+
);
|
|
26082
|
+
}) });
|
|
26083
|
+
const LegendPanel = forwardRef(
|
|
26084
|
+
({ legendPosition, chartRef, isDragging: isDragging2, legendConfig }, ref) => {
|
|
26085
|
+
var _a2;
|
|
26086
|
+
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
26087
|
+
const { options, generatedDatasets, chartType } = legendConfig;
|
|
26088
|
+
const datasets = (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets;
|
|
26089
|
+
const { legend: legend2, legendClick, hiddenStates } = useLegendState({
|
|
26090
|
+
chartRef,
|
|
26091
|
+
options
|
|
26092
|
+
});
|
|
26093
|
+
const [legendEnabled, setLegendEnabled] = useState((legend2 == null ? void 0 : legend2.display) ?? true);
|
|
26094
|
+
const items = useGeneratedLabels(chartRef, generatedDatasets);
|
|
26095
|
+
const style = createLegendStyle(legendPosition, chart2);
|
|
26096
|
+
return /* @__PURE__ */ jsxs(
|
|
26097
|
+
"div",
|
|
26098
|
+
{
|
|
26099
|
+
ref,
|
|
26100
|
+
className: cx(
|
|
26101
|
+
styles$2.legend,
|
|
26102
|
+
!legendEnabled && styles$2.isHidden,
|
|
26103
|
+
isDragging2 && styles$2.isDragging
|
|
26104
|
+
),
|
|
26105
|
+
style,
|
|
26106
|
+
children: [
|
|
26107
|
+
/* @__PURE__ */ jsx("div", { className: styles$2.legendToggle, children: /* @__PURE__ */ jsx(
|
|
26108
|
+
Button,
|
|
26109
|
+
{
|
|
26110
|
+
onClick: () => setLegendEnabled(!legendEnabled),
|
|
26111
|
+
small: true,
|
|
26112
|
+
round: true,
|
|
26113
|
+
icon: legendEnabled ? /* @__PURE__ */ jsx(TbX, {}) : /* @__PURE__ */ jsx(TbList, {})
|
|
26114
|
+
}
|
|
26115
|
+
) }),
|
|
26116
|
+
/* @__PURE__ */ jsx(
|
|
26117
|
+
LegendItems,
|
|
26118
|
+
{
|
|
26119
|
+
items,
|
|
26120
|
+
hiddenStates,
|
|
26121
|
+
datasets,
|
|
26122
|
+
legendClick,
|
|
26123
|
+
chartType
|
|
26124
|
+
}
|
|
26125
|
+
)
|
|
26126
|
+
]
|
|
26127
|
+
}
|
|
26128
|
+
);
|
|
26129
|
+
}
|
|
26130
|
+
);
|
|
26131
|
+
const LegendDropZone = (legendDropZoneProps) => {
|
|
26132
|
+
const { position, onDrop, placeholderSize } = legendDropZoneProps;
|
|
26133
|
+
const [{ isOver, canDrop }, dropRef] = useDrop(() => ({
|
|
26134
|
+
accept: "legend",
|
|
26135
|
+
drop: onDrop,
|
|
26136
|
+
collect: (monitor) => ({
|
|
26137
|
+
isOver: monitor.isOver(),
|
|
26138
|
+
canDrop: monitor.canDrop()
|
|
26139
|
+
})
|
|
26140
|
+
}));
|
|
26141
|
+
const isActive2 = isOver && canDrop;
|
|
26142
|
+
return /* @__PURE__ */ jsx(
|
|
26143
|
+
"div",
|
|
26144
|
+
{
|
|
26145
|
+
ref: dropRef,
|
|
26146
|
+
className: cx(
|
|
26147
|
+
styles$2.dropzone,
|
|
26148
|
+
isActive2 && styles$2.isActive,
|
|
26149
|
+
position.includes("left") && styles$2.left,
|
|
26150
|
+
position.includes("right") && styles$2.right,
|
|
26151
|
+
position.includes("top") && styles$2.top,
|
|
26152
|
+
position.includes("bottom") && styles$2.bottom
|
|
26153
|
+
),
|
|
26154
|
+
children: /* @__PURE__ */ jsx(
|
|
26155
|
+
"div",
|
|
26156
|
+
{
|
|
26157
|
+
className: styles$2.dropzonePlaceholder,
|
|
26158
|
+
style: { ...placeholderSize, margin: LEGEND_MARGIN }
|
|
26159
|
+
}
|
|
26160
|
+
)
|
|
26161
|
+
}
|
|
26139
26162
|
);
|
|
26140
26163
|
};
|
|
26141
|
-
const
|
|
26142
|
-
|
|
26143
|
-
[
|
|
26164
|
+
const LegendDropZones = (legendDropZonesProps) => {
|
|
26165
|
+
const { chartArea, setLegendPosition, isDragging: isDragging2, placeholderSize } = legendDropZonesProps ?? {};
|
|
26166
|
+
const positions2 = [
|
|
26167
|
+
Position.TopLeft,
|
|
26168
|
+
Position.TopRight,
|
|
26169
|
+
Position.BottomLeft,
|
|
26170
|
+
Position.BottomRight
|
|
26171
|
+
];
|
|
26172
|
+
const { top: top2, left: left2, width, height } = chartArea ?? {};
|
|
26173
|
+
return /* @__PURE__ */ jsx(
|
|
26174
|
+
"div",
|
|
26175
|
+
{
|
|
26176
|
+
className: styles$2.dropzoneContainer,
|
|
26177
|
+
style: {
|
|
26178
|
+
top: top2,
|
|
26179
|
+
left: left2,
|
|
26180
|
+
width,
|
|
26181
|
+
height,
|
|
26182
|
+
zIndex: isDragging2 ? 0 : -1
|
|
26183
|
+
// Position dropzones behind chart when not needed
|
|
26184
|
+
},
|
|
26185
|
+
children: positions2.map((position) => /* @__PURE__ */ jsx(
|
|
26186
|
+
LegendDropZone,
|
|
26187
|
+
{
|
|
26188
|
+
position,
|
|
26189
|
+
onDrop: () => setLegendPosition(position),
|
|
26190
|
+
placeholderSize
|
|
26191
|
+
},
|
|
26192
|
+
position
|
|
26193
|
+
))
|
|
26194
|
+
}
|
|
26195
|
+
);
|
|
26144
26196
|
};
|
|
26145
|
-
const
|
|
26146
|
-
const
|
|
26147
|
-
|
|
26197
|
+
const Legend2 = ({ chartRef, legendConfig }) => {
|
|
26198
|
+
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
26199
|
+
const { chartArea } = chart2 ?? {};
|
|
26200
|
+
const {
|
|
26201
|
+
options: { legend: legend2 }
|
|
26202
|
+
} = legendConfig ?? {};
|
|
26203
|
+
const [measureRef] = useMeasure$1();
|
|
26204
|
+
const resizeRef = measureRef;
|
|
26205
|
+
const panelRef = useRef(null);
|
|
26206
|
+
const [legendPosition, setLegendPosition] = useState(
|
|
26207
|
+
(legend2 == null ? void 0 : legend2.position) || Position.BottomLeft
|
|
26208
|
+
);
|
|
26209
|
+
const panelRect = panelRef.current ? panelRef.current.getBoundingClientRect() : null;
|
|
26210
|
+
const panelSize = { width: panelRect == null ? void 0 : panelRect.width, height: panelRect == null ? void 0 : panelRect.height };
|
|
26211
|
+
const [{ isDragging: isDragging2 }, dragRef] = useDrag(() => ({
|
|
26212
|
+
type: "legend",
|
|
26213
|
+
collect: (monitor) => ({
|
|
26214
|
+
isDragging: monitor.isDragging()
|
|
26215
|
+
})
|
|
26216
|
+
}));
|
|
26217
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
26218
|
+
/* @__PURE__ */ jsx("div", { ref: resizeRef, className: styles$2.resizeContainer }),
|
|
26219
|
+
/* @__PURE__ */ jsx(
|
|
26220
|
+
LegendPanel,
|
|
26221
|
+
{
|
|
26222
|
+
chartRef,
|
|
26223
|
+
legendPosition,
|
|
26224
|
+
isDragging: isDragging2,
|
|
26225
|
+
ref: (r2) => {
|
|
26226
|
+
dragRef(r2);
|
|
26227
|
+
panelRef.current = r2;
|
|
26228
|
+
},
|
|
26229
|
+
legendConfig
|
|
26230
|
+
}
|
|
26231
|
+
),
|
|
26232
|
+
/* @__PURE__ */ jsx(
|
|
26233
|
+
LegendDropZones,
|
|
26234
|
+
{
|
|
26235
|
+
chartArea,
|
|
26236
|
+
setLegendPosition: (position) => setLegendPosition(position),
|
|
26237
|
+
isDragging: isDragging2,
|
|
26238
|
+
placeholderSize: panelSize
|
|
26239
|
+
}
|
|
26240
|
+
)
|
|
26241
|
+
] });
|
|
26148
26242
|
};
|
|
26149
26243
|
Chart$2.register(
|
|
26150
26244
|
LinearScale$1,
|
|
@@ -26253,11 +26347,11 @@ const LineChart = (props) => {
|
|
|
26253
26347
|
Legend2,
|
|
26254
26348
|
{
|
|
26255
26349
|
chartRef,
|
|
26256
|
-
|
|
26257
|
-
|
|
26258
|
-
|
|
26259
|
-
|
|
26260
|
-
|
|
26350
|
+
legendConfig: {
|
|
26351
|
+
options,
|
|
26352
|
+
generatedDatasets,
|
|
26353
|
+
chartType: ChartType.LINE
|
|
26354
|
+
}
|
|
26261
26355
|
}
|
|
26262
26356
|
)
|
|
26263
26357
|
] }) })
|
|
@@ -26271,6 +26365,10 @@ const LineChart = (props) => {
|
|
|
26271
26365
|
])
|
|
26272
26366
|
);
|
|
26273
26367
|
};
|
|
26368
|
+
const LineChartWithLegend = (props) => {
|
|
26369
|
+
const { options } = getDefaultProps$2(props);
|
|
26370
|
+
return /* @__PURE__ */ jsx(LegendProvider, { options, children: /* @__PURE__ */ jsx(LineChart, { ...props }) });
|
|
26371
|
+
};
|
|
26274
26372
|
const initializeLineChart = ({ languageKey = "en", ...options }) => {
|
|
26275
26373
|
setConfig(INIT_KEYS.LANGUAGE_KEY, languageKey);
|
|
26276
26374
|
Object.entries(options).forEach(([key, value]) => {
|
|
@@ -26364,7 +26462,8 @@ const usePieChartConfig = (chart2) => {
|
|
|
26364
26462
|
backgroundColor: [],
|
|
26365
26463
|
borderColor: [],
|
|
26366
26464
|
borderWidth: Number(copyDataset[0].borderWidth) || 1,
|
|
26367
|
-
data: []
|
|
26465
|
+
data: [],
|
|
26466
|
+
borderDash: []
|
|
26368
26467
|
};
|
|
26369
26468
|
data.labels.map((_label, labelIndex) => {
|
|
26370
26469
|
copyDataset.map((arc, arcIndex) => {
|
|
@@ -26597,6 +26696,10 @@ const PieChart = (props) => {
|
|
|
26597
26696
|
}
|
|
26598
26697
|
);
|
|
26599
26698
|
};
|
|
26699
|
+
const PieChartWithLegend = (props) => {
|
|
26700
|
+
const { options } = getDefaultProps$1(props);
|
|
26701
|
+
return /* @__PURE__ */ jsx(LegendProvider, { options, children: /* @__PURE__ */ jsx(PieChart, { ...props }) });
|
|
26702
|
+
};
|
|
26600
26703
|
/*!
|
|
26601
26704
|
* Chart.js v3.9.1
|
|
26602
26705
|
* https://www.chartjs.org
|
|
@@ -38957,17 +39060,11 @@ const Ht = { id: "dragdata", afterInit: function(t) {
|
|
|
38957
39060
|
return t.tooltip && t.tooltip.update(), false;
|
|
38958
39061
|
} };
|
|
38959
39062
|
Chart.register(Ht);
|
|
38960
|
-
const useBarChartConfig = ({
|
|
38961
|
-
chart: chart2,
|
|
38962
|
-
chartRef
|
|
38963
|
-
}) => {
|
|
39063
|
+
const useBarChartConfig = (chartRef, chart2) => {
|
|
38964
39064
|
var _a2;
|
|
38965
39065
|
const { options } = chart2;
|
|
38966
|
-
const {
|
|
39066
|
+
const { interactions } = options;
|
|
38967
39067
|
const [pointHover, setPointHover] = useState(false);
|
|
38968
|
-
const [visibleAnnotationsIndexes, setVisibleAnnotationsIndexes] = useState(
|
|
38969
|
-
setAnnotations(annotations.annotationsData)
|
|
38970
|
-
);
|
|
38971
39068
|
const generateBarChartDatasets = ({
|
|
38972
39069
|
datasets,
|
|
38973
39070
|
options: options2
|
|
@@ -38975,22 +39072,18 @@ const useBarChartConfig = ({
|
|
|
38975
39072
|
const {
|
|
38976
39073
|
annotations: { controlAnnotation, showAnnotations, annotationsData } = {}
|
|
38977
39074
|
} = options2;
|
|
38978
|
-
const
|
|
38979
|
-
|
|
38980
|
-
|
|
38981
|
-
|
|
38982
|
-
|
|
38983
|
-
|
|
38984
|
-
|
|
38985
|
-
|
|
38986
|
-
|
|
38987
|
-
|
|
38988
|
-
|
|
38989
|
-
|
|
38990
|
-
});
|
|
38991
|
-
}
|
|
38992
|
-
);
|
|
38993
|
-
}
|
|
39075
|
+
const annotationsDatasets = controlAnnotation && showAnnotations && (annotationsData == null ? void 0 : annotationsData.length) ? annotationsData.map(
|
|
39076
|
+
(annotation2, index2) => ({
|
|
39077
|
+
isAnnotation: true,
|
|
39078
|
+
label: annotation2.label,
|
|
39079
|
+
annotationIndex: index2,
|
|
39080
|
+
backgroundColor: annotation2.color || COLORS[index2],
|
|
39081
|
+
borderColor: annotation2.color || COLORS[index2],
|
|
39082
|
+
data: [],
|
|
39083
|
+
type: ChartType$1.Bar
|
|
39084
|
+
})
|
|
39085
|
+
) : [];
|
|
39086
|
+
const barDatasetsCopy = [...datasets, ...annotationsDatasets];
|
|
38994
39087
|
const generatedDatasets2 = barDatasetsCopy.map((barDataset, index2) => {
|
|
38995
39088
|
const colorSchema = COLORS;
|
|
38996
39089
|
const colors2 = barDataset.data.map((_2, i2) => {
|
|
@@ -38998,9 +39091,12 @@ const useBarChartConfig = ({
|
|
|
38998
39091
|
return colorSchema[colorSelectionIndex] || generateRandomColor(COLORS);
|
|
38999
39092
|
});
|
|
39000
39093
|
const backgroundColors = barDataset.backgroundColor || colors2.map((color2) => color2 + ALPHA_CHANEL);
|
|
39094
|
+
const datasetWithBorderWidth = "borderWidth" in barDatasetsCopy ? {
|
|
39095
|
+
borderWidth: parseFloat(String(barDatasetsCopy.borderWidth)) ?? 1
|
|
39096
|
+
} : {};
|
|
39001
39097
|
return {
|
|
39002
39098
|
...barDataset,
|
|
39003
|
-
|
|
39099
|
+
...datasetWithBorderWidth,
|
|
39004
39100
|
borderColor: barDataset.borderColor || colors2[index2],
|
|
39005
39101
|
backgroundColor: backgroundColors
|
|
39006
39102
|
};
|
|
@@ -39011,44 +39107,6 @@ const useBarChartConfig = ({
|
|
|
39011
39107
|
datasets: (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets,
|
|
39012
39108
|
options
|
|
39013
39109
|
});
|
|
39014
|
-
const legendClick = (_e2, legendItem2) => {
|
|
39015
|
-
const index2 = (legendItem2 == null ? void 0 : legendItem2.datasetIndex) ?? null;
|
|
39016
|
-
const chartInstance = chartRef.current;
|
|
39017
|
-
if (chartInstance && index2 !== null) {
|
|
39018
|
-
const { datasets } = chartInstance.data;
|
|
39019
|
-
const dataset = datasets[index2];
|
|
39020
|
-
const meta = chartInstance.getDatasetMeta(index2);
|
|
39021
|
-
meta.hidden = meta.hidden === null ? !dataset.hidden : null;
|
|
39022
|
-
if (annotations.controlAnnotation && dataset.isAnnotation) {
|
|
39023
|
-
const { annotationIndex } = dataset;
|
|
39024
|
-
if (visibleAnnotationsIndexes.includes(annotationIndex)) {
|
|
39025
|
-
setVisibleAnnotationsIndexes(
|
|
39026
|
-
visibleAnnotationsIndexes.filter((ann) => ann !== annotationIndex)
|
|
39027
|
-
);
|
|
39028
|
-
} else {
|
|
39029
|
-
setVisibleAnnotationsIndexes([
|
|
39030
|
-
...visibleAnnotationsIndexes,
|
|
39031
|
-
annotationIndex
|
|
39032
|
-
]);
|
|
39033
|
-
}
|
|
39034
|
-
}
|
|
39035
|
-
if (dataset.displayGroup) {
|
|
39036
|
-
datasets.forEach((ds, ix) => {
|
|
39037
|
-
if (ds.displayGroup !== dataset.displayGroup) {
|
|
39038
|
-
return;
|
|
39039
|
-
}
|
|
39040
|
-
chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
|
|
39041
|
-
});
|
|
39042
|
-
}
|
|
39043
|
-
if (interactions.onLegendClick) {
|
|
39044
|
-
interactions.onLegendClick(
|
|
39045
|
-
legendItem2 == null ? void 0 : legendItem2.text,
|
|
39046
|
-
(legendItem2 == null ? void 0 : legendItem2.hidden) ?? false
|
|
39047
|
-
);
|
|
39048
|
-
}
|
|
39049
|
-
chartInstance.update();
|
|
39050
|
-
}
|
|
39051
|
-
};
|
|
39052
39110
|
const onClick = (_evt, _elements, chartInstance) => {
|
|
39053
39111
|
chartInstance.resetZoom();
|
|
39054
39112
|
};
|
|
@@ -39068,13 +39126,14 @@ const useBarChartConfig = ({
|
|
|
39068
39126
|
}
|
|
39069
39127
|
}
|
|
39070
39128
|
};
|
|
39071
|
-
return
|
|
39072
|
-
|
|
39073
|
-
|
|
39074
|
-
|
|
39075
|
-
|
|
39076
|
-
|
|
39077
|
-
|
|
39129
|
+
return useMemo(
|
|
39130
|
+
() => ({
|
|
39131
|
+
generatedDatasets,
|
|
39132
|
+
onClick,
|
|
39133
|
+
onHover
|
|
39134
|
+
}),
|
|
39135
|
+
[chartRef, chart2]
|
|
39136
|
+
);
|
|
39078
39137
|
};
|
|
39079
39138
|
const getBarChartAxis = ({
|
|
39080
39139
|
chart: chart2,
|
|
@@ -39292,10 +39351,12 @@ const useBarChartOptions = ({
|
|
|
39292
39351
|
chart: chart2,
|
|
39293
39352
|
chartRef
|
|
39294
39353
|
}) => {
|
|
39295
|
-
var _a2, _b2, _c2, _d2;
|
|
39296
39354
|
const { options } = chart2;
|
|
39297
39355
|
const { chartStyling, dragData } = options;
|
|
39298
|
-
const {
|
|
39356
|
+
const { state: legendState } = useLegend();
|
|
39357
|
+
const { annotation: annotation2 } = legendState;
|
|
39358
|
+
const { onClick, onHover } = useBarChartConfig(chartRef, chart2);
|
|
39359
|
+
const { legend: legend2, customLegendPlugin } = useLegendState({ chartRef, options });
|
|
39299
39360
|
return {
|
|
39300
39361
|
onClick,
|
|
39301
39362
|
onHover,
|
|
@@ -39312,14 +39373,11 @@ const useBarChartOptions = ({
|
|
|
39312
39373
|
plugins: {
|
|
39313
39374
|
title: getTitle(options),
|
|
39314
39375
|
datalabels: getBarChartDataLabels(options),
|
|
39315
|
-
annotation:
|
|
39316
|
-
showAnnotationLineIndex: visibleAnnotationsIndexes
|
|
39317
|
-
}),
|
|
39376
|
+
annotation: toAnnotationObject(annotation2),
|
|
39318
39377
|
tooltip: getBarChartToolTips(options),
|
|
39319
|
-
legend:
|
|
39320
|
-
|
|
39321
|
-
|
|
39322
|
-
},
|
|
39378
|
+
legend: { ...legend2, display: false },
|
|
39379
|
+
// hide default legend
|
|
39380
|
+
customLegendPlugin,
|
|
39323
39381
|
chartAreaBorder: {
|
|
39324
39382
|
borderColor: BORDER_COLOR
|
|
39325
39383
|
},
|
|
@@ -39327,21 +39385,25 @@ const useBarChartOptions = ({
|
|
|
39327
39385
|
}
|
|
39328
39386
|
};
|
|
39329
39387
|
};
|
|
39330
|
-
const chart = "
|
|
39331
|
-
const
|
|
39332
|
-
const
|
|
39333
|
-
const
|
|
39334
|
-
const
|
|
39335
|
-
const
|
|
39336
|
-
const
|
|
39388
|
+
const chart = "_chart_x1sru_1";
|
|
39389
|
+
const canvas = "_canvas_x1sru_10";
|
|
39390
|
+
const fixedHeight = "_fixedHeight_x1sru_19";
|
|
39391
|
+
const stretchHeight = "_stretchHeight_x1sru_25";
|
|
39392
|
+
const zoomForm = "_zoomForm_x1sru_38";
|
|
39393
|
+
const zoomReset = "_zoomReset_x1sru_46";
|
|
39394
|
+
const help = "_help_x1sru_49";
|
|
39395
|
+
const autoWeight = "_autoWeight_x1sru_53";
|
|
39396
|
+
const actions = "_actions_x1sru_57";
|
|
39337
39397
|
const styles = {
|
|
39338
39398
|
chart,
|
|
39399
|
+
canvas,
|
|
39339
39400
|
fixedHeight,
|
|
39340
39401
|
stretchHeight,
|
|
39341
39402
|
zoomForm,
|
|
39342
39403
|
zoomReset,
|
|
39343
39404
|
help,
|
|
39344
|
-
autoWeight
|
|
39405
|
+
autoWeight,
|
|
39406
|
+
actions
|
|
39345
39407
|
};
|
|
39346
39408
|
const defaultAxes = (axes) => ({
|
|
39347
39409
|
x: (axes == null ? void 0 : axes.x) || [{}],
|
|
@@ -39380,7 +39442,7 @@ const defaultAnnotations = (annotations) => ({
|
|
|
39380
39442
|
});
|
|
39381
39443
|
const defaultLegend = (legend2) => ({
|
|
39382
39444
|
display: (legend2 == null ? void 0 : legend2.display) ?? true,
|
|
39383
|
-
position: (legend2 == null ? void 0 : legend2.position) || Position.
|
|
39445
|
+
position: (legend2 == null ? void 0 : legend2.position) || Position.TopLeft,
|
|
39384
39446
|
align: (legend2 == null ? void 0 : legend2.align) || AlignOptions.Center,
|
|
39385
39447
|
customLegend: (legend2 == null ? void 0 : legend2.customLegend) || {
|
|
39386
39448
|
customLegendPlugin: null,
|
|
@@ -39445,15 +39507,17 @@ Chart$2.register(
|
|
|
39445
39507
|
Ht
|
|
39446
39508
|
);
|
|
39447
39509
|
const BarChart = (props) => {
|
|
39448
|
-
var _a2, _b2;
|
|
39510
|
+
var _a2, _b2, _c2, _d2;
|
|
39449
39511
|
setDefaultTheme();
|
|
39450
39512
|
const chartRef = useRef(null);
|
|
39451
39513
|
const chart2 = getDefaultProps(props);
|
|
39514
|
+
const { translations, languageKey } = getConfig();
|
|
39452
39515
|
const { options, testId } = chart2;
|
|
39453
39516
|
const { chartStyling, graph } = options;
|
|
39454
|
-
const { generatedDatasets } = useBarChartConfig(
|
|
39517
|
+
const { generatedDatasets } = useBarChartConfig(chartRef, chart2);
|
|
39455
39518
|
const barChartOptions = useBarChartOptions({ chart: chart2, chartRef });
|
|
39456
|
-
|
|
39519
|
+
const showCustomLegend = !((_b2 = (_a2 = options == null ? void 0 : options.legend) == null ? void 0 : _a2.customLegend) == null ? void 0 : _b2.customLegendContainerID);
|
|
39520
|
+
return /* @__PURE__ */ jsxs(
|
|
39457
39521
|
"div",
|
|
39458
39522
|
{
|
|
39459
39523
|
className: getClassName(chartStyling, styles),
|
|
@@ -39462,25 +39526,56 @@ const BarChart = (props) => {
|
|
|
39462
39526
|
height: chartStyling.height || AUTO
|
|
39463
39527
|
},
|
|
39464
39528
|
"data-testid": testId,
|
|
39465
|
-
children:
|
|
39466
|
-
|
|
39467
|
-
|
|
39468
|
-
|
|
39469
|
-
|
|
39470
|
-
|
|
39471
|
-
|
|
39472
|
-
|
|
39473
|
-
|
|
39474
|
-
|
|
39475
|
-
|
|
39476
|
-
|
|
39477
|
-
|
|
39529
|
+
children: [
|
|
39530
|
+
/* @__PURE__ */ jsx("div", { className: styles.actions, children: /* @__PURE__ */ jsx(Tooltip$2, { text: translations.downloadAsPNG, placement: "bottom-end", children: /* @__PURE__ */ jsx(
|
|
39531
|
+
Button,
|
|
39532
|
+
{
|
|
39533
|
+
small: true,
|
|
39534
|
+
basic: true,
|
|
39535
|
+
colored: "muted",
|
|
39536
|
+
round: true,
|
|
39537
|
+
icon: "download",
|
|
39538
|
+
onClick: () => downloadPgn(chartRef)
|
|
39539
|
+
}
|
|
39540
|
+
) }) }),
|
|
39541
|
+
/* @__PURE__ */ jsx(DndProvider, { backend: HTML5Backend, context: window, children: /* @__PURE__ */ jsxs("div", { className: styles.canvas, id: "canvas", children: [
|
|
39542
|
+
/* @__PURE__ */ jsx(
|
|
39543
|
+
Bar,
|
|
39544
|
+
{
|
|
39545
|
+
ref: chartRef,
|
|
39546
|
+
data: {
|
|
39547
|
+
labels: ((_d2 = (_c2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _c2.labels) == null ? void 0 : _d2.length) ? chart2.data.labels : [""],
|
|
39548
|
+
datasets: generatedDatasets
|
|
39549
|
+
},
|
|
39550
|
+
options: barChartOptions,
|
|
39551
|
+
plugins: getPlugins(graph, options.legend)
|
|
39552
|
+
}
|
|
39553
|
+
),
|
|
39554
|
+
showCustomLegend && !!generatedDatasets.length && /* @__PURE__ */ jsx(
|
|
39555
|
+
Legend2,
|
|
39556
|
+
{
|
|
39557
|
+
chartRef,
|
|
39558
|
+
legendConfig: {
|
|
39559
|
+
options,
|
|
39560
|
+
generatedDatasets,
|
|
39561
|
+
chartType: ChartType.BAR
|
|
39562
|
+
}
|
|
39563
|
+
}
|
|
39564
|
+
)
|
|
39565
|
+
] }) })
|
|
39566
|
+
]
|
|
39567
|
+
},
|
|
39568
|
+
languageKey
|
|
39478
39569
|
);
|
|
39479
39570
|
};
|
|
39571
|
+
const BarChartWithLegend = (props) => {
|
|
39572
|
+
const { options } = getDefaultProps(props);
|
|
39573
|
+
return /* @__PURE__ */ jsx(LegendProvider, { options, children: /* @__PURE__ */ jsx(BarChart, { ...props }) });
|
|
39574
|
+
};
|
|
39480
39575
|
export {
|
|
39481
|
-
BarChart,
|
|
39482
|
-
LineChart,
|
|
39483
|
-
PieChart,
|
|
39576
|
+
BarChartWithLegend as BarChart,
|
|
39577
|
+
LineChartWithLegend as LineChart,
|
|
39578
|
+
PieChartWithLegend as PieChart,
|
|
39484
39579
|
initializeLineChart
|
|
39485
39580
|
};
|
|
39486
39581
|
//# sourceMappingURL=index.js.map
|
|
@@ -39489,7 +39584,7 @@ export {
|
|
|
39489
39584
|
try {
|
|
39490
39585
|
if (typeof document != "undefined") {
|
|
39491
39586
|
var elementStyle = document.createElement("style");
|
|
39492
|
-
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_gbo9q_1 {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--padding-xs);\n}\n._buttons_gbo9q_7 {\n display: flex;\n align-items: flex-start;\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'] .
|
|
39587
|
+
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_gbo9q_1 {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--padding-xs);\n}\n._buttons_gbo9q_7 {\n display: flex;\n align-items: flex-start;\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}"));
|
|
39493
39588
|
document.head.appendChild(elementStyle);
|
|
39494
39589
|
}
|
|
39495
39590
|
} catch (e) {
|