@oliasoft-open-source/charts-library 3.8.0-beta-4 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +568 -569
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +2 -73
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +36 -10
- package/dist/src/components/bar-chart/{get-bar-chart-data-labels.d.ts → utils/get-bar-chart-data-labels.d.ts} +1 -4
- package/dist/src/components/bar-chart/utils/get-bar-chart-scales.d.ts +3 -0
- package/dist/src/components/bar-chart/{get-bar-chart-tooltips.d.ts → utils/get-bar-chart-tooltips.d.ts} +1 -1
- package/dist/src/components/bar-chart/utils/use-bar-chart-config.d.ts +24 -0
- package/dist/src/components/common/common.interface.d.ts +7 -3
- package/dist/src/components/common/helpers/chart-border-plugin.d.ts +10 -2
- package/dist/src/components/common/helpers/chart-consts.d.ts +3 -3
- package/dist/src/components/common/helpers/chart-utils.d.ts +10 -12
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +0 -5
- package/dist/src/components/common/helpers/get-draggableData.d.ts +13 -13
- package/dist/src/components/common/helpers/range/estimate-data-series-have-close-values.d.ts +2 -4
- package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +3 -1
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +3 -3
- package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +11 -15
- package/dist/src/components/line-chart/hooks/use-chart-state.d.ts +0 -7
- package/dist/src/components/line-chart/hooks/use-generated-labels.d.ts +4 -1
- package/dist/src/components/line-chart/hooks/use-legend-state.d.ts +6 -5
- package/dist/src/components/line-chart/legend/legend-interface.d.ts +2 -2
- package/dist/src/components/line-chart/line-chart.interface.d.ts +41 -6
- package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +2 -1
- package/dist/src/components/line-chart/utils/axis-scales/axis-scales.d.ts +5 -4
- package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.d.ts +2 -5
- package/dist/src/components/line-chart/utils/datalabels-alignment/datalabels-alignment.interface.d.ts +20 -0
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.d.ts +3 -4
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.d.ts +9 -9
- package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +4 -4
- package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +4 -8
- package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +6 -10
- package/dist/src/components/line-chart/utils/get-generated-labels.d.ts +2 -1
- package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +3 -2
- package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +1 -6
- package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +3 -5
- package/dist/src/components/line-chart/utils/line-chart-utils.d.ts +2 -9
- package/dist/src/components/pie-chart/pie-chart-defalut-props.interface.d.ts +53 -0
- package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +2 -42
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +10 -2
- package/dist/src/components/pie-chart/use-pie-chart-config.d.ts +41 -0
- package/package.json +2 -2
- package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +0 -5
- package/dist/src/components/line-chart/controls/legend-options.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -22334,9 +22334,9 @@ const BORDER_WIDTH = {
|
|
|
22334
22334
|
};
|
|
22335
22335
|
const BORDER_COLOR = "rgba(0,0,0,0.1)";
|
|
22336
22336
|
const ANNOTATION_DASH = [10, 2];
|
|
22337
|
-
const DEFAULT_FONT_SIZE =
|
|
22338
|
-
const DEFAULT_FONT_FAMILY = '"
|
|
22339
|
-
const DEFAULT_COLOR = "
|
|
22337
|
+
const DEFAULT_FONT_SIZE = 13;
|
|
22338
|
+
const DEFAULT_FONT_FAMILY = '"Lato", sans-serif';
|
|
22339
|
+
const DEFAULT_COLOR = "rgba(0,0,0,.87)";
|
|
22340
22340
|
const LEGEND_LABEL_BOX_SIZE = 12;
|
|
22341
22341
|
const TOOLTIP_PADDING = 8;
|
|
22342
22342
|
const TOOLTIP_BOX_PADDING = 4;
|
|
@@ -22377,7 +22377,7 @@ const DECIMAL_POINT_TOLERANCE = 9;
|
|
|
22377
22377
|
const MAX_DECIMAL_DIFF = 1 / 10 ** DECIMAL_POINT_TOLERANCE;
|
|
22378
22378
|
const chartAreaBorderPlugin = {
|
|
22379
22379
|
id: "chartAreaBorder",
|
|
22380
|
-
beforeDraw(chart2,
|
|
22380
|
+
beforeDraw(chart2, _2, options) {
|
|
22381
22381
|
const {
|
|
22382
22382
|
ctx,
|
|
22383
22383
|
chartArea: { left: left2, top: top2, width, height }
|
|
@@ -22386,7 +22386,7 @@ const chartAreaBorderPlugin = {
|
|
|
22386
22386
|
ctx.strokeStyle = options.borderColor;
|
|
22387
22387
|
ctx.lineWidth = options.borderWidth;
|
|
22388
22388
|
ctx.setLineDash(options.borderDash || []);
|
|
22389
|
-
ctx.lineDashOffset = options.borderDashOffset;
|
|
22389
|
+
ctx.lineDashOffset = options.borderDashOffset ?? 0;
|
|
22390
22390
|
ctx.strokeRect(left2, top2, width, height);
|
|
22391
22391
|
ctx.restore();
|
|
22392
22392
|
}
|
|
@@ -22419,7 +22419,7 @@ const generateRandomColor = (colors2) => {
|
|
|
22419
22419
|
}
|
|
22420
22420
|
};
|
|
22421
22421
|
const setAnnotations = (annotationsData) => {
|
|
22422
|
-
return (annotationsData == null ? void 0 : annotationsData.length) ? annotationsData.map((
|
|
22422
|
+
return (annotationsData == null ? void 0 : annotationsData.length) ? annotationsData.map((_2, i2) => i2) : [];
|
|
22423
22423
|
};
|
|
22424
22424
|
const getTitle = (options) => {
|
|
22425
22425
|
return options.title !== "" ? {
|
|
@@ -22453,6 +22453,12 @@ const getClassName = (chartStyling, styles2) => {
|
|
|
22453
22453
|
const getLegend = (options, clickHandler) => {
|
|
22454
22454
|
const { legend: legend2 } = options || {};
|
|
22455
22455
|
return {
|
|
22456
|
+
// Using 'as any' here to bypass a TypeScript type-checking issue.
|
|
22457
|
+
// There is a conflict between our custom interface and the Chart.js interface
|
|
22458
|
+
// for the 'plugins.legend.position' property. In our current setup, this property
|
|
22459
|
+
// is typed as a string, which conflicts with the more specific string literals
|
|
22460
|
+
// expected by Chart.js ('top', 'center', 'bottom', 'left', 'right', 'chartArea').
|
|
22461
|
+
// As a temporary workaround, 'as any' is used to avoid this type conflict.
|
|
22456
22462
|
position: (legend2 == null ? void 0 : legend2.position) || Position.Top,
|
|
22457
22463
|
display: legend2 == null ? void 0 : legend2.display,
|
|
22458
22464
|
align: legend2 == null ? void 0 : legend2.align,
|
|
@@ -22469,8 +22475,8 @@ const afterLabelCallback = (tooltipItem) => {
|
|
|
22469
22475
|
return error ? `Error: ${round$2(error, 4)}` : "";
|
|
22470
22476
|
};
|
|
22471
22477
|
const getTooltipLabel = (tooltipItem, showLabelsInTooltips) => {
|
|
22472
|
-
var _a2;
|
|
22473
|
-
const datasetDataLabel = (_a2 = tooltipItem.dataset.data[tooltipItem.dataIndex]) == null ? void 0 :
|
|
22478
|
+
var _a2, _b2, _c2;
|
|
22479
|
+
const datasetDataLabel = (_c2 = (_b2 = (_a2 = tooltipItem == null ? void 0 : tooltipItem.dataset) == null ? void 0 : _a2.data) == null ? void 0 : _b2[tooltipItem == null ? void 0 : tooltipItem.dataIndex]) == null ? void 0 : _c2.label;
|
|
22474
22480
|
const dataLabel = Array.isArray(datasetDataLabel) ? datasetDataLabel.join(" , ") : datasetDataLabel;
|
|
22475
22481
|
return showLabelsInTooltips && (dataLabel == null ? void 0 : dataLabel.length) ? ` (${dataLabel})` : "";
|
|
22476
22482
|
};
|
|
@@ -22585,22 +22591,20 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22585
22591
|
return [];
|
|
22586
22592
|
}
|
|
22587
22593
|
if (((_a2 = axes[axisType]) == null ? void 0 : _a2.length) > 1) {
|
|
22588
|
-
return axes[axisType].map(
|
|
22589
|
-
|
|
22590
|
-
|
|
22591
|
-
|
|
22592
|
-
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
}
|
|
22603
|
-
);
|
|
22594
|
+
return axes[axisType].map((axisObj, index2) => {
|
|
22595
|
+
var _a3, _b3;
|
|
22596
|
+
const id = generateAxisId(axisType, index2, axes[axisType].length > 1);
|
|
22597
|
+
const customMin = (_a3 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _a3.min;
|
|
22598
|
+
const customMax = (_b3 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _b3.max;
|
|
22599
|
+
const { unit } = axisObj;
|
|
22600
|
+
return {
|
|
22601
|
+
id,
|
|
22602
|
+
//only add custom axis ranges if defined:
|
|
22603
|
+
...customMin ? { min: customMin } : {},
|
|
22604
|
+
...customMax ? { max: customMax } : {},
|
|
22605
|
+
...unit ? { unit } : {}
|
|
22606
|
+
};
|
|
22607
|
+
});
|
|
22604
22608
|
} else {
|
|
22605
22609
|
const id = generateAxisId(axisType);
|
|
22606
22610
|
const customMin = (_b2 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _b2.min;
|
|
@@ -22641,56 +22645,6 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22641
22645
|
initialAxesRanges: []
|
|
22642
22646
|
};
|
|
22643
22647
|
};
|
|
22644
|
-
const lineOnlyIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJjdXJyZW50Q29sb3IiIGhlaWdodD0iMWVtIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxZW0iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0ibTAgMGgxMnYxMmgtMTJ6Ii8+PC9jbGlwUGF0aD48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxwYXRoIGQ9Im0uNSA2LjV2LTFoMTF2MWMtNC4xNjEwNCAwLTYuNjM1NDkgMC0xMSAweiIvPjwvZz48L3N2Zz4=";
|
|
22645
|
-
const pointOnlyIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJjdXJyZW50Q29sb3IiIGhlaWdodD0iMWVtIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxZW0iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iNiIgY3k9IjYiIHI9IjIiLz48L3N2Zz4=";
|
|
22646
|
-
const lineAndPointIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJjdXJyZW50Q29sb3IiIGhlaWdodD0iMWVtIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxZW0iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0ibTAgMGgxMnYxMmgtMTJ6Ii8+PC9jbGlwUGF0aD48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxwYXRoIGQ9Im03LjkzNyA2LjVjLS4xMTEyMi40MjkxMi0uMzYxNzkuODA5MTYtLjcxMjM3IDEuMDgwNDctLjM1MDU4LjI3MTMtLjc4MTMzLjQxODUtMS4yMjQ2My40MTg1cy0uODc0MDUtLjE0NzItMS4yMjQ2My0uNDE4NWMtLjM1MDU4LS4yNzEzMS0uNjAxMTUtLjY1MTM1LS43MTIzNy0xLjA4MDQ3aC0zLjU2M3YtMWgzLjU2M2MuMTExMjItLjQyOTEyLjM2MTc5LS44MDkxNi43MTIzNy0xLjA4MDQ2cy43ODEzMy0uNDE4NTEgMS4yMjQ2My0uNDE4NTEuODc0MDUuMTQ3MjEgMS4yMjQ2My40MTg1MS42MDExNS42NTEzNC43MTIzNyAxLjA4MDQ2aDMuNTYzdjF6Ii8+PC9nPjwvc3ZnPg==";
|
|
22647
|
-
const LineOptions = ({
|
|
22648
|
-
lineEnabled,
|
|
22649
|
-
onToggleLine,
|
|
22650
|
-
onTogglePoints,
|
|
22651
|
-
pointsEnabled,
|
|
22652
|
-
translations
|
|
22653
|
-
}) => {
|
|
22654
|
-
const options = [
|
|
22655
|
-
{
|
|
22656
|
-
label: translations.pointsLines,
|
|
22657
|
-
icon: /* @__PURE__ */ jsx(Icon, { icon: lineAndPointIcon }),
|
|
22658
|
-
selected: pointsEnabled && lineEnabled,
|
|
22659
|
-
onClick: () => {
|
|
22660
|
-
onTogglePoints();
|
|
22661
|
-
}
|
|
22662
|
-
},
|
|
22663
|
-
{
|
|
22664
|
-
label: translations.linesOnly,
|
|
22665
|
-
icon: /* @__PURE__ */ jsx(Icon, { icon: lineOnlyIcon }),
|
|
22666
|
-
selected: !pointsEnabled && lineEnabled,
|
|
22667
|
-
onClick: () => {
|
|
22668
|
-
onTogglePoints();
|
|
22669
|
-
onToggleLine();
|
|
22670
|
-
}
|
|
22671
|
-
},
|
|
22672
|
-
{
|
|
22673
|
-
label: translations.pointsOnly,
|
|
22674
|
-
icon: /* @__PURE__ */ jsx(Icon, { icon: pointOnlyIcon }),
|
|
22675
|
-
selected: pointsEnabled && !lineEnabled,
|
|
22676
|
-
onClick: () => {
|
|
22677
|
-
onToggleLine();
|
|
22678
|
-
}
|
|
22679
|
-
}
|
|
22680
|
-
];
|
|
22681
|
-
const selectedOption = options.find((option) => option.selected);
|
|
22682
|
-
return /* @__PURE__ */ jsx(Tooltip$2, { text: selectedOption == null ? void 0 : selectedOption.label, placement: "bottom", children: /* @__PURE__ */ jsx(
|
|
22683
|
-
Button,
|
|
22684
|
-
{
|
|
22685
|
-
small: true,
|
|
22686
|
-
basic: true,
|
|
22687
|
-
colored: "muted",
|
|
22688
|
-
round: true,
|
|
22689
|
-
icon: selectedOption == null ? void 0 : selectedOption.icon,
|
|
22690
|
-
onClick: selectedOption == null ? void 0 : selectedOption.onClick
|
|
22691
|
-
}
|
|
22692
|
-
) });
|
|
22693
|
-
};
|
|
22694
22648
|
var DefaultContext = {
|
|
22695
22649
|
color: void 0,
|
|
22696
22650
|
size: void 0,
|
|
@@ -22764,27 +22718,86 @@ function IconBase(props) {
|
|
|
22764
22718
|
return elem(conf);
|
|
22765
22719
|
}) : elem(DefaultContext);
|
|
22766
22720
|
}
|
|
22767
|
-
function
|
|
22768
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24"
|
|
22721
|
+
function RiDragMove2Line(props) {
|
|
22722
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M11 11V5.82843L9.17157 7.65685L7.75736 6.24264L12 2L16.2426 6.24264L14.8284 7.65685L13 5.82843V11H18.1716L16.3431 9.17157L17.7574 7.75736L22 12L17.7574 16.2426L16.3431 14.8284L18.1716 13H13V18.1716L14.8284 16.3431L16.2426 17.7574L12 22L7.75736 17.7574L9.17157 16.3431L11 18.1716V13H5.82843L7.65685 14.8284L6.24264 16.2426L2 12L6.24264 7.75736L7.65685 9.17157L5.82843 11H11Z" } }] })(props);
|
|
22723
|
+
}
|
|
22724
|
+
function RiLineChartLine(props) {
|
|
22725
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M5 3V19H21V21H3V3H5ZM20.2929 6.29289L21.7071 7.70711L16 13.4142L13 10.415L8.70711 14.7071L7.29289 13.2929L13 7.58579L16 10.585L20.2929 6.29289Z" } }] })(props);
|
|
22726
|
+
}
|
|
22727
|
+
function RiRuler2Line(props) {
|
|
22728
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M17 19H19V14H10V5H5V7H7V9H5V11H8V13H5V15H7V17H5V19H7V17H9V19H11V16H13V19H15V17H17V19ZM12 12H20C20.5523 12 21 12.4477 21 13V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H11C11.5523 3 12 3.44772 12 4V12Z" } }] })(props);
|
|
22769
22729
|
}
|
|
22770
|
-
function
|
|
22771
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24"
|
|
22730
|
+
function RiTableLine(props) {
|
|
22731
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M4 8H20V5H4V8ZM14 19V10H10V19H14ZM16 19H20V10H16V19ZM8 19V10H4V19H8ZM3 3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4C2 3.44772 2.44772 3 3 3Z" } }] })(props);
|
|
22772
22732
|
}
|
|
22733
|
+
function RiFileDownloadLine(props) {
|
|
22734
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M13 12H16L12 16L8 12H11V8H13V12ZM15 4H5V20H19V8H15V4ZM3 2.9918C3 2.44405 3.44749 2 3.9985 2H16L20.9997 7L21 20.9925C21 21.5489 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5447 3 21.0082V2.9918Z" } }] })(props);
|
|
22735
|
+
}
|
|
22736
|
+
function RiForbidLine(props) {
|
|
22737
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8.52313 7.10891L16.8911 15.4769C16.6997 15.7454 16.4836 16.0017 16.2426 16.2426C16.0017 16.4836 15.7454 16.6997 15.4769 16.8911L7.10891 8.52313C7.30029 8.25459 7.51644 7.99828 7.75736 7.75736C7.99828 7.51644 8.25459 7.30029 8.52313 7.10891Z" } }] })(props);
|
|
22738
|
+
}
|
|
22739
|
+
function RiZoomInLine(props) {
|
|
22740
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M18.031 16.6168L22.3137 20.8995L20.8995 22.3137L16.6168 18.031C15.0769 19.263 13.124 20 11 20C6.032 20 2 15.968 2 11C2 6.032 6.032 2 11 2C15.968 2 20 6.032 20 11C20 13.124 19.263 15.0769 18.031 16.6168ZM16.0247 15.8748C17.2475 14.6146 18 12.8956 18 11C18 7.1325 14.8675 4 11 4C7.1325 4 4 7.1325 4 11C4 14.8675 7.1325 18 11 18C12.8956 18 14.6146 17.2475 15.8748 16.0247L16.0247 15.8748ZM10 10V7H12V10H15V12H12V15H10V12H7V10H10Z" } }] })(props);
|
|
22741
|
+
}
|
|
22742
|
+
const lineOnlyIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjEyIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGNsaXBQYXRoIGlkPSJhIj48cGF0aCBkPSJtMCAwaDEydjEyaC0xMnoiLz48L2NsaXBQYXRoPjxnIGNsaXAtcGF0aD0idXJsKCNhKSI+PHBhdGggZD0ibS41IDYuNXYtMWgxMXYxYy00LjE2MTA0IDAtNi42MzU0OSAwLTExIDB6IiBmaWxsPSJjdXJyZW50Q29sb3IiLz48L2c+PC9zdmc+";
|
|
22743
|
+
const pointOnlyIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjEyIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSI2IiBjeT0iNiIgZmlsbD0iY3VycmVudENvbG9yIiByPSIyIi8+PC9zdmc+";
|
|
22744
|
+
const lineAndPointIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjEyIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGNsaXBQYXRoIGlkPSJhIj48cGF0aCBkPSJtMCAwaDEydjEyaC0xMnoiLz48L2NsaXBQYXRoPjxnIGNsaXAtcGF0aD0idXJsKCNhKSI+PHBhdGggZD0ibTcuOTM3IDYuNWMtLjExMTIyLjQyOTEyLS4zNjE3OS44MDkxNi0uNzEyMzcgMS4wODA0Ny0uMzUwNTguMjcxMy0uNzgxMzMuNDE4NS0xLjIyNDYzLjQxODVzLS44NzQwNS0uMTQ3Mi0xLjIyNDYzLS40MTg1Yy0uMzUwNTgtLjI3MTMxLS42MDExNS0uNjUxMzUtLjcxMjM3LTEuMDgwNDdoLTMuNTYzdi0xaDMuNTYzYy4xMTEyMi0uNDI5MTIuMzYxNzktLjgwOTE2LjcxMjM3LTEuMDgwNDZzLjc4MTMzLS40MTg1MSAxLjIyNDYzLS40MTg1MS44NzQwNS4xNDcyMSAxLjIyNDYzLjQxODUxLjYwMTE1LjY1MTM0LjcxMjM3IDEuMDgwNDZoMy41NjN2MXoiIGZpbGw9ImN1cnJlbnRDb2xvciIvPjwvZz48L3N2Zz4=";
|
|
22745
|
+
const LineOptions = ({
|
|
22746
|
+
lineEnabled,
|
|
22747
|
+
onToggleLine,
|
|
22748
|
+
onTogglePoints,
|
|
22749
|
+
pointsEnabled,
|
|
22750
|
+
translations
|
|
22751
|
+
}) => {
|
|
22752
|
+
const options = [
|
|
22753
|
+
{
|
|
22754
|
+
label: translations.pointsLines,
|
|
22755
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: lineAndPointIcon }),
|
|
22756
|
+
selected: pointsEnabled && lineEnabled,
|
|
22757
|
+
onClick: () => {
|
|
22758
|
+
onTogglePoints();
|
|
22759
|
+
}
|
|
22760
|
+
},
|
|
22761
|
+
{
|
|
22762
|
+
label: translations.linesOnly,
|
|
22763
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: lineOnlyIcon }),
|
|
22764
|
+
selected: !pointsEnabled && lineEnabled,
|
|
22765
|
+
onClick: () => {
|
|
22766
|
+
onTogglePoints();
|
|
22767
|
+
onToggleLine();
|
|
22768
|
+
}
|
|
22769
|
+
},
|
|
22770
|
+
{
|
|
22771
|
+
label: translations.pointsOnly,
|
|
22772
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: pointOnlyIcon }),
|
|
22773
|
+
selected: pointsEnabled && !lineEnabled,
|
|
22774
|
+
onClick: () => {
|
|
22775
|
+
onToggleLine();
|
|
22776
|
+
}
|
|
22777
|
+
}
|
|
22778
|
+
];
|
|
22779
|
+
const selectedOption = options.find((option) => option.selected);
|
|
22780
|
+
return /* @__PURE__ */ jsx(Tooltip$2, { text: selectedOption == null ? void 0 : selectedOption.label, placement: "bottom-start", children: /* @__PURE__ */ jsx(
|
|
22781
|
+
Button,
|
|
22782
|
+
{
|
|
22783
|
+
small: true,
|
|
22784
|
+
basic: true,
|
|
22785
|
+
colored: "muted",
|
|
22786
|
+
round: true,
|
|
22787
|
+
icon: selectedOption == null ? void 0 : selectedOption.icon,
|
|
22788
|
+
onClick: selectedOption == null ? void 0 : selectedOption.onClick
|
|
22789
|
+
}
|
|
22790
|
+
) });
|
|
22791
|
+
};
|
|
22773
22792
|
function TbHandStop(props) {
|
|
22774
22793
|
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": "M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5" } }, { "tag": "path", "attr": { "d": "M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5" } }, { "tag": "path", "attr": { "d": "M14 5.5a1.5 1.5 0 0 1 3 0v6.5" } }, { "tag": "path", "attr": { "d": "M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47" } }] })(props);
|
|
22775
22794
|
}
|
|
22776
22795
|
function TbList(props) {
|
|
22777
22796
|
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": "M9 6l11 0" } }, { "tag": "path", "attr": { "d": "M9 12l11 0" } }, { "tag": "path", "attr": { "d": "M9 18l11 0" } }, { "tag": "path", "attr": { "d": "M5 6l0 .01" } }, { "tag": "path", "attr": { "d": "M5 12l0 .01" } }, { "tag": "path", "attr": { "d": "M5 18l0 .01" } }] })(props);
|
|
22778
22797
|
}
|
|
22779
|
-
function TbRuler(props) {
|
|
22780
|
-
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);
|
|
22781
|
-
}
|
|
22782
22798
|
function TbX(props) {
|
|
22783
22799
|
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);
|
|
22784
22800
|
}
|
|
22785
|
-
function TbZoomIn(props) {
|
|
22786
|
-
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": "M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" } }, { "tag": "path", "attr": { "d": "M7 10l6 0" } }, { "tag": "path", "attr": { "d": "M10 7l0 6" } }, { "tag": "path", "attr": { "d": "M21 21l-6 -6" } }] })(props);
|
|
22787
|
-
}
|
|
22788
22801
|
const DragOptions = ({
|
|
22789
22802
|
onTogglePan,
|
|
22790
22803
|
onToggleZoom,
|
|
@@ -22811,7 +22824,7 @@ const DragOptions = ({
|
|
|
22811
22824
|
/* @__PURE__ */ jsx(Text, { children: "Drag to zoom" }),
|
|
22812
22825
|
/* @__PURE__ */ jsx(Text, { small: true, muted: true, children: doubleClickToReset })
|
|
22813
22826
|
] }),
|
|
22814
|
-
icon: /* @__PURE__ */ jsx(
|
|
22827
|
+
icon: /* @__PURE__ */ jsx(RiZoomInLine, {}),
|
|
22815
22828
|
selected: zoomEnabled,
|
|
22816
22829
|
onClick: onToggleZoom
|
|
22817
22830
|
},
|
|
@@ -22821,7 +22834,7 @@ const DragOptions = ({
|
|
|
22821
22834
|
/* @__PURE__ */ jsx(Text, { children: "Drag to pan" }),
|
|
22822
22835
|
/* @__PURE__ */ jsx(Text, { small: true, muted: true, children: orDoubleClickToCanvas })
|
|
22823
22836
|
] }),
|
|
22824
|
-
icon: /* @__PURE__ */ jsx(
|
|
22837
|
+
icon: /* @__PURE__ */ jsx(RiDragMove2Line, {}),
|
|
22825
22838
|
selected: panEnabled,
|
|
22826
22839
|
onClick: onTogglePan
|
|
22827
22840
|
},
|
|
@@ -22836,7 +22849,7 @@ const DragOptions = ({
|
|
|
22836
22849
|
] : [],
|
|
22837
22850
|
{
|
|
22838
22851
|
label: dragDisabled,
|
|
22839
|
-
icon: /* @__PURE__ */ jsx(
|
|
22852
|
+
icon: /* @__PURE__ */ jsx(RiForbidLine, {}),
|
|
22840
22853
|
selected: !zoomEnabled && !panEnabled && !enableDragPoints,
|
|
22841
22854
|
onClick: onDisableDragOptions
|
|
22842
22855
|
}
|
|
@@ -22873,8 +22886,8 @@ const DragOptions = ({
|
|
|
22873
22886
|
}
|
|
22874
22887
|
);
|
|
22875
22888
|
};
|
|
22876
|
-
const controls = "
|
|
22877
|
-
const buttons = "
|
|
22889
|
+
const controls = "_controls_fa3yo_1";
|
|
22890
|
+
const buttons = "_buttons_fa3yo_7";
|
|
22878
22891
|
const styles$3 = {
|
|
22879
22892
|
controls,
|
|
22880
22893
|
buttons
|
|
@@ -23853,23 +23866,26 @@ const useChartFunctions = ({
|
|
|
23853
23866
|
chartInstance == null ? void 0 : chartInstance.resetZoom();
|
|
23854
23867
|
dispatch({ type: "RESET_AXES_RANGES" });
|
|
23855
23868
|
}, [chartRef]);
|
|
23856
|
-
const onHover = useCallback(
|
|
23857
|
-
|
|
23858
|
-
|
|
23859
|
-
|
|
23860
|
-
|
|
23861
|
-
|
|
23862
|
-
if ((hoveredItems == null ? void 0 : hoveredItems.length) && onPointHover) {
|
|
23863
|
-
const { index: index2, datasetIndex } = hoveredItems[0];
|
|
23864
|
-
const dataset = generatedDatasets[datasetIndex];
|
|
23865
|
-
const point = dataset == null ? void 0 : dataset.data[index2];
|
|
23866
|
-
if (point && hoveredPoint !== point) {
|
|
23867
|
-
setHoveredPoint(point);
|
|
23868
|
-
onPointHover(evt, datasetIndex, index2, generatedDatasets);
|
|
23869
|
+
const onHover = useCallback(
|
|
23870
|
+
(hoveredPoint, setHoveredPoint) => {
|
|
23871
|
+
return (evt, hoveredItems) => {
|
|
23872
|
+
if (!(hoveredItems == null ? void 0 : hoveredItems.length) && onPointUnhover && hoveredPoint) {
|
|
23873
|
+
setHoveredPoint(null);
|
|
23874
|
+
onPointUnhover(evt);
|
|
23869
23875
|
}
|
|
23870
|
-
|
|
23871
|
-
|
|
23872
|
-
|
|
23876
|
+
if ((hoveredItems == null ? void 0 : hoveredItems.length) && onPointHover) {
|
|
23877
|
+
const { index: index2, datasetIndex } = hoveredItems[0];
|
|
23878
|
+
const dataset = generatedDatasets[datasetIndex];
|
|
23879
|
+
const point = dataset == null ? void 0 : dataset.data[index2];
|
|
23880
|
+
if (point && hoveredPoint !== point) {
|
|
23881
|
+
setHoveredPoint(point);
|
|
23882
|
+
onPointHover(evt, datasetIndex, index2, generatedDatasets);
|
|
23883
|
+
}
|
|
23884
|
+
}
|
|
23885
|
+
};
|
|
23886
|
+
},
|
|
23887
|
+
[]
|
|
23888
|
+
);
|
|
23873
23889
|
const handleDownload = useCallback(() => {
|
|
23874
23890
|
var _a2;
|
|
23875
23891
|
const chart2 = chartRef.current;
|
|
@@ -23889,9 +23905,9 @@ const useChartFunctions = ({
|
|
|
23889
23905
|
});
|
|
23890
23906
|
}, [chartRef, state.axes]);
|
|
23891
23907
|
const handleKeyDown = useCallback(
|
|
23892
|
-
(
|
|
23908
|
+
(event) => {
|
|
23893
23909
|
var _a2, _b2, _c2, _d2, _e2;
|
|
23894
|
-
if (
|
|
23910
|
+
if (event.key === Key.Shift) {
|
|
23895
23911
|
const chart2 = chartRef.current;
|
|
23896
23912
|
const zoom2 = (_c2 = (_b2 = (_a2 = chart2 == null ? void 0 : chart2.config) == null ? void 0 : _a2.options) == null ? void 0 : _b2.plugins) == null ? void 0 : _c2.zoom;
|
|
23897
23913
|
if (((_d2 = zoom2 == null ? void 0 : zoom2.zoom) == null ? void 0 : _d2.mode) && ((_e2 = zoom2 == null ? void 0 : zoom2.pan) == null ? void 0 : _e2.mode)) {
|
|
@@ -23904,9 +23920,9 @@ const useChartFunctions = ({
|
|
|
23904
23920
|
[chartRef]
|
|
23905
23921
|
);
|
|
23906
23922
|
const handleKeyUp = useCallback(
|
|
23907
|
-
(
|
|
23923
|
+
(event) => {
|
|
23908
23924
|
var _a2, _b2, _c2, _d2, _e2;
|
|
23909
|
-
if (
|
|
23925
|
+
if (event.key === Key.Shift) {
|
|
23910
23926
|
const chart2 = chartRef.current;
|
|
23911
23927
|
const zoom2 = (_c2 = (_b2 = (_a2 = chart2 == null ? void 0 : chart2.config) == null ? void 0 : _a2.options) == null ? void 0 : _b2.plugins) == null ? void 0 : _c2.zoom;
|
|
23912
23928
|
if (((_d2 = zoom2 == null ? void 0 : zoom2.zoom) == null ? void 0 : _d2.mode) && ((_e2 = zoom2 == null ? void 0 : zoom2.pan) == null ? void 0 : _e2.mode)) {
|
|
@@ -23948,15 +23964,13 @@ const useChartFunctions = ({
|
|
|
23948
23964
|
const updateAxesRangesFromChart = useCallback(() => {
|
|
23949
23965
|
var _a2;
|
|
23950
23966
|
const { scales = {} } = (chartRef == null ? void 0 : chartRef.current) || {};
|
|
23951
|
-
const axes2 = (_a2 = Object.entries(scales)) == null ? void 0 : _a2.map(
|
|
23952
|
-
|
|
23953
|
-
|
|
23954
|
-
|
|
23955
|
-
|
|
23956
|
-
|
|
23957
|
-
|
|
23958
|
-
}
|
|
23959
|
-
);
|
|
23967
|
+
const axes2 = (_a2 = Object.entries(scales)) == null ? void 0 : _a2.map(([key, { min, max }]) => {
|
|
23968
|
+
return {
|
|
23969
|
+
id: key,
|
|
23970
|
+
min: min ?? 0,
|
|
23971
|
+
max: max ?? 0
|
|
23972
|
+
};
|
|
23973
|
+
});
|
|
23960
23974
|
dispatch({
|
|
23961
23975
|
type: UPDATE_AXES_RANGES,
|
|
23962
23976
|
payload: { axes: axes2 }
|
|
@@ -24156,7 +24170,6 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24156
24170
|
name: "min",
|
|
24157
24171
|
value: min,
|
|
24158
24172
|
error: minErrorMsg,
|
|
24159
|
-
size: 5,
|
|
24160
24173
|
width: "100%",
|
|
24161
24174
|
onChange: (evt) => onEditValue({
|
|
24162
24175
|
name: evt.target.name,
|
|
@@ -24173,7 +24186,6 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24173
24186
|
name: "max",
|
|
24174
24187
|
value: max,
|
|
24175
24188
|
error: maxErrorMsg,
|
|
24176
|
-
size: 5,
|
|
24177
24189
|
width: "100%",
|
|
24178
24190
|
onChange: (evt) => onEditValue({
|
|
24179
24191
|
name: evt.target.name,
|
|
@@ -24257,7 +24269,7 @@ const AxesOptions = (optionsPopover) => {
|
|
|
24257
24269
|
return /* @__PURE__ */ jsx(
|
|
24258
24270
|
Popover,
|
|
24259
24271
|
{
|
|
24260
|
-
placement: "bottom",
|
|
24272
|
+
placement: "bottom-start",
|
|
24261
24273
|
overflowContainer: true,
|
|
24262
24274
|
content: /* @__PURE__ */ jsx(
|
|
24263
24275
|
AxesOptionsPopover,
|
|
@@ -24275,9 +24287,9 @@ const AxesOptions = (optionsPopover) => {
|
|
|
24275
24287
|
Tooltip$2,
|
|
24276
24288
|
{
|
|
24277
24289
|
text: translations.axesOptions,
|
|
24278
|
-
placement: "bottom",
|
|
24290
|
+
placement: "bottom-start",
|
|
24279
24291
|
display: "flex",
|
|
24280
|
-
children: /* @__PURE__ */ jsx(Button, { small: true, basic: true, colored: "muted", round: true, icon: /* @__PURE__ */ jsx(
|
|
24292
|
+
children: /* @__PURE__ */ jsx(Button, { small: true, basic: true, colored: "muted", round: true, icon: /* @__PURE__ */ jsx(RiRuler2Line, {}) })
|
|
24281
24293
|
}
|
|
24282
24294
|
)
|
|
24283
24295
|
}
|
|
@@ -24370,7 +24382,7 @@ const Controls = ({
|
|
|
24370
24382
|
basic: true,
|
|
24371
24383
|
colored: "muted",
|
|
24372
24384
|
round: true,
|
|
24373
|
-
icon:
|
|
24385
|
+
icon: /* @__PURE__ */ jsx(RiFileDownloadLine, {}),
|
|
24374
24386
|
onClick: handleDownload
|
|
24375
24387
|
}
|
|
24376
24388
|
)
|
|
@@ -24403,7 +24415,7 @@ const Controls = ({
|
|
|
24403
24415
|
basic: true,
|
|
24404
24416
|
colored: "muted",
|
|
24405
24417
|
round: true,
|
|
24406
|
-
icon: showTable ?
|
|
24418
|
+
icon: showTable ? /* @__PURE__ */ jsx(RiLineChartLine, {}) : /* @__PURE__ */ jsx(RiTableLine, {}),
|
|
24407
24419
|
onClick: onToggleTable
|
|
24408
24420
|
}
|
|
24409
24421
|
)
|
|
@@ -24621,15 +24633,15 @@ const useLegendState = ({
|
|
|
24621
24633
|
);
|
|
24622
24634
|
};
|
|
24623
24635
|
const legendClick = useCallback(
|
|
24624
|
-
(
|
|
24625
|
-
const { datasetIndex } = legendItem2;
|
|
24636
|
+
(_2, legendItem2) => {
|
|
24637
|
+
const { datasetIndex = 0 } = legendItem2;
|
|
24626
24638
|
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
24627
24639
|
const { datasets } = (chartInstance == null ? void 0 : chartInstance.data) || {};
|
|
24628
|
-
const dataset = datasets == null ? void 0 : datasets[datasetIndex];
|
|
24640
|
+
const dataset = (datasets == null ? void 0 : datasets[datasetIndex]) ?? {};
|
|
24629
24641
|
const meta = chartInstance == null ? void 0 : chartInstance.getDatasetMeta(datasetIndex);
|
|
24630
24642
|
const isDatasetVisible = (chartInstance == null ? void 0 : chartInstance.isDatasetVisible(datasetIndex)) ?? true;
|
|
24631
24643
|
upsertHiddenState({
|
|
24632
|
-
label: dataset.label,
|
|
24644
|
+
label: dataset.label ?? "",
|
|
24633
24645
|
datasetIndex,
|
|
24634
24646
|
hidden: isDatasetVisible
|
|
24635
24647
|
});
|
|
@@ -24638,7 +24650,7 @@ const useLegendState = ({
|
|
|
24638
24650
|
const { annotationIndex } = dataset;
|
|
24639
24651
|
dispatch({ type: TOGGLE_ANNOTATION, payload: { annotationIndex } });
|
|
24640
24652
|
}
|
|
24641
|
-
if (dataset.displayGroup) {
|
|
24653
|
+
if (dataset == null ? void 0 : dataset.displayGroup) {
|
|
24642
24654
|
datasets == null ? void 0 : datasets.forEach((ds, ix) => {
|
|
24643
24655
|
if (ds.displayGroup !== dataset.displayGroup)
|
|
24644
24656
|
return;
|
|
@@ -24648,7 +24660,8 @@ const useLegendState = ({
|
|
|
24648
24660
|
});
|
|
24649
24661
|
}
|
|
24650
24662
|
if (onLegendClick) {
|
|
24651
|
-
|
|
24663
|
+
const legendState = legendItem2.hidden ?? false;
|
|
24664
|
+
onLegendClick(legendItem2 == null ? void 0 : legendItem2.text, legendState);
|
|
24652
24665
|
}
|
|
24653
24666
|
chartInstance == null ? void 0 : chartInstance.update();
|
|
24654
24667
|
},
|
|
@@ -24720,7 +24733,7 @@ const LegendItems = ({
|
|
|
24720
24733
|
{
|
|
24721
24734
|
hidden: hiddenState,
|
|
24722
24735
|
dataset: datasets[item.datasetIndex],
|
|
24723
|
-
handleClick: (
|
|
24736
|
+
handleClick: (_2) => legendClick(_2, item)
|
|
24724
24737
|
},
|
|
24725
24738
|
`${item.datasetIndex}-hidden-${item.hidden}`
|
|
24726
24739
|
);
|
|
@@ -24860,7 +24873,8 @@ const Legend2 = ({
|
|
|
24860
24873
|
dispatch,
|
|
24861
24874
|
generatedDatasets
|
|
24862
24875
|
}) => {
|
|
24863
|
-
const [
|
|
24876
|
+
const [measureRef] = useMeasure$1();
|
|
24877
|
+
const resizeRef = measureRef;
|
|
24864
24878
|
const panelRef = useRef(null);
|
|
24865
24879
|
const chart2 = chartRef.current;
|
|
24866
24880
|
const [legendPosition, setLegendPosition] = useState(options.legend.position);
|
|
@@ -25061,18 +25075,18 @@ const checkCustomOption = (data, customOptions) => {
|
|
|
25061
25075
|
return false;
|
|
25062
25076
|
const checkOption = (dataset) => {
|
|
25063
25077
|
if (typeof customOptions === "string") {
|
|
25064
|
-
return has(dataset, customOptions);
|
|
25078
|
+
return dataset && has(dataset, customOptions);
|
|
25065
25079
|
} else if (isArray$2(customOptions)) {
|
|
25066
|
-
return some(customOptions, (option) => has(dataset, option));
|
|
25080
|
+
return dataset && some(customOptions, (option) => dataset && has(dataset, option));
|
|
25067
25081
|
} else {
|
|
25068
|
-
return some(
|
|
25082
|
+
return dataset && some(
|
|
25069
25083
|
Object.values(customOptions),
|
|
25070
|
-
(option) => has(dataset, option)
|
|
25084
|
+
(option) => dataset && has(dataset, option)
|
|
25071
25085
|
);
|
|
25072
25086
|
}
|
|
25073
25087
|
};
|
|
25074
25088
|
if (isArray$2(data)) {
|
|
25075
|
-
return some(data,
|
|
25089
|
+
return some(data, checkOption);
|
|
25076
25090
|
} else {
|
|
25077
25091
|
return checkOption(data);
|
|
25078
25092
|
}
|
|
@@ -25176,8 +25190,8 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
|
25176
25190
|
};
|
|
25177
25191
|
const calculateDelta$1 = (tickValue, ticks) => {
|
|
25178
25192
|
let delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;
|
|
25179
|
-
if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {
|
|
25180
|
-
delta = tickValue - Math.floor(tickValue);
|
|
25193
|
+
if (Math.abs(delta) >= 1 && tickValue !== Math.floor(Number(tickValue))) {
|
|
25194
|
+
delta = Number(tickValue) - Math.floor(Number(tickValue));
|
|
25181
25195
|
}
|
|
25182
25196
|
return delta;
|
|
25183
25197
|
};
|
|
@@ -25197,7 +25211,7 @@ const formatAxisLabelNumbers = (tickValue, ticks) => {
|
|
|
25197
25211
|
}
|
|
25198
25212
|
delta = calculateDelta$1(tickValue, ticks);
|
|
25199
25213
|
}
|
|
25200
|
-
const logDelta = Math.log10(Math.abs(delta));
|
|
25214
|
+
const logDelta = Math.log10(Math.abs(Number(delta)));
|
|
25201
25215
|
const numDecimal = isNaN(logDelta) ? 1 : Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);
|
|
25202
25216
|
const roundScientificCoefficient = numDecimal === 0 ? 1 : numDecimal;
|
|
25203
25217
|
return displayNumber(round$2(tickValue, numDecimal), {
|
|
@@ -25209,13 +25223,16 @@ const getLineChartAxis = (options, axisType, state, currentScales, i2 = 0) => {
|
|
|
25209
25223
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
25210
25224
|
const axisData = currentScales || options.axes[axisType][0] || {};
|
|
25211
25225
|
const stateAxis = state == null ? void 0 : state.axes.filter(
|
|
25212
|
-
(axis) =>
|
|
25226
|
+
(axis) => {
|
|
25227
|
+
var _a3;
|
|
25228
|
+
return (_a3 = axis == null ? void 0 : axis.id) == null ? void 0 : _a3.startsWith(axisType);
|
|
25229
|
+
}
|
|
25213
25230
|
)[i2];
|
|
25214
25231
|
const ticksConfigFromProps = (_b2 = (_a2 = options == null ? void 0 : options.scales) == null ? void 0 : _a2[`${i2 === 0 ? axisType : axisType + i2}`]) == null ? void 0 : _b2.ticks;
|
|
25215
25232
|
const { additionalAxesOptions } = options;
|
|
25216
25233
|
const getTicks = () => {
|
|
25217
25234
|
const isLogarithmic = (additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic;
|
|
25218
|
-
const ticksFormattingCallback = (tick,
|
|
25235
|
+
const ticksFormattingCallback = (tick, _2, ticks2) => {
|
|
25219
25236
|
return isLogarithmic ? LOGARITHMIC_STEPS.includes(tick) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
|
|
25220
25237
|
};
|
|
25221
25238
|
const stepSize = !isLogarithmic ? {
|
|
@@ -25228,7 +25245,7 @@ const getLineChartAxis = (options, axisType, state, currentScales, i2 = 0) => {
|
|
|
25228
25245
|
//OW-10088 disable irregular axis ticks
|
|
25229
25246
|
...ticksConfigFromProps,
|
|
25230
25247
|
font: {
|
|
25231
|
-
size:
|
|
25248
|
+
size: 14
|
|
25232
25249
|
}
|
|
25233
25250
|
};
|
|
25234
25251
|
return ticks;
|
|
@@ -25255,17 +25272,14 @@ const getLineChartAxis = (options, axisType, state, currentScales, i2 = 0) => {
|
|
|
25255
25272
|
};
|
|
25256
25273
|
const getLineChartAxes = (options, axisType, state) => {
|
|
25257
25274
|
const axesData = options.axes[axisType];
|
|
25258
|
-
const axes = axesData.reduce(
|
|
25259
|
-
|
|
25260
|
-
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
|
|
25264
|
-
|
|
25265
|
-
|
|
25266
|
-
},
|
|
25267
|
-
{}
|
|
25268
|
-
);
|
|
25275
|
+
const axes = axesData.reduce((acc, curr, i2) => {
|
|
25276
|
+
const axisData = curr;
|
|
25277
|
+
axisData.color = curr.color || COLORS[i2] || generateRandomColor(COLORS);
|
|
25278
|
+
axisData.position = curr.position || getAxisPosition(axisType, i2);
|
|
25279
|
+
const axis = getLineChartAxis(options, axisType, state, axisData, i2);
|
|
25280
|
+
const axisId = generateAxisId(axisType, i2, true);
|
|
25281
|
+
return { ...acc, [axisId]: axis };
|
|
25282
|
+
}, {});
|
|
25269
25283
|
return axes;
|
|
25270
25284
|
};
|
|
25271
25285
|
const getLineChartScales = (options, state) => {
|
|
@@ -25290,7 +25304,7 @@ const estimateDataSeriesHaveCloseValues = (generatedDatasets) => {
|
|
|
25290
25304
|
const data = dataset == null ? void 0 : dataset.data;
|
|
25291
25305
|
if (data && data.length) {
|
|
25292
25306
|
const { x: xFirstCurrent, y: yFirstCurrent } = (data == null ? void 0 : data[0]) ?? {};
|
|
25293
|
-
const { x: xLastCurrent, y: yLastCurrent } = data.at(-1) ?? {};
|
|
25307
|
+
const { x: xLastCurrent = 0, y: yLastCurrent = 0 } = data.at(-1) ?? {};
|
|
25294
25308
|
const xFirstAcc = ((_a2 = acc == null ? void 0 : acc[xAxisId]) == null ? void 0 : _a2.xFirst) ?? xFirstCurrent;
|
|
25295
25309
|
const xLastAcc = ((_b2 = acc == null ? void 0 : acc[xAxisId]) == null ? void 0 : _b2.xLast) ?? xLastCurrent;
|
|
25296
25310
|
const yFirstAcc = ((_c2 = acc == null ? void 0 : acc[yAxisId]) == null ? void 0 : _c2.yFirst) ?? yFirstCurrent;
|
|
@@ -25388,10 +25402,7 @@ const getAxesDataFromMetasets = (chartRef, scalesKeys, annotationsData) => {
|
|
|
25388
25402
|
}, {}));
|
|
25389
25403
|
};
|
|
25390
25404
|
const autoScale = (options, state, generatedDatasets, chartRef) => {
|
|
25391
|
-
const {
|
|
25392
|
-
additionalAxesOptions = {},
|
|
25393
|
-
annotations: { annotationsData = [] } = {}
|
|
25394
|
-
} = options || {};
|
|
25405
|
+
const { additionalAxesOptions, annotations: { annotationsData = [] } = {} } = options || {};
|
|
25395
25406
|
const scales = getLineChartScales(options, state) || {};
|
|
25396
25407
|
if (!(additionalAxesOptions == null ? void 0 : additionalAxesOptions.autoAxisPadding) && !estimateDataSeriesHaveCloseValues(generatedDatasets)) {
|
|
25397
25408
|
return scales;
|
|
@@ -25403,7 +25414,8 @@ const autoScale = (options, state, generatedDatasets, chartRef) => {
|
|
|
25403
25414
|
annotationsData
|
|
25404
25415
|
);
|
|
25405
25416
|
const adjustedScales = data && (scalesKeys == null ? void 0 : scalesKeys.reduce((acc, key) => {
|
|
25406
|
-
const
|
|
25417
|
+
const scale = scales[key];
|
|
25418
|
+
const { min: propMin = void 0, max: propMax = void 0 } = scale;
|
|
25407
25419
|
const { min, max } = getSuggestedAxisRange({
|
|
25408
25420
|
data: data[key],
|
|
25409
25421
|
beginAtZero: additionalAxesOptions == null ? void 0 : additionalAxesOptions.beginAtZero,
|
|
@@ -25411,7 +25423,7 @@ const autoScale = (options, state, generatedDatasets, chartRef) => {
|
|
|
25411
25423
|
});
|
|
25412
25424
|
const res = {
|
|
25413
25425
|
[key]: {
|
|
25414
|
-
...
|
|
25426
|
+
...scale,
|
|
25415
25427
|
min: propMin ?? min,
|
|
25416
25428
|
max: propMax ?? max
|
|
25417
25429
|
}
|
|
@@ -25422,15 +25434,20 @@ const autoScale = (options, state, generatedDatasets, chartRef) => {
|
|
|
25422
25434
|
};
|
|
25423
25435
|
const getCondition = (x2, y2, left2, right2, bottom2) => {
|
|
25424
25436
|
const threshold = 100;
|
|
25425
|
-
const
|
|
25426
|
-
const
|
|
25427
|
-
const
|
|
25437
|
+
const safeX = x2 ?? 0;
|
|
25438
|
+
const safeY = y2 ?? 0;
|
|
25439
|
+
const safeLeft = left2 ?? 0;
|
|
25440
|
+
const safeRight = right2 ?? 0;
|
|
25441
|
+
const safeBottom = bottom2 ?? 0;
|
|
25442
|
+
const overLeftSide = safeX - threshold <= safeLeft;
|
|
25443
|
+
const overRightSide = safeX + threshold >= safeRight;
|
|
25444
|
+
const overBottomSide = safeX + threshold >= safeLeft && safeX + threshold < safeRight && safeY + threshold >= safeBottom;
|
|
25428
25445
|
return { overLeftSide, overRightSide, overBottomSide };
|
|
25429
25446
|
};
|
|
25430
25447
|
const getAlignmentData = (context) => {
|
|
25431
25448
|
var _a2;
|
|
25432
|
-
const { chart: chart2
|
|
25433
|
-
const { chartArea
|
|
25449
|
+
const { chart: chart2, dataIndex = 0, datasetIndex = 0 } = context;
|
|
25450
|
+
const { chartArea } = chart2;
|
|
25434
25451
|
const { left: left2 = null, right: right2 = null, bottom: bottom2 = null } = chartArea;
|
|
25435
25452
|
const meta = chart2.getDatasetMeta(datasetIndex);
|
|
25436
25453
|
const { x: x2 = null, y: y2 = null } = ((_a2 = meta == null ? void 0 : meta.data) == null ? void 0 : _a2[dataIndex]) || {};
|
|
@@ -25457,13 +25474,15 @@ const getLineChartDataLabels = (options) => {
|
|
|
25457
25474
|
return options.graph.showDataLabels ? {
|
|
25458
25475
|
display: AUTO,
|
|
25459
25476
|
align: getPosition(),
|
|
25460
|
-
formatter: (
|
|
25477
|
+
formatter: (_2, context) => context.dataset.data[context.dataIndex].label || ""
|
|
25461
25478
|
} : { display: false };
|
|
25462
25479
|
};
|
|
25463
25480
|
const annotationEnter = (element, chart2) => {
|
|
25464
25481
|
var _a2;
|
|
25465
25482
|
if ((_a2 = element.options.scaleID) == null ? void 0 : _a2.includes(AxisType.X)) {
|
|
25466
|
-
element.options.label
|
|
25483
|
+
if (element.options.label) {
|
|
25484
|
+
element.options.label.xAdjust = chart2.chartArea.left;
|
|
25485
|
+
}
|
|
25467
25486
|
}
|
|
25468
25487
|
element.options.borderWidth = BORDER_WIDTH.HOVERED;
|
|
25469
25488
|
if (element.options.label) {
|
|
@@ -25486,7 +25505,7 @@ const annotationLeave = (element, chart2) => {
|
|
|
25486
25505
|
};
|
|
25487
25506
|
const generateAnnotations = (options, state) => {
|
|
25488
25507
|
const { annotationsData } = (options == null ? void 0 : options.annotations) || {};
|
|
25489
|
-
|
|
25508
|
+
return annotationsData == null ? void 0 : annotationsData.reduce((acc, curr, i2) => {
|
|
25490
25509
|
var _a2;
|
|
25491
25510
|
if (!((_a2 = state == null ? void 0 : state.showAnnotationLineIndex) == null ? void 0 : _a2.includes(i2))) {
|
|
25492
25511
|
return { ...acc };
|
|
@@ -25534,7 +25553,6 @@ const generateAnnotations = (options, state) => {
|
|
|
25534
25553
|
};
|
|
25535
25554
|
return { ...acc, [`annotation${i2 + 1}`]: annotation2 };
|
|
25536
25555
|
}, {});
|
|
25537
|
-
return annotations;
|
|
25538
25556
|
};
|
|
25539
25557
|
const getAnnotation = (options, state) => {
|
|
25540
25558
|
const { showAnnotations, annotationsData } = (options == null ? void 0 : options.annotations) || {};
|
|
@@ -25555,13 +25573,16 @@ const customFormatNumber = (labelNumber) => {
|
|
|
25555
25573
|
return displayNumber(roundByMagnitude(labelNumber), roundOptions);
|
|
25556
25574
|
};
|
|
25557
25575
|
const getLineChartToolTips = (options) => {
|
|
25558
|
-
const getTooltipLabels = (
|
|
25559
|
-
|
|
25560
|
-
|
|
25561
|
-
|
|
25576
|
+
const getTooltipLabels = ({
|
|
25577
|
+
xAxisID = "",
|
|
25578
|
+
yAxisID = ""
|
|
25579
|
+
}) => {
|
|
25580
|
+
var _a2, _b2, _c2;
|
|
25581
|
+
const xIndex = (xAxisID == null ? void 0 : xAxisID.length) > 1 ? Number(xAxisID[1]) - 1 : 0;
|
|
25582
|
+
const yIndex = (yAxisID == null ? void 0 : yAxisID.length) > 1 ? Number(yAxisID[1]) - 1 : 0;
|
|
25562
25583
|
const xAxis = options.axes.x[xIndex];
|
|
25563
25584
|
const yAxis = options.axes.y[yIndex];
|
|
25564
|
-
if (((
|
|
25585
|
+
if (((_c2 = (_b2 = (_a2 = options == null ? void 0 : options.axes) == null ? void 0 : _a2.x) == null ? void 0 : _b2[0]) == null ? void 0 : _c2.position) === Position.Top) {
|
|
25565
25586
|
return {
|
|
25566
25587
|
titleAxisLabel: (yAxis == null ? void 0 : yAxis.label) || "",
|
|
25567
25588
|
valueAxisLabel: (xAxis == null ? void 0 : xAxis.label) || "",
|
|
@@ -25577,9 +25598,9 @@ const getLineChartToolTips = (options) => {
|
|
|
25577
25598
|
};
|
|
25578
25599
|
}
|
|
25579
25600
|
};
|
|
25580
|
-
const titleCallback = (tooltipItem
|
|
25601
|
+
const titleCallback = (tooltipItem) => {
|
|
25581
25602
|
const labels = getTooltipLabels(tooltipItem[0].dataset);
|
|
25582
|
-
const { titleLabel, titleAxisLabel } = labels;
|
|
25603
|
+
const { titleLabel, titleAxisLabel } = labels ?? {};
|
|
25583
25604
|
const formattedValue = titleLabel === TooltipLabel.Y ? tooltipItem[0].parsed.y : tooltipItem[0].parsed.x;
|
|
25584
25605
|
const roundedValue = customFormatNumber(formattedValue);
|
|
25585
25606
|
return `${roundedValue} ${titleAxisLabel}`;
|
|
@@ -25588,7 +25609,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25588
25609
|
const { showLabelsInTooltips } = options.tooltip;
|
|
25589
25610
|
let label = tooltipItem.dataset.label || "";
|
|
25590
25611
|
const labels = getTooltipLabels(tooltipItem.dataset);
|
|
25591
|
-
const { valueLabel, valueAxisLabel } = labels;
|
|
25612
|
+
const { valueLabel = "", valueAxisLabel = "" } = labels ?? {};
|
|
25592
25613
|
const getTooltipItemValue = () => {
|
|
25593
25614
|
const labelNumber = valueLabel === TooltipLabel.X ? tooltipItem.parsed.x : tooltipItem.parsed.y;
|
|
25594
25615
|
return customFormatNumber(labelNumber);
|
|
@@ -25671,7 +25692,9 @@ const useChartOptions = ({
|
|
|
25671
25692
|
lineEnabled,
|
|
25672
25693
|
showAnnotationLineIndex
|
|
25673
25694
|
} = state;
|
|
25674
|
-
const [hoveredPoint, setHoveredPoint] = useState(
|
|
25695
|
+
const [hoveredPoint, setHoveredPoint] = useState(
|
|
25696
|
+
null
|
|
25697
|
+
);
|
|
25675
25698
|
const { updateAxesRangesFromChart, onHover } = useChartFunctions({
|
|
25676
25699
|
chartRef,
|
|
25677
25700
|
state,
|
|
@@ -25767,7 +25790,8 @@ const useChartOptions = ({
|
|
|
25767
25790
|
elements: {
|
|
25768
25791
|
line: {
|
|
25769
25792
|
pointStyle: PointStyle.Circle,
|
|
25770
|
-
showLine: lineEnabled
|
|
25793
|
+
showLine: lineEnabled,
|
|
25794
|
+
tension: 0
|
|
25771
25795
|
}
|
|
25772
25796
|
},
|
|
25773
25797
|
scales,
|
|
@@ -25783,7 +25807,7 @@ const useChartPlugins = ({ options, resetZoom: resetZoom2 }) => {
|
|
|
25783
25807
|
debounce$3(() => {
|
|
25784
25808
|
resetZoom2();
|
|
25785
25809
|
}, 100),
|
|
25786
|
-
//
|
|
25810
|
+
// 100ms debounce delay
|
|
25787
25811
|
[resetZoom2]
|
|
25788
25812
|
);
|
|
25789
25813
|
const handleDoubleClick = useCallback(
|
|
@@ -25809,7 +25833,7 @@ const getAxesRangesFromChart = (chartRef, axes) => {
|
|
|
25809
25833
|
const { scales = {} } = chartRef.current || {};
|
|
25810
25834
|
return Object.entries(scales).map(([key, { min, max }], i2) => {
|
|
25811
25835
|
var _a2;
|
|
25812
|
-
const axesArray = axes.x
|
|
25836
|
+
const axesArray = [...axes.x, ...axes.y];
|
|
25813
25837
|
const unit = (_a2 = axesArray == null ? void 0 : axesArray[i2]) == null ? void 0 : _a2.unit;
|
|
25814
25838
|
return {
|
|
25815
25839
|
id: key,
|
|
@@ -26330,29 +26354,15 @@ const getDefaultProps$1 = (props) => {
|
|
|
26330
26354
|
}
|
|
26331
26355
|
};
|
|
26332
26356
|
};
|
|
26333
|
-
|
|
26334
|
-
LinearScale$1,
|
|
26335
|
-
CategoryScale$1,
|
|
26336
|
-
LogarithmicScale$1,
|
|
26337
|
-
ArcElement$1,
|
|
26338
|
-
plugin_legend,
|
|
26339
|
-
plugin_tooltip,
|
|
26340
|
-
plugin_title,
|
|
26341
|
-
index,
|
|
26342
|
-
plugin$1,
|
|
26343
|
-
plugin
|
|
26344
|
-
);
|
|
26345
|
-
const PieChart = (props) => {
|
|
26346
|
-
setDefaultTheme();
|
|
26347
|
-
const chart2 = getDefaultProps$1(props);
|
|
26348
|
-
const chartRef = useRef(null);
|
|
26357
|
+
const usePieChartConfig = (chart2) => {
|
|
26349
26358
|
const [pointHover, setPointHover] = useState(false);
|
|
26350
|
-
const { data, options
|
|
26359
|
+
const { data, options } = chart2;
|
|
26351
26360
|
const generateDatasets = (datasets) => {
|
|
26361
|
+
var _a2;
|
|
26352
26362
|
const copyDataset = [...datasets];
|
|
26353
26363
|
if (options.graph.stacked) {
|
|
26354
26364
|
const generatedDataset = {
|
|
26355
|
-
label: copyDataset[0].label,
|
|
26365
|
+
label: ((_a2 = copyDataset == null ? void 0 : copyDataset[0]) == null ? void 0 : _a2.label) ?? "",
|
|
26356
26366
|
backgroundColor: [],
|
|
26357
26367
|
borderColor: [],
|
|
26358
26368
|
borderWidth: Number(copyDataset[0].borderWidth) || 1,
|
|
@@ -26375,8 +26385,9 @@ const PieChart = (props) => {
|
|
|
26375
26385
|
}
|
|
26376
26386
|
const generatedDatasets2 = copyDataset.map(
|
|
26377
26387
|
(pieDataset, index2) => {
|
|
26378
|
-
const borderWidth =
|
|
26379
|
-
const
|
|
26388
|
+
const { borderWidth: inputBorderWidth = "1", data: data2 = [] } = pieDataset ?? {};
|
|
26389
|
+
const borderWidth = parseFloat(String(inputBorderWidth)) || 1;
|
|
26390
|
+
const color2 = data2.map((_2, i2) => COLORS[i2]) || generateRandomColor(COLORS);
|
|
26380
26391
|
const borderColor = pieDataset.borderColor || color2;
|
|
26381
26392
|
const backgroundColor = pieDataset.backgroundColor || color2.map((col) => col + `${99 - 11 * index2}`);
|
|
26382
26393
|
return {
|
|
@@ -26396,49 +26407,18 @@ const PieChart = (props) => {
|
|
|
26396
26407
|
text: chart2.options.title
|
|
26397
26408
|
} : {};
|
|
26398
26409
|
};
|
|
26399
|
-
const legendClick = (
|
|
26400
|
-
|
|
26401
|
-
const {
|
|
26402
|
-
|
|
26403
|
-
|
|
26404
|
-
|
|
26405
|
-
|
|
26406
|
-
|
|
26407
|
-
|
|
26408
|
-
|
|
26409
|
-
arc.hidden = !arc.hidden;
|
|
26410
|
-
}
|
|
26411
|
-
}
|
|
26412
|
-
} else {
|
|
26413
|
-
for (let i2 = 0; i2 < chartInstance.config._config.data.datasets[0].data.length; i2++) {
|
|
26414
|
-
if (parseInt(String(i2 / data.datasets.length)) === index2) {
|
|
26415
|
-
const meta = chartInstance.getDatasetMeta(0);
|
|
26416
|
-
const arc = meta.data[i2];
|
|
26417
|
-
arc.hidden = !arc.hidden;
|
|
26418
|
-
}
|
|
26419
|
-
}
|
|
26420
|
-
}
|
|
26421
|
-
} else {
|
|
26422
|
-
if (options.legend.useDataset) {
|
|
26423
|
-
const meta = chartInstance.getDatasetMeta(index2);
|
|
26424
|
-
meta.hidden = !meta.hidden;
|
|
26425
|
-
} else {
|
|
26426
|
-
if (datasets.length > 1) {
|
|
26427
|
-
for (let i2 = 0; i2 < data.datasets.length; i2++) {
|
|
26428
|
-
const meta = chartInstance.getDatasetMeta(i2);
|
|
26429
|
-
const arc = meta.data[index2];
|
|
26430
|
-
arc.hidden = !arc.hidden;
|
|
26431
|
-
}
|
|
26432
|
-
} else {
|
|
26433
|
-
const meta = chartInstance.getDatasetMeta(0);
|
|
26434
|
-
const arc = meta.data[index2];
|
|
26435
|
-
arc.hidden = !arc.hidden;
|
|
26436
|
-
}
|
|
26410
|
+
const legendClick = (_2, legendItem2, legend2) => {
|
|
26411
|
+
var _a2;
|
|
26412
|
+
const { chart: chart22 } = legend2 ?? {};
|
|
26413
|
+
if (legendItem2 && chart22) {
|
|
26414
|
+
const { index: index2 = 0 } = legendItem2;
|
|
26415
|
+
chart22.toggleDataVisibility(index2);
|
|
26416
|
+
chart22.update();
|
|
26417
|
+
if ((_a2 = options.interactions) == null ? void 0 : _a2.onLegendClick) {
|
|
26418
|
+
const hidden = chart22.isDatasetVisible(index2);
|
|
26419
|
+
options.interactions.onLegendClick(legendItem2.text, !hidden);
|
|
26437
26420
|
}
|
|
26438
26421
|
}
|
|
26439
|
-
if (options.interactions.onLegendClick)
|
|
26440
|
-
options.interactions.onLegendClick(text, hidden);
|
|
26441
|
-
chartInstance.update();
|
|
26442
26422
|
};
|
|
26443
26423
|
const onClick = (_evt, _elements, chartInstance) => {
|
|
26444
26424
|
chartInstance.resetZoom();
|
|
@@ -26469,7 +26449,7 @@ const PieChart = (props) => {
|
|
|
26469
26449
|
display: "auto",
|
|
26470
26450
|
align: "center",
|
|
26471
26451
|
anchor: "center",
|
|
26472
|
-
formatter: (
|
|
26452
|
+
formatter: (_2, context) => {
|
|
26473
26453
|
if (context.chart.getDatasetMeta(
|
|
26474
26454
|
options.graph.stacked ? 0 : context.datasetIndex
|
|
26475
26455
|
).data[context.dataIndex].hidden)
|
|
@@ -26488,66 +26468,11 @@ const PieChart = (props) => {
|
|
|
26488
26468
|
};
|
|
26489
26469
|
};
|
|
26490
26470
|
const getLegend2 = () => {
|
|
26491
|
-
const generateLabels = (chartInstance) => {
|
|
26492
|
-
const meta = chartInstance.getDatasetMeta(0);
|
|
26493
|
-
const getStyles = (dataset, i2) => {
|
|
26494
|
-
const dataPoint = dataset.data[i2 % dataset.data.length];
|
|
26495
|
-
const { label } = dataPoint;
|
|
26496
|
-
const arc = meta.data[i2];
|
|
26497
|
-
const text = arc.hidden ? "-".repeat(label.length) : label;
|
|
26498
|
-
const backgroundColor = dataPoint == null ? void 0 : dataPoint.backgroundColor;
|
|
26499
|
-
const borderColor = dataPoint == null ? void 0 : dataPoint.borderColor;
|
|
26500
|
-
return {
|
|
26501
|
-
text,
|
|
26502
|
-
fillStyle: (Array.isArray(backgroundColor) ? backgroundColor[0] : backgroundColor) || COLORS[0] + `${99 - 20 * i2}`,
|
|
26503
|
-
strokeStyle: (Array.isArray(borderColor) ? borderColor[0] : borderColor) || COLORS[0],
|
|
26504
|
-
index: i2
|
|
26505
|
-
};
|
|
26506
|
-
};
|
|
26507
|
-
let mappedData;
|
|
26508
|
-
if (options.graph.stacked) {
|
|
26509
|
-
if (options.legend.useDataset) {
|
|
26510
|
-
mappedData = data.datasets.map(getStyles);
|
|
26511
|
-
} else {
|
|
26512
|
-
mappedData = data.labels.map((label, i2) => {
|
|
26513
|
-
var _a2, _b2;
|
|
26514
|
-
const arc = meta.data[parseInt(String(i2 * data.datasets.length))];
|
|
26515
|
-
const text = arc.hidden ? "-".repeat(label.length) : label;
|
|
26516
|
-
const backgroundColor = (_a2 = data.datasets[0]) == null ? void 0 : _a2.backgroundColor;
|
|
26517
|
-
const borderColor = (_b2 = data.datasets[0]) == null ? void 0 : _b2.borderColor;
|
|
26518
|
-
return {
|
|
26519
|
-
text,
|
|
26520
|
-
fillStyle: (Array.isArray(backgroundColor) ? backgroundColor[i2 % backgroundColor.length] : backgroundColor) || COLORS[i2] + "99",
|
|
26521
|
-
strokeStyle: (Array.isArray(borderColor) ? borderColor[i2 % ((backgroundColor == null ? void 0 : backgroundColor.length) ?? 0)] : borderColor) || COLORS[i2],
|
|
26522
|
-
index: i2
|
|
26523
|
-
};
|
|
26524
|
-
});
|
|
26525
|
-
}
|
|
26526
|
-
} else if (options.legend.useDataset) {
|
|
26527
|
-
mappedData = data.datasets.map(getStyles);
|
|
26528
|
-
} else {
|
|
26529
|
-
mappedData = data.labels.map((label, i2) => {
|
|
26530
|
-
var _a2, _b2;
|
|
26531
|
-
const arc = meta.data[i2];
|
|
26532
|
-
const text = arc.hidden ? "-".repeat(label.length) : label;
|
|
26533
|
-
const backgroundColor = (_a2 = data.datasets[0]) == null ? void 0 : _a2.backgroundColor;
|
|
26534
|
-
const borderColor = (_b2 = data.datasets[0]) == null ? void 0 : _b2.borderColor;
|
|
26535
|
-
return {
|
|
26536
|
-
text,
|
|
26537
|
-
fillStyle: (Array.isArray(backgroundColor) ? backgroundColor[i2 % backgroundColor.length] : backgroundColor) || COLORS[i2] + "99",
|
|
26538
|
-
strokeStyle: (Array.isArray(borderColor) ? borderColor[i2 % ((backgroundColor == null ? void 0 : backgroundColor.length) ?? 0)] : borderColor) || COLORS[i2],
|
|
26539
|
-
index: i2
|
|
26540
|
-
};
|
|
26541
|
-
});
|
|
26542
|
-
}
|
|
26543
|
-
return mappedData;
|
|
26544
|
-
};
|
|
26545
26471
|
return {
|
|
26546
26472
|
position: options.legend.position,
|
|
26547
26473
|
display: options.legend.display,
|
|
26548
26474
|
align: options.legend.align,
|
|
26549
26475
|
labels: {
|
|
26550
|
-
generateLabels,
|
|
26551
26476
|
boxHeight: 6,
|
|
26552
26477
|
boxWidth: 6,
|
|
26553
26478
|
usePointStyle: true,
|
|
@@ -26589,6 +26514,43 @@ const PieChart = (props) => {
|
|
|
26589
26514
|
usePointStyle: true
|
|
26590
26515
|
};
|
|
26591
26516
|
};
|
|
26517
|
+
return {
|
|
26518
|
+
generatedDatasets,
|
|
26519
|
+
getTitle: getTitle2,
|
|
26520
|
+
legendClick,
|
|
26521
|
+
onClick,
|
|
26522
|
+
onHover,
|
|
26523
|
+
getDatalabels,
|
|
26524
|
+
getLegend: getLegend2,
|
|
26525
|
+
getToolTips
|
|
26526
|
+
};
|
|
26527
|
+
};
|
|
26528
|
+
Chart$2.register(
|
|
26529
|
+
LinearScale$1,
|
|
26530
|
+
CategoryScale$1,
|
|
26531
|
+
LogarithmicScale$1,
|
|
26532
|
+
ArcElement$1,
|
|
26533
|
+
plugin_legend,
|
|
26534
|
+
plugin_tooltip,
|
|
26535
|
+
plugin_title,
|
|
26536
|
+
index,
|
|
26537
|
+
plugin$1,
|
|
26538
|
+
plugin
|
|
26539
|
+
);
|
|
26540
|
+
const PieChart = (props) => {
|
|
26541
|
+
setDefaultTheme();
|
|
26542
|
+
const chart2 = getDefaultProps$1(props);
|
|
26543
|
+
const chartRef = useRef(null);
|
|
26544
|
+
const { data, options, testId } = chart2;
|
|
26545
|
+
const {
|
|
26546
|
+
generatedDatasets,
|
|
26547
|
+
getTitle: getTitle2,
|
|
26548
|
+
onClick,
|
|
26549
|
+
onHover,
|
|
26550
|
+
getDatalabels,
|
|
26551
|
+
getLegend: getLegend2,
|
|
26552
|
+
getToolTips
|
|
26553
|
+
} = usePieChartConfig(chart2);
|
|
26592
26554
|
return /* @__PURE__ */ jsx(
|
|
26593
26555
|
"div",
|
|
26594
26556
|
{
|
|
@@ -38997,107 +38959,123 @@ const Ht = { id: "dragdata", afterInit: function(t) {
|
|
|
38997
38959
|
return t.tooltip && t.tooltip.update(), false;
|
|
38998
38960
|
} };
|
|
38999
38961
|
Chart.register(Ht);
|
|
39000
|
-
const
|
|
39001
|
-
|
|
39002
|
-
|
|
39003
|
-
|
|
39004
|
-
|
|
39005
|
-
const
|
|
39006
|
-
const
|
|
39007
|
-
const
|
|
39008
|
-
|
|
39009
|
-
|
|
39010
|
-
|
|
39011
|
-
|
|
39012
|
-
|
|
39013
|
-
|
|
39014
|
-
|
|
39015
|
-
|
|
39016
|
-
|
|
39017
|
-
|
|
39018
|
-
|
|
39019
|
-
|
|
39020
|
-
|
|
39021
|
-
|
|
39022
|
-
|
|
39023
|
-
|
|
39024
|
-
|
|
39025
|
-
|
|
39026
|
-
|
|
39027
|
-
|
|
39028
|
-
|
|
39029
|
-
|
|
39030
|
-
});
|
|
39031
|
-
|
|
39032
|
-
|
|
39033
|
-
height: styling == null ? void 0 : styling.height,
|
|
39034
|
-
maintainAspectRatio: (styling == null ? void 0 : styling.maintainAspectRatio) || false,
|
|
39035
|
-
staticChartHeight: (styling == null ? void 0 : styling.staticChartHeight) || false,
|
|
39036
|
-
performanceMode: (styling == null ? void 0 : styling.performanceMode) ?? true
|
|
39037
|
-
});
|
|
39038
|
-
const defaultTooltip = (tooltip) => ({
|
|
39039
|
-
tooltips: (tooltip == null ? void 0 : tooltip.tooltips) ?? true,
|
|
39040
|
-
showLabelsInTooltips: (tooltip == null ? void 0 : tooltip.showLabelsInTooltips) || false
|
|
39041
|
-
});
|
|
39042
|
-
const defaultGraph = (graph) => ({
|
|
39043
|
-
showDataLabels: (graph == null ? void 0 : graph.showDataLabels) || false,
|
|
39044
|
-
showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) || false
|
|
39045
|
-
});
|
|
39046
|
-
const defaultAnnotations = (annotations) => ({
|
|
39047
|
-
showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? true,
|
|
39048
|
-
controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) || false,
|
|
39049
|
-
annotationsData: (annotations == null ? void 0 : annotations.annotationsData) || []
|
|
39050
|
-
});
|
|
39051
|
-
const defaultLegend = (legend2) => ({
|
|
39052
|
-
display: (legend2 == null ? void 0 : legend2.display) ?? true,
|
|
39053
|
-
position: (legend2 == null ? void 0 : legend2.position) || Position.Bottom,
|
|
39054
|
-
align: (legend2 == null ? void 0 : legend2.align) || AlignOptions.Center,
|
|
39055
|
-
customLegend: (legend2 == null ? void 0 : legend2.customLegend) || {
|
|
39056
|
-
customLegendPlugin: null,
|
|
39057
|
-
customLegendContainerID: ""
|
|
39058
|
-
}
|
|
39059
|
-
});
|
|
39060
|
-
const defaultChartOptions = (options) => ({
|
|
39061
|
-
enableZoom: (options == null ? void 0 : options.enableZoom) || false,
|
|
39062
|
-
enablePan: (options == null ? void 0 : options.enablePan) || false
|
|
39063
|
-
});
|
|
39064
|
-
const defaultInteractions = (interactions) => ({
|
|
39065
|
-
onLegendClick: interactions == null ? void 0 : interactions.onLegendClick,
|
|
39066
|
-
onHover: interactions == null ? void 0 : interactions.onHover,
|
|
39067
|
-
onUnhover: interactions == null ? void 0 : interactions.onUnhover
|
|
39068
|
-
});
|
|
39069
|
-
const defaultDragData = (dragData) => ({
|
|
39070
|
-
enableDragData: (dragData == null ? void 0 : dragData.enableDragData) ?? false,
|
|
39071
|
-
showTooltip: (dragData == null ? void 0 : dragData.showTooltip) ?? true,
|
|
39072
|
-
roundPoints: (dragData == null ? void 0 : dragData.roundPoints) ?? true,
|
|
39073
|
-
dragX: (dragData == null ? void 0 : dragData.dragX) ?? true,
|
|
39074
|
-
dragY: (dragData == null ? void 0 : dragData.dragY) ?? true,
|
|
39075
|
-
onDragStart: dragData == null ? void 0 : dragData.onDragStart,
|
|
39076
|
-
onDrag: dragData == null ? void 0 : dragData.onDrag,
|
|
39077
|
-
onDragEnd: dragData == null ? void 0 : dragData.onDragEnd
|
|
39078
|
-
});
|
|
39079
|
-
const getDefaultProps = (props) => {
|
|
39080
|
-
const chart2 = (props == null ? void 0 : props.chart) || {};
|
|
39081
|
-
const options = (chart2 == null ? void 0 : chart2.options) || {};
|
|
39082
|
-
return {
|
|
39083
|
-
testId: (chart2 == null ? void 0 : chart2.testId) ?? "",
|
|
39084
|
-
data: chart2 == null ? void 0 : chart2.data,
|
|
39085
|
-
options: {
|
|
39086
|
-
title: (options == null ? void 0 : options.title) || "",
|
|
39087
|
-
direction: (options == null ? void 0 : options.direction) || "vertical",
|
|
39088
|
-
axes: defaultAxes(options == null ? void 0 : options.axes),
|
|
39089
|
-
additionalAxesOptions: defaultAdditionalAxesOptions(
|
|
39090
|
-
options == null ? void 0 : options.additionalAxesOptions
|
|
39091
|
-
),
|
|
39092
|
-
chartStyling: defaultChartStyling(options == null ? void 0 : options.chartStyling),
|
|
39093
|
-
tooltip: defaultTooltip(options == null ? void 0 : options.tooltip),
|
|
39094
|
-
graph: defaultGraph(options == null ? void 0 : options.graph),
|
|
39095
|
-
annotations: defaultAnnotations(options == null ? void 0 : options.annotations),
|
|
39096
|
-
legend: defaultLegend(options == null ? void 0 : options.legend),
|
|
39097
|
-
chartOptions: defaultChartOptions(options == null ? void 0 : options.chartOptions),
|
|
39098
|
-
interactions: defaultInteractions(options == null ? void 0 : options.interactions),
|
|
39099
|
-
dragData: defaultDragData(options == null ? void 0 : options.dragData)
|
|
38962
|
+
const useBarChartConfig = ({
|
|
38963
|
+
chart: chart2,
|
|
38964
|
+
chartRef
|
|
38965
|
+
}) => {
|
|
38966
|
+
var _a2;
|
|
38967
|
+
const { options } = chart2;
|
|
38968
|
+
const { annotations, interactions } = options;
|
|
38969
|
+
const [pointHover, setPointHover] = useState(false);
|
|
38970
|
+
const [visibleAnnotationsIndexes, setVisibleAnnotationsIndexes] = useState(
|
|
38971
|
+
setAnnotations(annotations.annotationsData)
|
|
38972
|
+
);
|
|
38973
|
+
const generateBarChartDatasets = ({
|
|
38974
|
+
datasets,
|
|
38975
|
+
options: options2
|
|
38976
|
+
}) => {
|
|
38977
|
+
const {
|
|
38978
|
+
annotations: { controlAnnotation, showAnnotations, annotationsData } = {}
|
|
38979
|
+
} = options2;
|
|
38980
|
+
const barDatasetsCopy = [...datasets];
|
|
38981
|
+
if (controlAnnotation && showAnnotations && (annotationsData == null ? void 0 : annotationsData.length)) {
|
|
38982
|
+
annotationsData.forEach(
|
|
38983
|
+
(annotation2, index2) => {
|
|
38984
|
+
barDatasetsCopy.push({
|
|
38985
|
+
isAnnotation: true,
|
|
38986
|
+
label: annotation2.label,
|
|
38987
|
+
annotationIndex: index2,
|
|
38988
|
+
backgroundColor: annotation2.color || COLORS[index2],
|
|
38989
|
+
borderColor: annotation2.color || COLORS[index2],
|
|
38990
|
+
data: [],
|
|
38991
|
+
type: ChartType.Bar
|
|
38992
|
+
});
|
|
38993
|
+
}
|
|
38994
|
+
);
|
|
39100
38995
|
}
|
|
38996
|
+
const generatedDatasets2 = barDatasetsCopy.map((barDataset, index2) => {
|
|
38997
|
+
const colorSchema = COLORS;
|
|
38998
|
+
const colors2 = barDataset.data.map((_2, i2) => {
|
|
38999
|
+
const colorSelectionIndex = datasets.length > 1 ? index2 : i2;
|
|
39000
|
+
return colorSchema[colorSelectionIndex] || generateRandomColor(COLORS);
|
|
39001
|
+
});
|
|
39002
|
+
const backgroundColors = barDataset.backgroundColor || colors2.map((color2) => color2 + ALPHA_CHANEL);
|
|
39003
|
+
return {
|
|
39004
|
+
...barDataset,
|
|
39005
|
+
borderWidth: parseFloat(String(barDataset.borderWidth)) ?? 1,
|
|
39006
|
+
borderColor: barDataset.borderColor || colors2[index2],
|
|
39007
|
+
backgroundColor: backgroundColors
|
|
39008
|
+
};
|
|
39009
|
+
});
|
|
39010
|
+
return generatedDatasets2 || [];
|
|
39011
|
+
};
|
|
39012
|
+
const generatedDatasets = generateBarChartDatasets({
|
|
39013
|
+
datasets: (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets,
|
|
39014
|
+
options
|
|
39015
|
+
});
|
|
39016
|
+
const legendClick = (_e2, legendItem2) => {
|
|
39017
|
+
const index2 = (legendItem2 == null ? void 0 : legendItem2.datasetIndex) ?? null;
|
|
39018
|
+
const chartInstance = chartRef.current;
|
|
39019
|
+
if (chartInstance && index2 !== null) {
|
|
39020
|
+
const { datasets } = chartInstance.data;
|
|
39021
|
+
const dataset = datasets[index2];
|
|
39022
|
+
const meta = chartInstance.getDatasetMeta(index2);
|
|
39023
|
+
meta.hidden = meta.hidden === null ? !dataset.hidden : null;
|
|
39024
|
+
if (annotations.controlAnnotation && dataset.isAnnotation) {
|
|
39025
|
+
const { annotationIndex } = dataset;
|
|
39026
|
+
if (visibleAnnotationsIndexes.includes(annotationIndex)) {
|
|
39027
|
+
setVisibleAnnotationsIndexes(
|
|
39028
|
+
visibleAnnotationsIndexes.filter((ann) => ann !== annotationIndex)
|
|
39029
|
+
);
|
|
39030
|
+
} else {
|
|
39031
|
+
setVisibleAnnotationsIndexes([
|
|
39032
|
+
...visibleAnnotationsIndexes,
|
|
39033
|
+
annotationIndex
|
|
39034
|
+
]);
|
|
39035
|
+
}
|
|
39036
|
+
}
|
|
39037
|
+
if (dataset.displayGroup) {
|
|
39038
|
+
datasets.forEach((ds, ix) => {
|
|
39039
|
+
if (ds.displayGroup !== dataset.displayGroup) {
|
|
39040
|
+
return;
|
|
39041
|
+
}
|
|
39042
|
+
chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
|
|
39043
|
+
});
|
|
39044
|
+
}
|
|
39045
|
+
if (interactions.onLegendClick) {
|
|
39046
|
+
interactions.onLegendClick(
|
|
39047
|
+
legendItem2 == null ? void 0 : legendItem2.text,
|
|
39048
|
+
(legendItem2 == null ? void 0 : legendItem2.hidden) ?? false
|
|
39049
|
+
);
|
|
39050
|
+
}
|
|
39051
|
+
chartInstance.update();
|
|
39052
|
+
}
|
|
39053
|
+
};
|
|
39054
|
+
const onClick = (_evt, _elements, chartInstance) => {
|
|
39055
|
+
chartInstance.resetZoom();
|
|
39056
|
+
};
|
|
39057
|
+
const onHover = (evt, hoveredItems) => {
|
|
39058
|
+
if (pointHover && !(hoveredItems == null ? void 0 : hoveredItems.length)) {
|
|
39059
|
+
setPointHover(false);
|
|
39060
|
+
if (interactions.onUnhover) {
|
|
39061
|
+
interactions.onUnhover(evt);
|
|
39062
|
+
}
|
|
39063
|
+
}
|
|
39064
|
+
if (!pointHover && (hoveredItems == null ? void 0 : hoveredItems.length)) {
|
|
39065
|
+
setPointHover(true);
|
|
39066
|
+
if (interactions.onHover) {
|
|
39067
|
+
const { index: index2, datasetIndex } = hoveredItems[0];
|
|
39068
|
+
const generatedDataset = generatedDatasets;
|
|
39069
|
+
interactions.onHover(evt, datasetIndex, index2, generatedDataset);
|
|
39070
|
+
}
|
|
39071
|
+
}
|
|
39072
|
+
};
|
|
39073
|
+
return {
|
|
39074
|
+
generatedDatasets,
|
|
39075
|
+
legendClick,
|
|
39076
|
+
onClick,
|
|
39077
|
+
onHover,
|
|
39078
|
+
visibleAnnotationsIndexes
|
|
39101
39079
|
};
|
|
39102
39080
|
};
|
|
39103
39081
|
const getBarChartAxis = ({
|
|
@@ -39106,27 +39084,29 @@ const getBarChartAxis = ({
|
|
|
39106
39084
|
currentScale,
|
|
39107
39085
|
i: i2
|
|
39108
39086
|
}) => {
|
|
39109
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
|
|
39087
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
|
|
39110
39088
|
const isDirectionVertical = isVertical(chart2.options.direction);
|
|
39111
|
-
const axisData = currentScale || chart2.options.axes[axisType][0];
|
|
39089
|
+
const axisData = currentScale || ((_c2 = (_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.axes) == null ? void 0 : _b2[axisType]) == null ? void 0 : _c2[0]);
|
|
39112
39090
|
const isDirectionCompatibleWithAxisType = isDirectionVertical && axisType === AxisType.Y || !isDirectionVertical && axisType === AxisType.X;
|
|
39113
39091
|
const grid = (axisData == null ? void 0 : axisData.gridLines) || {};
|
|
39114
39092
|
const getScaleType = () => {
|
|
39093
|
+
var _a3, _b3;
|
|
39115
39094
|
const scaleType = chart2.data.labels ? ScaleType.Category : ScaleType.Linear;
|
|
39116
39095
|
const axisWithScale = isDirectionVertical ? AxisType.X : AxisType.Y;
|
|
39117
|
-
return axisType === axisWithScale ? scaleType : chart2.options.additionalAxesOptions.chartScaleType;
|
|
39096
|
+
return axisType === axisWithScale ? scaleType : (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions) == null ? void 0 : _b3.chartScaleType;
|
|
39118
39097
|
};
|
|
39119
39098
|
const getReverse = () => {
|
|
39099
|
+
var _a3, _b3;
|
|
39120
39100
|
const axisWithReverse = isDirectionVertical ? AxisType.Y : AxisType.X;
|
|
39121
|
-
return axisType === axisWithReverse ? chart2.options.additionalAxesOptions.reverse : false;
|
|
39101
|
+
return axisType === axisWithReverse ? (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions) == null ? void 0 : _b3.reverse : false;
|
|
39122
39102
|
};
|
|
39123
39103
|
const getTicks = () => {
|
|
39124
39104
|
var _a3, _b3, _c3, _d3;
|
|
39125
39105
|
const additionalAxesOptions = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions;
|
|
39126
39106
|
const ticksConfigFromProps = (_d3 = (_c3 = (_b3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _b3.scales) == null ? void 0 : _c3[`${i2 === 0 ? axisType : axisType + i2}`]) == null ? void 0 : _d3.ticks;
|
|
39127
39107
|
const isLogarithmic = isDirectionCompatibleWithAxisType && (additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic;
|
|
39128
|
-
const ticksFormattingCallback = (tick,
|
|
39129
|
-
return isLogarithmic ? LOGARITHMIC_STEPS.includes(tick) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
|
|
39108
|
+
const ticksFormattingCallback = (tick, _2, ticks2) => {
|
|
39109
|
+
return isLogarithmic ? LOGARITHMIC_STEPS.includes(Number(tick)) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
|
|
39130
39110
|
};
|
|
39131
39111
|
const stepSize = !isLogarithmic ? {
|
|
39132
39112
|
stepSize: axisData.stepSize ?? (axisType === AxisType.Y ? additionalAxesOptions == null ? void 0 : additionalAxesOptions.stepSize : null)
|
|
@@ -39137,7 +39117,7 @@ const getBarChartAxis = ({
|
|
|
39137
39117
|
//OW-10088 disable irregular axis ticks
|
|
39138
39118
|
...ticksConfigFromProps,
|
|
39139
39119
|
font: {
|
|
39140
|
-
size:
|
|
39120
|
+
size: 14
|
|
39141
39121
|
}
|
|
39142
39122
|
};
|
|
39143
39123
|
if ((additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic) {
|
|
@@ -39148,14 +39128,14 @@ const getBarChartAxis = ({
|
|
|
39148
39128
|
return {
|
|
39149
39129
|
type: getScaleType(),
|
|
39150
39130
|
position: axisData == null ? void 0 : axisData.position,
|
|
39151
|
-
beginAtZero: (
|
|
39131
|
+
beginAtZero: (_e2 = (_d2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _d2.additionalAxesOptions) == null ? void 0 : _e2.beginAtZero,
|
|
39152
39132
|
reverse: getReverse(),
|
|
39153
|
-
suggestedMax: (
|
|
39154
|
-
suggestedMin: (
|
|
39155
|
-
min: isDirectionCompatibleWithAxisType ? (
|
|
39156
|
-
max: isDirectionCompatibleWithAxisType ? (
|
|
39133
|
+
suggestedMax: (_g2 = (_f2 = chart2.options) == null ? void 0 : _f2.additionalAxesOptions) == null ? void 0 : _g2.suggestedMax,
|
|
39134
|
+
suggestedMin: (_i2 = (_h2 = chart2.options) == null ? void 0 : _h2.additionalAxesOptions) == null ? void 0 : _i2.suggestedMin,
|
|
39135
|
+
min: isDirectionCompatibleWithAxisType ? (_k2 = (_j2 = chart2.options) == null ? void 0 : _j2.additionalAxesOptions) == null ? void 0 : _k2.min : void 0,
|
|
39136
|
+
max: isDirectionCompatibleWithAxisType ? (_m2 = (_l2 = chart2.options) == null ? void 0 : _l2.additionalAxesOptions) == null ? void 0 : _m2.max : void 0,
|
|
39157
39137
|
title: {
|
|
39158
|
-
display: ((
|
|
39138
|
+
display: ((_n2 = axisData == null ? void 0 : axisData.label) == null ? void 0 : _n2.length) || ((_o2 = axisData == null ? void 0 : axisData.unit) == null ? void 0 : _o2.length),
|
|
39159
39139
|
text: (axisData == null ? void 0 : axisData.label) || (axisData == null ? void 0 : axisData.unit),
|
|
39160
39140
|
padding: 0
|
|
39161
39141
|
},
|
|
@@ -39163,7 +39143,7 @@ const getBarChartAxis = ({
|
|
|
39163
39143
|
grid: {
|
|
39164
39144
|
...grid
|
|
39165
39145
|
},
|
|
39166
|
-
stacked: (
|
|
39146
|
+
stacked: (_q2 = (_p2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _p2.additionalAxesOptions) == null ? void 0 : _q2.stacked
|
|
39167
39147
|
};
|
|
39168
39148
|
};
|
|
39169
39149
|
const getBarChartAxes = (chart2, axisType) => {
|
|
@@ -39194,13 +39174,40 @@ const getBarChartScales = (chart2) => {
|
|
|
39194
39174
|
...yAxesScales
|
|
39195
39175
|
};
|
|
39196
39176
|
};
|
|
39177
|
+
const getBarChartDataLabels = (options) => {
|
|
39178
|
+
var _a2;
|
|
39179
|
+
const { beginAtZero, reverse } = (options == null ? void 0 : options.additionalAxesOptions) || {};
|
|
39180
|
+
const formatterCallback = (_2, context) => {
|
|
39181
|
+
const { datasetIndex, dataIndex } = context;
|
|
39182
|
+
const dataset = context.chart.data.datasets[datasetIndex];
|
|
39183
|
+
const dataElement = dataset.data[dataIndex];
|
|
39184
|
+
let dataLabel = "";
|
|
39185
|
+
if (typeof dataElement === "number") {
|
|
39186
|
+
dataLabel = Number.isInteger(dataElement) ? dataElement : dataElement.toFixed(2);
|
|
39187
|
+
}
|
|
39188
|
+
if (Array.isArray(dataElement)) {
|
|
39189
|
+
dataLabel = dataElement.reduce((acc, curr, i2) => {
|
|
39190
|
+
return i2 === 0 ? `${acc} ${curr}` : `${acc}, ${curr}`;
|
|
39191
|
+
}, "");
|
|
39192
|
+
}
|
|
39193
|
+
return dataLabel;
|
|
39194
|
+
};
|
|
39195
|
+
const beginAtNotZeroAlign = reverse ? AlignOptions.End : AlignOptions.Start;
|
|
39196
|
+
const beginAtNotZeroAnchor = reverse ? AlignOptions.Start : AlignOptions.End;
|
|
39197
|
+
return ((_a2 = options == null ? void 0 : options.graph) == null ? void 0 : _a2.showDataLabels) ? {
|
|
39198
|
+
display: AUTO,
|
|
39199
|
+
align: beginAtZero ? AlignOptions.Center : beginAtNotZeroAlign,
|
|
39200
|
+
anchor: beginAtZero ? AlignOptions.Center : beginAtNotZeroAnchor,
|
|
39201
|
+
formatter: formatterCallback
|
|
39202
|
+
} : { display: false };
|
|
39203
|
+
};
|
|
39197
39204
|
const getBarChartToolTips = (options) => {
|
|
39198
39205
|
var _a2;
|
|
39199
39206
|
const getTooltipLabels = (dataset) => {
|
|
39200
39207
|
var _a3, _b2;
|
|
39201
39208
|
const isDirectionVertical = isVertical(options.direction);
|
|
39202
|
-
const x2 = ((_a3 = options.axes) == null ? void 0 : _a3.x)
|
|
39203
|
-
const y2 = ((_b2 = options.axes) == null ? void 0 : _b2.y)
|
|
39209
|
+
const x2 = Array.isArray((_a3 = options.axes) == null ? void 0 : _a3.x) ? options.axes.x : [];
|
|
39210
|
+
const y2 = Array.isArray((_b2 = options.axes) == null ? void 0 : _b2.y) ? options.axes.y : [];
|
|
39204
39211
|
const getAxisIndex = (axisID) => {
|
|
39205
39212
|
if (!axisID)
|
|
39206
39213
|
return 0;
|
|
@@ -39283,32 +39290,147 @@ const getBarChartToolTips = (options) => {
|
|
|
39283
39290
|
}
|
|
39284
39291
|
};
|
|
39285
39292
|
};
|
|
39286
|
-
const
|
|
39287
|
-
|
|
39288
|
-
|
|
39289
|
-
|
|
39290
|
-
|
|
39291
|
-
|
|
39292
|
-
|
|
39293
|
-
|
|
39294
|
-
|
|
39295
|
-
|
|
39293
|
+
const useBarChartOptions = ({
|
|
39294
|
+
chart: chart2,
|
|
39295
|
+
chartRef
|
|
39296
|
+
}) => {
|
|
39297
|
+
var _a2, _b2, _c2, _d2;
|
|
39298
|
+
const { options } = chart2;
|
|
39299
|
+
const { chartStyling, dragData } = options;
|
|
39300
|
+
const { legendClick, onClick, onHover, visibleAnnotationsIndexes } = useBarChartConfig({ chart: chart2, chartRef });
|
|
39301
|
+
return {
|
|
39302
|
+
onClick,
|
|
39303
|
+
onHover,
|
|
39304
|
+
indexAxis: isVertical(options.direction) ? AxisType.X : AxisType.Y,
|
|
39305
|
+
maintainAspectRatio: chartStyling.maintainAspectRatio,
|
|
39306
|
+
animation: chartStyling.performanceMode && {
|
|
39307
|
+
duration: ANIMATION_DURATION.FAST
|
|
39308
|
+
},
|
|
39309
|
+
hover: {
|
|
39310
|
+
mode: ChartHoverMode.Nearest,
|
|
39311
|
+
intersect: true
|
|
39312
|
+
},
|
|
39313
|
+
scales: getBarChartScales(chart2),
|
|
39314
|
+
plugins: {
|
|
39315
|
+
title: getTitle(options),
|
|
39316
|
+
datalabels: getBarChartDataLabels(options),
|
|
39317
|
+
annotation: getAnnotation(options, {
|
|
39318
|
+
showAnnotationLineIndex: visibleAnnotationsIndexes
|
|
39319
|
+
}),
|
|
39320
|
+
tooltip: getBarChartToolTips(options),
|
|
39321
|
+
legend: getLegend(options, legendClick),
|
|
39322
|
+
[CUSTOM_LEGEND_PLUGIN_NAME]: ((_b2 = (_a2 = options == null ? void 0 : options.legend) == null ? void 0 : _a2.customLegend) == null ? void 0 : _b2.customLegendPlugin) && {
|
|
39323
|
+
containerID: ((_d2 = (_c2 = options == null ? void 0 : options.legend) == null ? void 0 : _c2.customLegend) == null ? void 0 : _d2.customLegendContainerID) ?? ""
|
|
39324
|
+
},
|
|
39325
|
+
chartAreaBorder: {
|
|
39326
|
+
borderColor: BORDER_COLOR
|
|
39327
|
+
},
|
|
39328
|
+
dragData: (dragData == null ? void 0 : dragData.enableDragData) && getDraggableData(options)
|
|
39296
39329
|
}
|
|
39297
|
-
|
|
39298
|
-
|
|
39299
|
-
|
|
39300
|
-
|
|
39330
|
+
};
|
|
39331
|
+
};
|
|
39332
|
+
const chart = "_chart_1t41j_1";
|
|
39333
|
+
const fixedHeight = "_fixedHeight_1t41j_13";
|
|
39334
|
+
const stretchHeight = "_stretchHeight_1t41j_19";
|
|
39335
|
+
const zoomForm = "_zoomForm_1t41j_32";
|
|
39336
|
+
const zoomReset = "_zoomReset_1t41j_40";
|
|
39337
|
+
const help = "_help_1t41j_43";
|
|
39338
|
+
const autoWeight = "_autoWeight_1t41j_47";
|
|
39339
|
+
const styles = {
|
|
39340
|
+
chart,
|
|
39341
|
+
fixedHeight,
|
|
39342
|
+
stretchHeight,
|
|
39343
|
+
zoomForm,
|
|
39344
|
+
zoomReset,
|
|
39345
|
+
help,
|
|
39346
|
+
autoWeight
|
|
39347
|
+
};
|
|
39348
|
+
const defaultAxes = (axes) => ({
|
|
39349
|
+
x: (axes == null ? void 0 : axes.x) || [{}],
|
|
39350
|
+
y: (axes == null ? void 0 : axes.y) || [{}]
|
|
39351
|
+
});
|
|
39352
|
+
const defaultAdditionalAxesOptions = (options) => ({
|
|
39353
|
+
chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
|
|
39354
|
+
reverse: (options == null ? void 0 : options.reverse) || false,
|
|
39355
|
+
stacked: (options == null ? void 0 : options.stacked) || false,
|
|
39356
|
+
beginAtZero: (options == null ? void 0 : options.beginAtZero) ?? true,
|
|
39357
|
+
stepSize: options == null ? void 0 : options.stepSize,
|
|
39358
|
+
suggestedMin: options == null ? void 0 : options.suggestedMin,
|
|
39359
|
+
suggestedMax: options == null ? void 0 : options.suggestedMax,
|
|
39360
|
+
min: options == null ? void 0 : options.min,
|
|
39361
|
+
max: options == null ? void 0 : options.max
|
|
39362
|
+
});
|
|
39363
|
+
const defaultChartStyling = (styling) => ({
|
|
39364
|
+
width: styling == null ? void 0 : styling.width,
|
|
39365
|
+
height: styling == null ? void 0 : styling.height,
|
|
39366
|
+
maintainAspectRatio: (styling == null ? void 0 : styling.maintainAspectRatio) || false,
|
|
39367
|
+
staticChartHeight: (styling == null ? void 0 : styling.staticChartHeight) || false,
|
|
39368
|
+
performanceMode: (styling == null ? void 0 : styling.performanceMode) ?? true
|
|
39369
|
+
});
|
|
39370
|
+
const defaultTooltip = (tooltip) => ({
|
|
39371
|
+
tooltips: (tooltip == null ? void 0 : tooltip.tooltips) ?? true,
|
|
39372
|
+
showLabelsInTooltips: (tooltip == null ? void 0 : tooltip.showLabelsInTooltips) || false
|
|
39373
|
+
});
|
|
39374
|
+
const defaultGraph = (graph) => ({
|
|
39375
|
+
showDataLabels: (graph == null ? void 0 : graph.showDataLabels) || false,
|
|
39376
|
+
showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) || false
|
|
39377
|
+
});
|
|
39378
|
+
const defaultAnnotations = (annotations) => ({
|
|
39379
|
+
showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? true,
|
|
39380
|
+
controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) || false,
|
|
39381
|
+
annotationsData: (annotations == null ? void 0 : annotations.annotationsData) || []
|
|
39382
|
+
});
|
|
39383
|
+
const defaultLegend = (legend2) => ({
|
|
39384
|
+
display: (legend2 == null ? void 0 : legend2.display) ?? true,
|
|
39385
|
+
position: (legend2 == null ? void 0 : legend2.position) || Position.Bottom,
|
|
39386
|
+
align: (legend2 == null ? void 0 : legend2.align) || AlignOptions.Center,
|
|
39387
|
+
customLegend: (legend2 == null ? void 0 : legend2.customLegend) || {
|
|
39388
|
+
customLegendPlugin: null,
|
|
39389
|
+
customLegendContainerID: ""
|
|
39390
|
+
}
|
|
39391
|
+
});
|
|
39392
|
+
const defaultChartOptions = (options) => ({
|
|
39393
|
+
enableZoom: (options == null ? void 0 : options.enableZoom) || false,
|
|
39394
|
+
enablePan: (options == null ? void 0 : options.enablePan) || false
|
|
39395
|
+
});
|
|
39396
|
+
const defaultInteractions = (interactions) => ({
|
|
39397
|
+
onLegendClick: interactions == null ? void 0 : interactions.onLegendClick,
|
|
39398
|
+
onHover: interactions == null ? void 0 : interactions.onHover,
|
|
39399
|
+
onUnhover: interactions == null ? void 0 : interactions.onUnhover
|
|
39400
|
+
});
|
|
39401
|
+
const defaultDragData = (dragData) => ({
|
|
39402
|
+
enableDragData: (dragData == null ? void 0 : dragData.enableDragData) ?? false,
|
|
39403
|
+
showTooltip: (dragData == null ? void 0 : dragData.showTooltip) ?? true,
|
|
39404
|
+
roundPoints: (dragData == null ? void 0 : dragData.roundPoints) ?? true,
|
|
39405
|
+
dragX: (dragData == null ? void 0 : dragData.dragX) ?? true,
|
|
39406
|
+
dragY: (dragData == null ? void 0 : dragData.dragY) ?? true,
|
|
39407
|
+
onDragStart: dragData == null ? void 0 : dragData.onDragStart,
|
|
39408
|
+
onDrag: dragData == null ? void 0 : dragData.onDrag,
|
|
39409
|
+
onDragEnd: dragData == null ? void 0 : dragData.onDragEnd
|
|
39410
|
+
});
|
|
39411
|
+
const getDefaultProps = (props) => {
|
|
39412
|
+
const chart2 = (props == null ? void 0 : props.chart) || {};
|
|
39413
|
+
const options = (chart2 == null ? void 0 : chart2.options) || {};
|
|
39414
|
+
return {
|
|
39415
|
+
testId: (chart2 == null ? void 0 : chart2.testId) ?? "",
|
|
39416
|
+
data: chart2 == null ? void 0 : chart2.data,
|
|
39417
|
+
options: {
|
|
39418
|
+
title: (options == null ? void 0 : options.title) || "",
|
|
39419
|
+
direction: (options == null ? void 0 : options.direction) || "vertical",
|
|
39420
|
+
axes: defaultAxes(options == null ? void 0 : options.axes),
|
|
39421
|
+
additionalAxesOptions: defaultAdditionalAxesOptions(
|
|
39422
|
+
options == null ? void 0 : options.additionalAxesOptions
|
|
39423
|
+
),
|
|
39424
|
+
chartStyling: defaultChartStyling(options == null ? void 0 : options.chartStyling),
|
|
39425
|
+
tooltip: defaultTooltip(options == null ? void 0 : options.tooltip),
|
|
39426
|
+
graph: defaultGraph(options == null ? void 0 : options.graph),
|
|
39427
|
+
annotations: defaultAnnotations(options == null ? void 0 : options.annotations),
|
|
39428
|
+
legend: defaultLegend(options == null ? void 0 : options.legend),
|
|
39429
|
+
chartOptions: defaultChartOptions(options == null ? void 0 : options.chartOptions),
|
|
39430
|
+
interactions: defaultInteractions(options == null ? void 0 : options.interactions),
|
|
39431
|
+
dragData: defaultDragData(options == null ? void 0 : options.dragData)
|
|
39301
39432
|
}
|
|
39302
|
-
return dataLabel;
|
|
39303
39433
|
};
|
|
39304
|
-
const beginAtNotZeroAlign = reverse ? AlignOptions.End : AlignOptions.Start;
|
|
39305
|
-
const beginAtNotZeroAnchor = reverse ? AlignOptions.Start : AlignOptions.End;
|
|
39306
|
-
return ((_a2 = options == null ? void 0 : options.graph) == null ? void 0 : _a2.showDataLabels) ? {
|
|
39307
|
-
display: AUTO,
|
|
39308
|
-
align: beginAtZero ? AlignOptions.Center : beginAtNotZeroAlign,
|
|
39309
|
-
anchor: beginAtZero ? AlignOptions.Center : beginAtNotZeroAnchor,
|
|
39310
|
-
formatter: formatterCallback
|
|
39311
|
-
} : { display: false };
|
|
39312
39434
|
};
|
|
39313
39435
|
Chart$2.register(
|
|
39314
39436
|
LinearScale$1,
|
|
@@ -39325,108 +39447,14 @@ Chart$2.register(
|
|
|
39325
39447
|
Ht
|
|
39326
39448
|
);
|
|
39327
39449
|
const BarChart = (props) => {
|
|
39328
|
-
var _a2, _b2
|
|
39450
|
+
var _a2, _b2;
|
|
39329
39451
|
setDefaultTheme();
|
|
39330
39452
|
const chartRef = useRef(null);
|
|
39331
|
-
const [pointHover, setPointHover] = useState(false);
|
|
39332
39453
|
const chart2 = getDefaultProps(props);
|
|
39333
39454
|
const { options, testId } = chart2;
|
|
39334
|
-
const {
|
|
39335
|
-
const
|
|
39336
|
-
|
|
39337
|
-
);
|
|
39338
|
-
const generateBarChartDatasets = (datasets) => {
|
|
39339
|
-
var _a3;
|
|
39340
|
-
const barDatasetsCopy = [...datasets];
|
|
39341
|
-
if (annotations.controlAnnotation && annotations.showAnnotations && ((_a3 = annotations.annotationsData) == null ? void 0 : _a3.length)) {
|
|
39342
|
-
annotations.annotationsData.forEach(
|
|
39343
|
-
(annotation2, index2) => {
|
|
39344
|
-
barDatasetsCopy.push({
|
|
39345
|
-
isAnnotation: true,
|
|
39346
|
-
label: annotation2.label,
|
|
39347
|
-
annotationIndex: index2,
|
|
39348
|
-
backgroundColor: annotation2.color || COLORS[index2],
|
|
39349
|
-
borderColor: annotation2.color || COLORS[index2],
|
|
39350
|
-
data: [],
|
|
39351
|
-
type: ChartType.Bar
|
|
39352
|
-
});
|
|
39353
|
-
}
|
|
39354
|
-
);
|
|
39355
|
-
}
|
|
39356
|
-
const generatedDatasets2 = barDatasetsCopy.map((barDataset, index2) => {
|
|
39357
|
-
const colorSchema = COLORS;
|
|
39358
|
-
const colors2 = barDataset.data.map((_2, i2) => {
|
|
39359
|
-
const colorSelectionIndex = datasets.length > 1 ? index2 : i2;
|
|
39360
|
-
return colorSchema[colorSelectionIndex] || generateRandomColor(COLORS);
|
|
39361
|
-
});
|
|
39362
|
-
const backgroundColors = barDataset.backgroundColor || colors2.map((color2) => color2 + ALPHA_CHANEL);
|
|
39363
|
-
return {
|
|
39364
|
-
...barDataset,
|
|
39365
|
-
borderWidth: parseFloat(String(barDataset.borderWidth)) ?? 1,
|
|
39366
|
-
borderColor: barDataset.borderColor || colors2[index2],
|
|
39367
|
-
backgroundColor: backgroundColors
|
|
39368
|
-
};
|
|
39369
|
-
});
|
|
39370
|
-
return generatedDatasets2 || [];
|
|
39371
|
-
};
|
|
39372
|
-
const generatedDatasets = generateBarChartDatasets((_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets);
|
|
39373
|
-
const legendClick = (_e2, legendItem2) => {
|
|
39374
|
-
const index2 = (legendItem2 == null ? void 0 : legendItem2.datasetIndex) ?? null;
|
|
39375
|
-
const chartInstance = chartRef.current;
|
|
39376
|
-
if (chartInstance && index2 !== null) {
|
|
39377
|
-
const { datasets } = chartInstance.data;
|
|
39378
|
-
const dataset = datasets[index2];
|
|
39379
|
-
const meta = chartInstance.getDatasetMeta(index2);
|
|
39380
|
-
meta.hidden = meta.hidden === null ? !dataset.hidden : null;
|
|
39381
|
-
if (annotations.controlAnnotation && dataset.isAnnotation) {
|
|
39382
|
-
const { annotationIndex } = dataset;
|
|
39383
|
-
if (visibleAnnotationsIndices.includes(annotationIndex)) {
|
|
39384
|
-
setVisibleAnnotationsIndices(
|
|
39385
|
-
visibleAnnotationsIndices.filter((ann) => ann !== annotationIndex)
|
|
39386
|
-
);
|
|
39387
|
-
} else {
|
|
39388
|
-
setVisibleAnnotationsIndices([
|
|
39389
|
-
...visibleAnnotationsIndices,
|
|
39390
|
-
annotationIndex
|
|
39391
|
-
]);
|
|
39392
|
-
}
|
|
39393
|
-
}
|
|
39394
|
-
if (dataset.displayGroup) {
|
|
39395
|
-
datasets.forEach((ds, ix) => {
|
|
39396
|
-
if (ds.displayGroup !== dataset.displayGroup) {
|
|
39397
|
-
return;
|
|
39398
|
-
}
|
|
39399
|
-
chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
|
|
39400
|
-
});
|
|
39401
|
-
}
|
|
39402
|
-
if (interactions.onLegendClick) {
|
|
39403
|
-
interactions.onLegendClick(
|
|
39404
|
-
legendItem2 == null ? void 0 : legendItem2.text,
|
|
39405
|
-
(legendItem2 == null ? void 0 : legendItem2.hidden) ?? false
|
|
39406
|
-
);
|
|
39407
|
-
}
|
|
39408
|
-
chartInstance.update();
|
|
39409
|
-
}
|
|
39410
|
-
};
|
|
39411
|
-
const onClick = (_evt, _elements, chartInstance) => {
|
|
39412
|
-
chartInstance.resetZoom();
|
|
39413
|
-
};
|
|
39414
|
-
const onHover = (evt, hoveredItems) => {
|
|
39415
|
-
if (pointHover && !(hoveredItems == null ? void 0 : hoveredItems.length)) {
|
|
39416
|
-
setPointHover(false);
|
|
39417
|
-
if (interactions.onUnhover) {
|
|
39418
|
-
interactions.onUnhover(evt);
|
|
39419
|
-
}
|
|
39420
|
-
}
|
|
39421
|
-
if (!pointHover && (hoveredItems == null ? void 0 : hoveredItems.length)) {
|
|
39422
|
-
setPointHover(true);
|
|
39423
|
-
if (interactions.onHover) {
|
|
39424
|
-
const { index: index2, datasetIndex } = hoveredItems[0];
|
|
39425
|
-
const generatedDataset = generatedDatasets;
|
|
39426
|
-
interactions.onHover(evt, datasetIndex, index2, generatedDataset);
|
|
39427
|
-
}
|
|
39428
|
-
}
|
|
39429
|
-
};
|
|
39455
|
+
const { chartStyling, graph } = options;
|
|
39456
|
+
const { generatedDatasets } = useBarChartConfig({ chart: chart2, chartRef });
|
|
39457
|
+
const barChartOptions = useBarChartOptions({ chart: chart2, chartRef });
|
|
39430
39458
|
return /* @__PURE__ */ jsx(
|
|
39431
39459
|
"div",
|
|
39432
39460
|
{
|
|
@@ -39441,39 +39469,10 @@ const BarChart = (props) => {
|
|
|
39441
39469
|
{
|
|
39442
39470
|
ref: chartRef,
|
|
39443
39471
|
data: {
|
|
39444
|
-
labels: ((
|
|
39472
|
+
labels: ((_b2 = (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.labels) == null ? void 0 : _b2.length) ? chart2.data.labels : [""],
|
|
39445
39473
|
datasets: generatedDatasets
|
|
39446
39474
|
},
|
|
39447
|
-
options:
|
|
39448
|
-
onClick,
|
|
39449
|
-
onHover,
|
|
39450
|
-
indexAxis: isVertical(options.direction) ? AxisType.X : AxisType.Y,
|
|
39451
|
-
maintainAspectRatio: chartStyling.maintainAspectRatio,
|
|
39452
|
-
animation: chartStyling.performanceMode ? false : {
|
|
39453
|
-
duration: ANIMATION_DURATION.FAST
|
|
39454
|
-
},
|
|
39455
|
-
hover: {
|
|
39456
|
-
mode: ChartHoverMode.Nearest,
|
|
39457
|
-
intersect: true
|
|
39458
|
-
},
|
|
39459
|
-
scales: getBarChartScales(chart2),
|
|
39460
|
-
plugins: {
|
|
39461
|
-
title: getTitle(options),
|
|
39462
|
-
datalabels: getBarChartDataLabels(options),
|
|
39463
|
-
annotation: getAnnotation(options, {
|
|
39464
|
-
showAnnotationLineIndex: visibleAnnotationsIndices
|
|
39465
|
-
}),
|
|
39466
|
-
tooltip: getBarChartToolTips(options),
|
|
39467
|
-
legend: getLegend(options, legendClick),
|
|
39468
|
-
[CUSTOM_LEGEND_PLUGIN_NAME]: options.legend.customLegend.customLegendPlugin && {
|
|
39469
|
-
containerID: options.legend.customLegend.customLegendContainerID
|
|
39470
|
-
},
|
|
39471
|
-
chartAreaBorder: {
|
|
39472
|
-
borderColor: BORDER_COLOR
|
|
39473
|
-
},
|
|
39474
|
-
dragData: (dragData == null ? void 0 : dragData.enableDragData) && getDraggableData(options)
|
|
39475
|
-
}
|
|
39476
|
-
},
|
|
39475
|
+
options: barChartOptions,
|
|
39477
39476
|
plugins: getPlugins(graph, options.legend)
|
|
39478
39477
|
}
|
|
39479
39478
|
)
|
|
@@ -39492,7 +39491,7 @@ export {
|
|
|
39492
39491
|
try {
|
|
39493
39492
|
if (typeof document != "undefined") {
|
|
39494
39493
|
var elementStyle = document.createElement("style");
|
|
39495
|
-
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.
|
|
39494
|
+
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_fa3yo_1 {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n}\n._buttons_fa3yo_7 {\n display: flex;\n margin-left: auto;\n gap: 4px;\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_1t41j_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1t41j_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1t41j_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1t41j_1._fixedHeight_1t41j_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1t41j_1._stretchHeight_1t41j_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1t41j_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1t41j_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1t41j_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1t41j_32 ._zoomReset_1t41j_40 {\n margin-left: 10px;\n}\n._zoomForm_1t41j_32 ._help_1t41j_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1t41j_47 {\n width: auto;\n height: auto;\n}"));
|
|
39496
39495
|
document.head.appendChild(elementStyle);
|
|
39497
39496
|
}
|
|
39498
39497
|
} catch (e) {
|