@oliasoft-open-source/charts-library 3.8.1-beta-1 → 4.0.0-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/index.js +604 -677
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/components/bar-chart/bar-chart-default-props.d.ts +2 -73
  4. package/dist/src/components/bar-chart/bar-chart.interface.d.ts +36 -10
  5. package/dist/src/components/bar-chart/{get-bar-chart-data-labels.d.ts → utils/get-bar-chart-data-labels.d.ts} +1 -4
  6. package/dist/src/components/bar-chart/utils/get-bar-chart-scales.d.ts +3 -0
  7. package/dist/src/components/bar-chart/{get-bar-chart-tooltips.d.ts → utils/get-bar-chart-tooltips.d.ts} +1 -1
  8. package/dist/src/components/bar-chart/utils/use-bar-chart-config.d.ts +24 -0
  9. package/dist/src/components/common/common.interface.d.ts +7 -3
  10. package/dist/src/components/common/helpers/chart-border-plugin.d.ts +10 -2
  11. package/dist/src/components/common/helpers/chart-consts.d.ts +3 -3
  12. package/dist/src/components/common/helpers/chart-utils.d.ts +10 -12
  13. package/dist/src/components/common/helpers/get-chart-annotation.d.ts +0 -5
  14. package/dist/src/components/common/helpers/get-draggableData.d.ts +13 -13
  15. package/dist/src/components/common/helpers/range/estimate-data-series-have-close-values.d.ts +2 -4
  16. package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +3 -1
  17. package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +3 -3
  18. package/dist/src/components/line-chart/controls/line-options.d.ts +1 -2
  19. package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +11 -15
  20. package/dist/src/components/line-chart/hooks/use-chart-state.d.ts +0 -7
  21. package/dist/src/components/line-chart/hooks/use-generated-labels.d.ts +4 -1
  22. package/dist/src/components/line-chart/hooks/use-legend-state.d.ts +6 -5
  23. package/dist/src/components/line-chart/legend/legend-interface.d.ts +2 -2
  24. package/dist/src/components/line-chart/line-chart.interface.d.ts +25 -20
  25. package/dist/src/components/line-chart/line-chart.stories.d.ts +178 -199
  26. package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +2 -1
  27. package/dist/src/components/line-chart/utils/axis-scales/axis-scales.d.ts +5 -4
  28. package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.d.ts +2 -5
  29. package/dist/src/components/line-chart/utils/datalabels-alignment/datalabels-alignment.interface.d.ts +20 -0
  30. package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-condition.d.ts +3 -4
  31. package/dist/src/components/line-chart/utils/datalabels-alignment/get-alignment-data.d.ts +9 -9
  32. package/dist/src/components/line-chart/utils/datalabels-alignment/get-datalabels-position.d.ts +4 -4
  33. package/dist/src/components/line-chart/utils/generate-line-chart-datasets.d.ts +4 -3
  34. package/dist/src/components/line-chart/utils/get-axes-ranges-from-chart.d.ts +6 -10
  35. package/dist/src/components/line-chart/utils/get-generated-labels.d.ts +2 -1
  36. package/dist/src/components/line-chart/utils/get-line-chart-data-labels.d.ts +3 -2
  37. package/dist/src/components/line-chart/utils/get-line-chart-scales.d.ts +1 -6
  38. package/dist/src/components/line-chart/utils/get-line-chart-tooltips.d.ts +3 -5
  39. package/dist/src/components/line-chart/utils/line-chart-utils.d.ts +2 -9
  40. package/dist/src/components/pie-chart/pie-chart-defalut-props.interface.d.ts +53 -0
  41. package/dist/src/components/pie-chart/pie-chart-get-default-props.d.ts +2 -42
  42. package/dist/src/components/pie-chart/pie-chart.interface.d.ts +10 -2
  43. package/dist/src/components/pie-chart/use-pie-chart-config.d.ts +41 -0
  44. package/package.json +4 -3
  45. package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +0 -5
  46. package/dist/src/components/line-chart/controls/legend-options.d.ts +0 -1
  47. package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +0 -302
  48. package/dist/src/components/line-chart/utils/elipsis-annotation/ellipsis-annotation.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 = 13;
22338
- const DEFAULT_FONT_FAMILY = '"Lato", sans-serif';
22339
- const DEFAULT_COLOR = "rgba(0,0,0,.87)";
22337
+ const DEFAULT_FONT_SIZE = 12;
22338
+ const DEFAULT_FONT_FAMILY = '"Roobert", "Noto Sans", sans-serif';
22339
+ const DEFAULT_COLOR = "hsl(60, 10.34482759%, 12.5%)";
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, _args, options) {
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((_v, i2) => i2) : [];
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 : _a2.label;
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
- (axisObj, index2) => {
22590
- var _a3, _b3;
22591
- const id = generateAxisId(axisType, index2, axes[axisType].length > 1);
22592
- const customMin = (_a3 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _a3.min;
22593
- const customMax = (_b3 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _b3.max;
22594
- const { unit } = axisObj;
22595
- return {
22596
- id,
22597
- //only add custom axis ranges if defined:
22598
- ...customMin ? { min: customMin } : {},
22599
- ...customMax ? { max: customMax } : {},
22600
- ...unit ? { unit } : {}
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,6 +22645,56 @@ const initialState = ({ options, persistenceId }) => {
22641
22645
  initialAxesRanges: []
22642
22646
  };
22643
22647
  };
22648
+ const lineOnlyIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJjdXJyZW50Q29sb3IiIGhlaWdodD0iMWVtIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxZW0iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0ibTAgMGgxMnYxMmgtMTJ6Ii8+PC9jbGlwUGF0aD48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxwYXRoIGQ9Im0uNSA2LjV2LTFoMTF2MWMtNC4xNjEwNCAwLTYuNjM1NDkgMC0xMSAweiIvPjwvZz48L3N2Zz4=";
22649
+ const pointOnlyIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJjdXJyZW50Q29sb3IiIGhlaWdodD0iMWVtIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxZW0iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iNiIgY3k9IjYiIHI9IjIiLz48L3N2Zz4=";
22650
+ const lineAndPointIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJjdXJyZW50Q29sb3IiIGhlaWdodD0iMWVtIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxZW0iIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0ibTAgMGgxMnYxMmgtMTJ6Ii8+PC9jbGlwUGF0aD48ZyBjbGlwLXBhdGg9InVybCgjYSkiPjxwYXRoIGQ9Im03LjkzNyA2LjVjLS4xMTEyMi40MjkxMi0uMzYxNzkuODA5MTYtLjcxMjM3IDEuMDgwNDctLjM1MDU4LjI3MTMtLjc4MTMzLjQxODUtMS4yMjQ2My40MTg1cy0uODc0MDUtLjE0NzItMS4yMjQ2My0uNDE4NWMtLjM1MDU4LS4yNzEzMS0uNjAxMTUtLjY1MTM1LS43MTIzNy0xLjA4MDQ3aC0zLjU2M3YtMWgzLjU2M2MuMTExMjItLjQyOTEyLjM2MTc5LS44MDkxNi43MTIzNy0xLjA4MDQ2cy43ODEzMy0uNDE4NTEgMS4yMjQ2My0uNDE4NTEuODc0MDUuMTQ3MjEgMS4yMjQ2My40MTg1MS42MDExNS42NTEzNC43MTIzNyAxLjA4MDQ2aDMuNTYzdjF6Ii8+PC9nPjwvc3ZnPg==";
22651
+ const LineOptions = ({
22652
+ lineEnabled,
22653
+ onToggleLine,
22654
+ onTogglePoints,
22655
+ pointsEnabled,
22656
+ translations
22657
+ }) => {
22658
+ const options = [
22659
+ {
22660
+ label: translations.pointsLines,
22661
+ icon: /* @__PURE__ */ jsx(Icon, { icon: lineAndPointIcon }),
22662
+ selected: pointsEnabled && lineEnabled,
22663
+ onClick: () => {
22664
+ onTogglePoints();
22665
+ }
22666
+ },
22667
+ {
22668
+ label: translations.linesOnly,
22669
+ icon: /* @__PURE__ */ jsx(Icon, { icon: lineOnlyIcon }),
22670
+ selected: !pointsEnabled && lineEnabled,
22671
+ onClick: () => {
22672
+ onTogglePoints();
22673
+ onToggleLine();
22674
+ }
22675
+ },
22676
+ {
22677
+ label: translations.pointsOnly,
22678
+ icon: /* @__PURE__ */ jsx(Icon, { icon: pointOnlyIcon }),
22679
+ selected: pointsEnabled && !lineEnabled,
22680
+ onClick: () => {
22681
+ onToggleLine();
22682
+ }
22683
+ }
22684
+ ];
22685
+ const selectedOption = options.find((option) => option.selected);
22686
+ return /* @__PURE__ */ jsx(Tooltip$2, { text: selectedOption == null ? void 0 : selectedOption.label, placement: "bottom-start", children: /* @__PURE__ */ jsx(
22687
+ Button,
22688
+ {
22689
+ small: true,
22690
+ basic: true,
22691
+ colored: "muted",
22692
+ round: true,
22693
+ icon: selectedOption == null ? void 0 : selectedOption.icon,
22694
+ onClick: selectedOption == null ? void 0 : selectedOption.onClick
22695
+ }
22696
+ ) });
22697
+ };
22644
22698
  var DefaultContext = {
22645
22699
  color: void 0,
22646
22700
  size: void 0,
@@ -22714,96 +22768,27 @@ function IconBase(props) {
22714
22768
  return elem(conf);
22715
22769
  }) : elem(DefaultContext);
22716
22770
  }
22717
- function RiDragMove2Line(props) {
22718
- 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);
22719
- }
22720
- function RiLineChartLine(props) {
22721
- 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);
22722
- }
22723
- function RiRuler2Line(props) {
22724
- 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);
22771
+ function TbArrowsMove(props) {
22772
+ 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 9l3 3l-3 3" } }, { "tag": "path", "attr": { "d": "M15 12h6" } }, { "tag": "path", "attr": { "d": "M6 9l-3 3l3 3" } }, { "tag": "path", "attr": { "d": "M3 12h6" } }, { "tag": "path", "attr": { "d": "M9 18l3 3l3 -3" } }, { "tag": "path", "attr": { "d": "M12 15v6" } }, { "tag": "path", "attr": { "d": "M15 6l-3 -3l-3 3" } }, { "tag": "path", "attr": { "d": "M12 3v6" } }] })(props);
22725
22773
  }
22726
- function RiTableLine(props) {
22727
- 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);
22774
+ function TbBan(props) {
22775
+ 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": "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" } }, { "tag": "path", "attr": { "d": "M5.7 5.7l12.6 12.6" } }] })(props);
22728
22776
  }
22729
- function RiFileDownloadLine(props) {
22730
- 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);
22731
- }
22732
- function RiForbidLine(props) {
22733
- 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);
22734
- }
22735
- function RiZoomInLine(props) {
22736
- 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);
22737
- }
22738
- const lineOnlyIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjEyIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGNsaXBQYXRoIGlkPSJhIj48cGF0aCBkPSJtMCAwaDEydjEyaC0xMnoiLz48L2NsaXBQYXRoPjxnIGNsaXAtcGF0aD0idXJsKCNhKSI+PHBhdGggZD0ibS41IDYuNXYtMWgxMXYxYy00LjE2MTA0IDAtNi42MzU0OSAwLTExIDB6IiBmaWxsPSJjdXJyZW50Q29sb3IiLz48L2c+PC9zdmc+";
22739
- const pointOnlyIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjEyIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48Y2lyY2xlIGN4PSI2IiBjeT0iNiIgZmlsbD0iY3VycmVudENvbG9yIiByPSIyIi8+PC9zdmc+";
22740
- const lineAndPointIcon = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjEyIiB2aWV3Qm94PSIwIDAgMTIgMTIiIHdpZHRoPSIxMiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGNsaXBQYXRoIGlkPSJhIj48cGF0aCBkPSJtMCAwaDEydjEyaC0xMnoiLz48L2NsaXBQYXRoPjxnIGNsaXAtcGF0aD0idXJsKCNhKSI+PHBhdGggZD0ibTcuOTM3IDYuNWMtLjExMTIyLjQyOTEyLS4zNjE3OS44MDkxNi0uNzEyMzcgMS4wODA0Ny0uMzUwNTguMjcxMy0uNzgxMzMuNDE4NS0xLjIyNDYzLjQxODVzLS44NzQwNS0uMTQ3Mi0xLjIyNDYzLS40MTg1Yy0uMzUwNTgtLjI3MTMxLS42MDExNS0uNjUxMzUtLjcxMjM3LTEuMDgwNDdoLTMuNTYzdi0xaDMuNTYzYy4xMTEyMi0uNDI5MTIuMzYxNzktLjgwOTE2LjcxMjM3LTEuMDgwNDZzLjc4MTMzLS40MTg1MSAxLjIyNDYzLS40MTg1MS44NzQwNS4xNDcyMSAxLjIyNDYzLjQxODUxLjYwMTE1LjY1MTM0LjcxMjM3IDEuMDgwNDZoMy41NjN2MXoiIGZpbGw9ImN1cnJlbnRDb2xvciIvPjwvZz48L3N2Zz4=";
22741
- const LineOptions = ({
22742
- lineEnabled,
22743
- onToggleLine,
22744
- onTogglePoints,
22745
- pointsEnabled,
22746
- translations,
22747
- hasCustomOpt
22748
- }) => {
22749
- const options = [
22750
- {
22751
- label: translations.pointsLines,
22752
- icon: /* @__PURE__ */ jsx(Icon, { icon: lineAndPointIcon }),
22753
- selected: pointsEnabled && lineEnabled,
22754
- onClick: () => {
22755
- onTogglePoints();
22756
- }
22757
- },
22758
- {
22759
- label: translations.linesOnly,
22760
- icon: /* @__PURE__ */ jsx(Icon, { icon: lineOnlyIcon }),
22761
- selected: !pointsEnabled && lineEnabled,
22762
- onClick: () => {
22763
- onTogglePoints();
22764
- onToggleLine();
22765
- }
22766
- },
22767
- {
22768
- label: translations.pointsOnly,
22769
- icon: /* @__PURE__ */ jsx(Icon, { icon: pointOnlyIcon }),
22770
- selected: pointsEnabled && !lineEnabled,
22771
- onClick: () => {
22772
- onToggleLine();
22773
- }
22774
- }
22775
- ];
22776
- const selectedOption = options.find((option) => option.selected);
22777
- return /* @__PURE__ */ jsx(
22778
- Tooltip$2,
22779
- {
22780
- text: selectedOption == null ? void 0 : selectedOption.label,
22781
- placement: "bottom",
22782
- enabled: !hasCustomOpt,
22783
- children: /* @__PURE__ */ jsx(
22784
- Button,
22785
- {
22786
- small: true,
22787
- basic: true,
22788
- colored: "muted",
22789
- round: true,
22790
- icon: selectedOption == null ? void 0 : selectedOption.icon,
22791
- onClick: selectedOption == null ? void 0 : selectedOption.onClick,
22792
- disabled: hasCustomOpt
22793
- }
22794
- )
22795
- }
22796
- );
22797
- };
22798
22777
  function TbHandStop(props) {
22799
22778
  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);
22800
22779
  }
22801
22780
  function TbList(props) {
22802
22781
  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);
22803
22782
  }
22783
+ function TbRuler(props) {
22784
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M5 4h14a1 1 0 0 1 1 1v5a1 1 0 0 1 -1 1h-7a1 1 0 0 0 -1 1v7a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1" } }, { "tag": "path", "attr": { "d": "M4 8l2 0" } }, { "tag": "path", "attr": { "d": "M4 12l3 0" } }, { "tag": "path", "attr": { "d": "M4 16l2 0" } }, { "tag": "path", "attr": { "d": "M8 4l0 2" } }, { "tag": "path", "attr": { "d": "M12 4l0 3" } }, { "tag": "path", "attr": { "d": "M16 4l0 2" } }] })(props);
22785
+ }
22804
22786
  function TbX(props) {
22805
22787
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M18 6l-12 12" } }, { "tag": "path", "attr": { "d": "M6 6l12 12" } }] })(props);
22806
22788
  }
22789
+ function TbZoomIn(props) {
22790
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "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);
22791
+ }
22807
22792
  const DragOptions = ({
22808
22793
  onTogglePan,
22809
22794
  onToggleZoom,
@@ -22830,7 +22815,7 @@ const DragOptions = ({
22830
22815
  /* @__PURE__ */ jsx(Text, { children: "Drag to zoom" }),
22831
22816
  /* @__PURE__ */ jsx(Text, { small: true, muted: true, children: doubleClickToReset })
22832
22817
  ] }),
22833
- icon: /* @__PURE__ */ jsx(RiZoomInLine, {}),
22818
+ icon: /* @__PURE__ */ jsx(TbZoomIn, {}),
22834
22819
  selected: zoomEnabled,
22835
22820
  onClick: onToggleZoom
22836
22821
  },
@@ -22840,7 +22825,7 @@ const DragOptions = ({
22840
22825
  /* @__PURE__ */ jsx(Text, { children: "Drag to pan" }),
22841
22826
  /* @__PURE__ */ jsx(Text, { small: true, muted: true, children: orDoubleClickToCanvas })
22842
22827
  ] }),
22843
- icon: /* @__PURE__ */ jsx(RiDragMove2Line, {}),
22828
+ icon: /* @__PURE__ */ jsx(TbArrowsMove, {}),
22844
22829
  selected: panEnabled,
22845
22830
  onClick: onTogglePan
22846
22831
  },
@@ -22855,7 +22840,7 @@ const DragOptions = ({
22855
22840
  ] : [],
22856
22841
  {
22857
22842
  label: dragDisabled,
22858
- icon: /* @__PURE__ */ jsx(RiForbidLine, {}),
22843
+ icon: /* @__PURE__ */ jsx(TbBan, {}),
22859
22844
  selected: !zoomEnabled && !panEnabled && !enableDragPoints,
22860
22845
  onClick: onDisableDragOptions
22861
22846
  }
@@ -22892,8 +22877,8 @@ const DragOptions = ({
22892
22877
  }
22893
22878
  );
22894
22879
  };
22895
- const controls = "_controls_fa3yo_1";
22896
- const buttons = "_buttons_fa3yo_7";
22880
+ const controls = "_controls_gbo9q_1";
22881
+ const buttons = "_buttons_gbo9q_7";
22897
22882
  const styles$3 = {
22898
22883
  controls,
22899
22884
  buttons
@@ -23872,23 +23857,26 @@ const useChartFunctions = ({
23872
23857
  chartInstance == null ? void 0 : chartInstance.resetZoom();
23873
23858
  dispatch({ type: "RESET_AXES_RANGES" });
23874
23859
  }, [chartRef]);
23875
- const onHover = useCallback((hoveredPoint, setHoveredPoint) => {
23876
- return (evt, hoveredItems) => {
23877
- if (!(hoveredItems == null ? void 0 : hoveredItems.length) && onPointUnhover && hoveredPoint) {
23878
- setHoveredPoint(null);
23879
- onPointUnhover(evt);
23880
- }
23881
- if ((hoveredItems == null ? void 0 : hoveredItems.length) && onPointHover) {
23882
- const { index: index2, datasetIndex } = hoveredItems[0];
23883
- const dataset = generatedDatasets[datasetIndex];
23884
- const point = dataset == null ? void 0 : dataset.data[index2];
23885
- if (point && hoveredPoint !== point) {
23886
- setHoveredPoint(point);
23887
- onPointHover(evt, datasetIndex, index2, generatedDatasets);
23860
+ const onHover = useCallback(
23861
+ (hoveredPoint, setHoveredPoint) => {
23862
+ return (evt, hoveredItems) => {
23863
+ if (!(hoveredItems == null ? void 0 : hoveredItems.length) && onPointUnhover && hoveredPoint) {
23864
+ setHoveredPoint(null);
23865
+ onPointUnhover(evt);
23888
23866
  }
23889
- }
23890
- };
23891
- }, []);
23867
+ if ((hoveredItems == null ? void 0 : hoveredItems.length) && onPointHover) {
23868
+ const { index: index2, datasetIndex } = hoveredItems[0];
23869
+ const dataset = generatedDatasets[datasetIndex];
23870
+ const point = dataset == null ? void 0 : dataset.data[index2];
23871
+ if (point && hoveredPoint !== point) {
23872
+ setHoveredPoint(point);
23873
+ onPointHover(evt, datasetIndex, index2, generatedDatasets);
23874
+ }
23875
+ }
23876
+ };
23877
+ },
23878
+ []
23879
+ );
23892
23880
  const handleDownload = useCallback(() => {
23893
23881
  var _a2;
23894
23882
  const chart2 = chartRef.current;
@@ -23908,9 +23896,9 @@ const useChartFunctions = ({
23908
23896
  });
23909
23897
  }, [chartRef, state.axes]);
23910
23898
  const handleKeyDown = useCallback(
23911
- (evt) => {
23899
+ (event) => {
23912
23900
  var _a2, _b2, _c2, _d2, _e2;
23913
- if (evt.key === Key.Shift) {
23901
+ if (event.key === Key.Shift) {
23914
23902
  const chart2 = chartRef.current;
23915
23903
  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;
23916
23904
  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)) {
@@ -23923,9 +23911,9 @@ const useChartFunctions = ({
23923
23911
  [chartRef]
23924
23912
  );
23925
23913
  const handleKeyUp = useCallback(
23926
- (evt) => {
23914
+ (event) => {
23927
23915
  var _a2, _b2, _c2, _d2, _e2;
23928
- if (evt.key === Key.Shift) {
23916
+ if (event.key === Key.Shift) {
23929
23917
  const chart2 = chartRef.current;
23930
23918
  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;
23931
23919
  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)) {
@@ -23967,15 +23955,13 @@ const useChartFunctions = ({
23967
23955
  const updateAxesRangesFromChart = useCallback(() => {
23968
23956
  var _a2;
23969
23957
  const { scales = {} } = (chartRef == null ? void 0 : chartRef.current) || {};
23970
- const axes2 = (_a2 = Object.entries(scales)) == null ? void 0 : _a2.map(
23971
- ([key, { min, max }]) => {
23972
- return {
23973
- id: key,
23974
- min: min ?? 0,
23975
- max: max ?? 0
23976
- };
23977
- }
23978
- );
23958
+ const axes2 = (_a2 = Object.entries(scales)) == null ? void 0 : _a2.map(([key, { min, max }]) => {
23959
+ return {
23960
+ id: key,
23961
+ min: min ?? 0,
23962
+ max: max ?? 0
23963
+ };
23964
+ });
23979
23965
  dispatch({
23980
23966
  type: UPDATE_AXES_RANGES,
23981
23967
  payload: { axes: axes2 }
@@ -24175,7 +24161,6 @@ const AxesOptionsPopover = (optionsPopover) => {
24175
24161
  name: "min",
24176
24162
  value: min,
24177
24163
  error: minErrorMsg,
24178
- size: 5,
24179
24164
  width: "100%",
24180
24165
  onChange: (evt) => onEditValue({
24181
24166
  name: evt.target.name,
@@ -24192,7 +24177,6 @@ const AxesOptionsPopover = (optionsPopover) => {
24192
24177
  name: "max",
24193
24178
  value: max,
24194
24179
  error: maxErrorMsg,
24195
- size: 5,
24196
24180
  width: "100%",
24197
24181
  onChange: (evt) => onEditValue({
24198
24182
  name: evt.target.name,
@@ -24276,7 +24260,7 @@ const AxesOptions = (optionsPopover) => {
24276
24260
  return /* @__PURE__ */ jsx(
24277
24261
  Popover,
24278
24262
  {
24279
- placement: "bottom",
24263
+ placement: "bottom-start",
24280
24264
  overflowContainer: true,
24281
24265
  content: /* @__PURE__ */ jsx(
24282
24266
  AxesOptionsPopover,
@@ -24294,9 +24278,9 @@ const AxesOptions = (optionsPopover) => {
24294
24278
  Tooltip$2,
24295
24279
  {
24296
24280
  text: translations.axesOptions,
24297
- placement: "bottom",
24281
+ placement: "bottom-start",
24298
24282
  display: "flex",
24299
- children: /* @__PURE__ */ jsx(Button, { small: true, basic: true, colored: "muted", round: true, icon: /* @__PURE__ */ jsx(RiRuler2Line, {}) })
24283
+ children: /* @__PURE__ */ jsx(Button, { small: true, basic: true, colored: "muted", round: true, icon: /* @__PURE__ */ jsx(TbRuler, {}) })
24300
24284
  }
24301
24285
  )
24302
24286
  }
@@ -24311,27 +24295,6 @@ const ControlsPortal = ({
24311
24295
  }
24312
24296
  return children;
24313
24297
  };
24314
- const checkCustomOption = (data, customOptions) => {
24315
- if (isEmpty(data) || isEmpty(customOptions))
24316
- return false;
24317
- const checkOption = (dataset) => {
24318
- if (typeof customOptions === "string") {
24319
- return has(dataset, customOptions);
24320
- } else if (isArray$2(customOptions)) {
24321
- return some(customOptions, (option) => has(dataset, option));
24322
- } else {
24323
- return some(
24324
- Object.values(customOptions),
24325
- (option) => has(dataset, option)
24326
- );
24327
- }
24328
- };
24329
- if (isArray$2(data)) {
24330
- return some(data, (dataset) => checkOption(dataset));
24331
- } else {
24332
- return checkOption(data);
24333
- }
24334
- };
24335
24298
  const Controls = ({
24336
24299
  headerComponent,
24337
24300
  subheaderComponent,
@@ -24370,7 +24333,6 @@ const Controls = ({
24370
24333
  dispatch,
24371
24334
  generatedDatasets
24372
24335
  });
24373
- const hasCustomOpt = checkCustomOption(generatedDatasets, "hasCustomOpt");
24374
24336
  return /* @__PURE__ */ jsxs(Fragment, { children: [
24375
24337
  /* @__PURE__ */ jsxs("div", { className: styles$3.controls, children: [
24376
24338
  !!options.title && /* @__PURE__ */ jsx(Text, { bold: true, children: options.title }),
@@ -24396,8 +24358,7 @@ const Controls = ({
24396
24358
  pointsEnabled,
24397
24359
  onToggleLine,
24398
24360
  onTogglePoints,
24399
- translations,
24400
- hasCustomOpt
24361
+ translations
24401
24362
  }
24402
24363
  ),
24403
24364
  /* @__PURE__ */ jsx(
@@ -24412,7 +24373,7 @@ const Controls = ({
24412
24373
  basic: true,
24413
24374
  colored: "muted",
24414
24375
  round: true,
24415
- icon: /* @__PURE__ */ jsx(RiFileDownloadLine, {}),
24376
+ icon: "download",
24416
24377
  onClick: handleDownload
24417
24378
  }
24418
24379
  )
@@ -24445,7 +24406,7 @@ const Controls = ({
24445
24406
  basic: true,
24446
24407
  colored: "muted",
24447
24408
  round: true,
24448
- icon: showTable ? /* @__PURE__ */ jsx(RiLineChartLine, {}) : /* @__PURE__ */ jsx(RiTableLine, {}),
24409
+ icon: showTable ? "chart" : "table",
24449
24410
  onClick: onToggleTable
24450
24411
  }
24451
24412
  )
@@ -24663,15 +24624,15 @@ const useLegendState = ({
24663
24624
  );
24664
24625
  };
24665
24626
  const legendClick = useCallback(
24666
- (_e2, legendItem2) => {
24667
- const { datasetIndex } = legendItem2;
24627
+ (_2, legendItem2) => {
24628
+ const { datasetIndex = 0 } = legendItem2;
24668
24629
  const chartInstance = chartRef == null ? void 0 : chartRef.current;
24669
24630
  const { datasets } = (chartInstance == null ? void 0 : chartInstance.data) || {};
24670
- const dataset = datasets == null ? void 0 : datasets[datasetIndex];
24631
+ const dataset = (datasets == null ? void 0 : datasets[datasetIndex]) ?? {};
24671
24632
  const meta = chartInstance == null ? void 0 : chartInstance.getDatasetMeta(datasetIndex);
24672
24633
  const isDatasetVisible = (chartInstance == null ? void 0 : chartInstance.isDatasetVisible(datasetIndex)) ?? true;
24673
24634
  upsertHiddenState({
24674
- label: dataset.label,
24635
+ label: dataset.label ?? "",
24675
24636
  datasetIndex,
24676
24637
  hidden: isDatasetVisible
24677
24638
  });
@@ -24680,7 +24641,7 @@ const useLegendState = ({
24680
24641
  const { annotationIndex } = dataset;
24681
24642
  dispatch({ type: TOGGLE_ANNOTATION, payload: { annotationIndex } });
24682
24643
  }
24683
- if (dataset.displayGroup) {
24644
+ if (dataset == null ? void 0 : dataset.displayGroup) {
24684
24645
  datasets == null ? void 0 : datasets.forEach((ds, ix) => {
24685
24646
  if (ds.displayGroup !== dataset.displayGroup)
24686
24647
  return;
@@ -24690,7 +24651,8 @@ const useLegendState = ({
24690
24651
  });
24691
24652
  }
24692
24653
  if (onLegendClick) {
24693
- onLegendClick(legendItem2 == null ? void 0 : legendItem2.text, legendItem2.hidden);
24654
+ const legendState = legendItem2.hidden ?? false;
24655
+ onLegendClick(legendItem2 == null ? void 0 : legendItem2.text, legendState);
24694
24656
  }
24695
24657
  chartInstance == null ? void 0 : chartInstance.update();
24696
24658
  },
@@ -24762,7 +24724,7 @@ const LegendItems = ({
24762
24724
  {
24763
24725
  hidden: hiddenState,
24764
24726
  dataset: datasets[item.datasetIndex],
24765
- handleClick: (event) => legendClick(event, item)
24727
+ handleClick: (_2) => legendClick(_2, item)
24766
24728
  },
24767
24729
  `${item.datasetIndex}-hidden-${item.hidden}`
24768
24730
  );
@@ -24902,7 +24864,8 @@ const Legend2 = ({
24902
24864
  dispatch,
24903
24865
  generatedDatasets
24904
24866
  }) => {
24905
- const [resizeRef] = useMeasure$1();
24867
+ const [measureRef] = useMeasure$1();
24868
+ const resizeRef = measureRef;
24906
24869
  const panelRef = useRef(null);
24907
24870
  const chart2 = chartRef.current;
24908
24871
  const [legendPosition, setLegendPosition] = useState(options.legend.position);
@@ -25098,6 +25061,27 @@ const INIT_KEYS = {
25098
25061
  };
25099
25062
  const LOWER_BOUND = 1e-4;
25100
25063
  const UPPER_BOUND = 1e7;
25064
+ const checkCustomOption = (data, customOptions) => {
25065
+ if (isEmpty(data) || isEmpty(customOptions))
25066
+ return false;
25067
+ const checkOption = (dataset) => {
25068
+ if (typeof customOptions === "string") {
25069
+ return dataset && has(dataset, customOptions);
25070
+ } else if (isArray$2(customOptions)) {
25071
+ return dataset && some(customOptions, (option) => dataset && has(dataset, option));
25072
+ } else {
25073
+ return dataset && some(
25074
+ Object.values(customOptions),
25075
+ (option) => dataset && has(dataset, option)
25076
+ );
25077
+ }
25078
+ };
25079
+ if (isArray$2(data)) {
25080
+ return some(data, checkOption);
25081
+ } else {
25082
+ return checkOption(data);
25083
+ }
25084
+ };
25101
25085
  var CUSTOM_OPTION = /* @__PURE__ */ ((CUSTOM_OPTION2) => {
25102
25086
  CUSTOM_OPTION2["showLine"] = "showLine";
25103
25087
  CUSTOM_OPTION2["showPoints"] = "showPoints";
@@ -25145,8 +25129,8 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
25145
25129
  backgroundColor,
25146
25130
  pointBackgroundColor,
25147
25131
  borderDash,
25148
- showPoints = true,
25149
- showLine
25132
+ showPoints: customShowPoints,
25133
+ showLine: customShowLine
25150
25134
  } = line ?? {};
25151
25135
  const { lineEnabled, pointsEnabled, axes = [] } = state ?? {};
25152
25136
  const { lineTension, spanGaps } = graph ?? {};
@@ -25161,30 +25145,34 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
25161
25145
  data[2].x = Math.min(axesMax, endPoint.x);
25162
25146
  }
25163
25147
  }
25148
+ const hasCustomOpt = checkCustomOption(line, CUSTOM_OPTION);
25164
25149
  const filteredData = data.filter(Boolean) || [];
25165
25150
  const isSinglePoint = (filteredData == null ? void 0 : filteredData.length) === 1;
25166
- const linePointRadius = parseFloat(String(pointRadiusProp)) || DEFAULT_POINT_RADIUS;
25167
- const pointRadius = (pointsEnabled || isSinglePoint) && showPoints ? linePointRadius : 0;
25168
- const hoverRadius = parseFloat(String(pointHoverRadius)) || DEFAULT_HOVER_RADIUS;
25151
+ let pointState, lineState;
25152
+ if (hasCustomOpt) {
25153
+ pointState = customShowPoints !== void 0 ? customShowPoints : !customShowLine;
25154
+ lineState = customShowLine !== void 0 ? customShowLine : !customShowPoints;
25155
+ } else {
25156
+ pointState = pointsEnabled || isSinglePoint;
25157
+ lineState = lineEnabled;
25158
+ }
25159
+ const linePointRadius = parseFloat(pointRadiusProp) || DEFAULT_POINT_RADIUS;
25160
+ const hoverRadius = parseFloat(pointHoverRadius) || DEFAULT_HOVER_RADIUS;
25169
25161
  const indexedColor = COLORS[i2];
25170
- const hasCustomOpt = checkCustomOption(
25171
- line,
25172
- CUSTOM_OPTION
25173
- );
25174
25162
  return {
25175
25163
  ...line,
25176
25164
  label: line.label || `${label} ${i2 + 1}`,
25177
25165
  data: filteredData,
25178
- showLine: showLine ?? lineEnabled,
25166
+ showLine: lineState,
25179
25167
  lineTension,
25180
25168
  spanGaps,
25181
- borderWidth: parseFloat(String(borderWidth)) || DEFAULT_BORDER_WIDTH,
25169
+ borderWidth: parseFloat(borderWidth) || DEFAULT_BORDER_WIDTH,
25182
25170
  borderDash: borderDash || [],
25183
25171
  borderJoinStyle: BORDER_JOIN_STYLE,
25184
25172
  borderColor: borderColor ?? indexedColor ?? generateRandomColor(COLORS),
25185
25173
  backgroundColor: backgroundColor ?? DEFAULT_BACKGROUND_COLOR,
25186
25174
  pointBackgroundColor: pointBackgroundColor ?? indexedColor ?? generateRandomColor(COLORS),
25187
- pointRadius,
25175
+ pointRadius: pointState ? linePointRadius : 0,
25188
25176
  pointHoverRadius: hoverRadius,
25189
25177
  pointHitRadius: line.pointHitRadius ?? hoverRadius,
25190
25178
  ...hasCustomOpt ? { hasCustomOpt } : {}
@@ -25193,8 +25181,8 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
25193
25181
  };
25194
25182
  const calculateDelta$1 = (tickValue, ticks) => {
25195
25183
  let delta = ticks.length > 3 ? ticks[2].value - ticks[1].value : ticks[1].value - ticks[0].value;
25196
- if (Math.abs(delta) >= 1 && tickValue !== Math.floor(tickValue)) {
25197
- delta = tickValue - Math.floor(tickValue);
25184
+ if (Math.abs(delta) >= 1 && tickValue !== Math.floor(Number(tickValue))) {
25185
+ delta = Number(tickValue) - Math.floor(Number(tickValue));
25198
25186
  }
25199
25187
  return delta;
25200
25188
  };
@@ -25214,7 +25202,7 @@ const formatAxisLabelNumbers = (tickValue, ticks) => {
25214
25202
  }
25215
25203
  delta = calculateDelta$1(tickValue, ticks);
25216
25204
  }
25217
- const logDelta = Math.log10(Math.abs(delta));
25205
+ const logDelta = Math.log10(Math.abs(Number(delta)));
25218
25206
  const numDecimal = isNaN(logDelta) ? 1 : Math.max(Math.min(-1 * Math.floor(logDelta), 20), 0);
25219
25207
  const roundScientificCoefficient = numDecimal === 0 ? 1 : numDecimal;
25220
25208
  return displayNumber(round$2(tickValue, numDecimal), {
@@ -25226,13 +25214,16 @@ const getLineChartAxis = (options, axisType, state, currentScales, i2 = 0) => {
25226
25214
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
25227
25215
  const axisData = currentScales || options.axes[axisType][0] || {};
25228
25216
  const stateAxis = state == null ? void 0 : state.axes.filter(
25229
- (axis) => axis.id.startsWith(axisType)
25217
+ (axis) => {
25218
+ var _a3;
25219
+ return (_a3 = axis == null ? void 0 : axis.id) == null ? void 0 : _a3.startsWith(axisType);
25220
+ }
25230
25221
  )[i2];
25231
25222
  const ticksConfigFromProps = (_b2 = (_a2 = options == null ? void 0 : options.scales) == null ? void 0 : _a2[`${i2 === 0 ? axisType : axisType + i2}`]) == null ? void 0 : _b2.ticks;
25232
25223
  const { additionalAxesOptions } = options;
25233
25224
  const getTicks = () => {
25234
25225
  const isLogarithmic = (additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic;
25235
- const ticksFormattingCallback = (tick, _index, ticks2) => {
25226
+ const ticksFormattingCallback = (tick, _2, ticks2) => {
25236
25227
  return isLogarithmic ? LOGARITHMIC_STEPS.includes(tick) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
25237
25228
  };
25238
25229
  const stepSize = !isLogarithmic ? {
@@ -25245,7 +25236,7 @@ const getLineChartAxis = (options, axisType, state, currentScales, i2 = 0) => {
25245
25236
  //OW-10088 disable irregular axis ticks
25246
25237
  ...ticksConfigFromProps,
25247
25238
  font: {
25248
- size: 14
25239
+ size: DEFAULT_FONT_SIZE
25249
25240
  }
25250
25241
  };
25251
25242
  return ticks;
@@ -25272,17 +25263,14 @@ const getLineChartAxis = (options, axisType, state, currentScales, i2 = 0) => {
25272
25263
  };
25273
25264
  const getLineChartAxes = (options, axisType, state) => {
25274
25265
  const axesData = options.axes[axisType];
25275
- const axes = axesData.reduce(
25276
- (acc, curr, i2) => {
25277
- const axisData = curr;
25278
- axisData.color = curr.color || COLORS[i2] || generateRandomColor(COLORS);
25279
- axisData.position = curr.position || getAxisPosition(axisType, i2);
25280
- const axis = getLineChartAxis(options, axisType, state, axisData, i2);
25281
- const axisId = generateAxisId(axisType, i2, true);
25282
- return { ...acc, [axisId]: axis };
25283
- },
25284
- {}
25285
- );
25266
+ const axes = axesData.reduce((acc, curr, i2) => {
25267
+ const axisData = curr;
25268
+ axisData.color = curr.color || COLORS[i2] || generateRandomColor(COLORS);
25269
+ axisData.position = curr.position || getAxisPosition(axisType, i2);
25270
+ const axis = getLineChartAxis(options, axisType, state, axisData, i2);
25271
+ const axisId = generateAxisId(axisType, i2, true);
25272
+ return { ...acc, [axisId]: axis };
25273
+ }, {});
25286
25274
  return axes;
25287
25275
  };
25288
25276
  const getLineChartScales = (options, state) => {
@@ -25307,7 +25295,7 @@ const estimateDataSeriesHaveCloseValues = (generatedDatasets) => {
25307
25295
  const data = dataset == null ? void 0 : dataset.data;
25308
25296
  if (data && data.length) {
25309
25297
  const { x: xFirstCurrent, y: yFirstCurrent } = (data == null ? void 0 : data[0]) ?? {};
25310
- const { x: xLastCurrent, y: yLastCurrent } = data.at(-1) ?? {};
25298
+ const { x: xLastCurrent = 0, y: yLastCurrent = 0 } = data.at(-1) ?? {};
25311
25299
  const xFirstAcc = ((_a2 = acc == null ? void 0 : acc[xAxisId]) == null ? void 0 : _a2.xFirst) ?? xFirstCurrent;
25312
25300
  const xLastAcc = ((_b2 = acc == null ? void 0 : acc[xAxisId]) == null ? void 0 : _b2.xLast) ?? xLastCurrent;
25313
25301
  const yFirstAcc = ((_c2 = acc == null ? void 0 : acc[yAxisId]) == null ? void 0 : _c2.yFirst) ?? yFirstCurrent;
@@ -25405,10 +25393,7 @@ const getAxesDataFromMetasets = (chartRef, scalesKeys, annotationsData) => {
25405
25393
  }, {}));
25406
25394
  };
25407
25395
  const autoScale = (options, state, generatedDatasets, chartRef) => {
25408
- const {
25409
- additionalAxesOptions = {},
25410
- annotations: { annotationsData = [] } = {}
25411
- } = options || {};
25396
+ const { additionalAxesOptions, annotations: { annotationsData = [] } = {} } = options || {};
25412
25397
  const scales = getLineChartScales(options, state) || {};
25413
25398
  if (!(additionalAxesOptions == null ? void 0 : additionalAxesOptions.autoAxisPadding) && !estimateDataSeriesHaveCloseValues(generatedDatasets)) {
25414
25399
  return scales;
@@ -25420,7 +25405,8 @@ const autoScale = (options, state, generatedDatasets, chartRef) => {
25420
25405
  annotationsData
25421
25406
  );
25422
25407
  const adjustedScales = data && (scalesKeys == null ? void 0 : scalesKeys.reduce((acc, key) => {
25423
- const { min: propMin = void 0, max: propMax = void 0 } = scales[key];
25408
+ const scale = scales[key];
25409
+ const { min: propMin = void 0, max: propMax = void 0 } = scale;
25424
25410
  const { min, max } = getSuggestedAxisRange({
25425
25411
  data: data[key],
25426
25412
  beginAtZero: additionalAxesOptions == null ? void 0 : additionalAxesOptions.beginAtZero,
@@ -25428,7 +25414,7 @@ const autoScale = (options, state, generatedDatasets, chartRef) => {
25428
25414
  });
25429
25415
  const res = {
25430
25416
  [key]: {
25431
- ...scales[key],
25417
+ ...scale,
25432
25418
  min: propMin ?? min,
25433
25419
  max: propMax ?? max
25434
25420
  }
@@ -25439,15 +25425,20 @@ const autoScale = (options, state, generatedDatasets, chartRef) => {
25439
25425
  };
25440
25426
  const getCondition = (x2, y2, left2, right2, bottom2) => {
25441
25427
  const threshold = 100;
25442
- const overLeftSide = x2 - threshold <= left2;
25443
- const overRightSide = x2 + threshold >= right2;
25444
- const overBottomSide = x2 + threshold >= left2 && x2 + threshold < right2 && y2 + threshold >= bottom2;
25428
+ const safeX = x2 ?? 0;
25429
+ const safeY = y2 ?? 0;
25430
+ const safeLeft = left2 ?? 0;
25431
+ const safeRight = right2 ?? 0;
25432
+ const safeBottom = bottom2 ?? 0;
25433
+ const overLeftSide = safeX - threshold <= safeLeft;
25434
+ const overRightSide = safeX + threshold >= safeRight;
25435
+ const overBottomSide = safeX + threshold >= safeLeft && safeX + threshold < safeRight && safeY + threshold >= safeBottom;
25445
25436
  return { overLeftSide, overRightSide, overBottomSide };
25446
25437
  };
25447
25438
  const getAlignmentData = (context) => {
25448
25439
  var _a2;
25449
- const { chart: chart2 = {}, dataIndex = 0, datasetIndex = 0 } = context || {};
25450
- const { chartArea = {} } = chart2;
25440
+ const { chart: chart2, dataIndex = 0, datasetIndex = 0 } = context;
25441
+ const { chartArea } = chart2;
25451
25442
  const { left: left2 = null, right: right2 = null, bottom: bottom2 = null } = chartArea;
25452
25443
  const meta = chart2.getDatasetMeta(datasetIndex);
25453
25444
  const { x: x2 = null, y: y2 = null } = ((_a2 = meta == null ? void 0 : meta.data) == null ? void 0 : _a2[dataIndex]) || {};
@@ -25474,13 +25465,15 @@ const getLineChartDataLabels = (options) => {
25474
25465
  return options.graph.showDataLabels ? {
25475
25466
  display: AUTO,
25476
25467
  align: getPosition(),
25477
- formatter: (_value, context) => context.dataset.data[context.dataIndex].label || ""
25468
+ formatter: (_2, context) => context.dataset.data[context.dataIndex].label || ""
25478
25469
  } : { display: false };
25479
25470
  };
25480
25471
  const annotationEnter = (element, chart2) => {
25481
25472
  var _a2;
25482
25473
  if ((_a2 = element.options.scaleID) == null ? void 0 : _a2.includes(AxisType.X)) {
25483
- element.options.label.xAdjust = chart2.chartArea.left;
25474
+ if (element.options.label) {
25475
+ element.options.label.xAdjust = chart2.chartArea.left;
25476
+ }
25484
25477
  }
25485
25478
  element.options.borderWidth = BORDER_WIDTH.HOVERED;
25486
25479
  if (element.options.label) {
@@ -25503,7 +25496,7 @@ const annotationLeave = (element, chart2) => {
25503
25496
  };
25504
25497
  const generateAnnotations = (options, state) => {
25505
25498
  const { annotationsData } = (options == null ? void 0 : options.annotations) || {};
25506
- const annotations = annotationsData == null ? void 0 : annotationsData.reduce((acc, curr, i2) => {
25499
+ return annotationsData == null ? void 0 : annotationsData.reduce((acc, curr, i2) => {
25507
25500
  var _a2;
25508
25501
  if (!((_a2 = state == null ? void 0 : state.showAnnotationLineIndex) == null ? void 0 : _a2.includes(i2))) {
25509
25502
  return { ...acc };
@@ -25551,7 +25544,6 @@ const generateAnnotations = (options, state) => {
25551
25544
  };
25552
25545
  return { ...acc, [`annotation${i2 + 1}`]: annotation2 };
25553
25546
  }, {});
25554
- return annotations;
25555
25547
  };
25556
25548
  const getAnnotation = (options, state) => {
25557
25549
  const { showAnnotations, annotationsData } = (options == null ? void 0 : options.annotations) || {};
@@ -25572,13 +25564,16 @@ const customFormatNumber = (labelNumber) => {
25572
25564
  return displayNumber(roundByMagnitude(labelNumber), roundOptions);
25573
25565
  };
25574
25566
  const getLineChartToolTips = (options) => {
25575
- const getTooltipLabels = (dataset) => {
25576
- var _a2, _b2, _c2, _d2, _e2;
25577
- const xIndex = ((_a2 = dataset.xAxisID) == null ? void 0 : _a2.length) > 1 ? dataset.xAxisID[1] - 1 : 0;
25578
- const yIndex = ((_b2 = dataset.yAxisID) == null ? void 0 : _b2.length) > 1 ? dataset.yAxisID[1] - 1 : 0;
25567
+ const getTooltipLabels = ({
25568
+ xAxisID = "",
25569
+ yAxisID = ""
25570
+ }) => {
25571
+ var _a2, _b2, _c2;
25572
+ const xIndex = (xAxisID == null ? void 0 : xAxisID.length) > 1 ? Number(xAxisID[1]) - 1 : 0;
25573
+ const yIndex = (yAxisID == null ? void 0 : yAxisID.length) > 1 ? Number(yAxisID[1]) - 1 : 0;
25579
25574
  const xAxis = options.axes.x[xIndex];
25580
25575
  const yAxis = options.axes.y[yIndex];
25581
- if (((_e2 = (_d2 = (_c2 = options == null ? void 0 : options.axes) == null ? void 0 : _c2.x) == null ? void 0 : _d2[0]) == null ? void 0 : _e2.position) === Position.Top) {
25576
+ 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) {
25582
25577
  return {
25583
25578
  titleAxisLabel: (yAxis == null ? void 0 : yAxis.label) || "",
25584
25579
  valueAxisLabel: (xAxis == null ? void 0 : xAxis.label) || "",
@@ -25594,9 +25589,9 @@ const getLineChartToolTips = (options) => {
25594
25589
  };
25595
25590
  }
25596
25591
  };
25597
- const titleCallback = (tooltipItem, _data) => {
25592
+ const titleCallback = (tooltipItem) => {
25598
25593
  const labels = getTooltipLabels(tooltipItem[0].dataset);
25599
- const { titleLabel, titleAxisLabel } = labels;
25594
+ const { titleLabel, titleAxisLabel } = labels ?? {};
25600
25595
  const formattedValue = titleLabel === TooltipLabel.Y ? tooltipItem[0].parsed.y : tooltipItem[0].parsed.x;
25601
25596
  const roundedValue = customFormatNumber(formattedValue);
25602
25597
  return `${roundedValue} ${titleAxisLabel}`;
@@ -25605,7 +25600,7 @@ const getLineChartToolTips = (options) => {
25605
25600
  const { showLabelsInTooltips } = options.tooltip;
25606
25601
  let label = tooltipItem.dataset.label || "";
25607
25602
  const labels = getTooltipLabels(tooltipItem.dataset);
25608
- const { valueLabel, valueAxisLabel } = labels;
25603
+ const { valueLabel = "", valueAxisLabel = "" } = labels ?? {};
25609
25604
  const getTooltipItemValue = () => {
25610
25605
  const labelNumber = valueLabel === TooltipLabel.X ? tooltipItem.parsed.x : tooltipItem.parsed.y;
25611
25606
  return customFormatNumber(labelNumber);
@@ -25658,46 +25653,6 @@ const getDraggableData = (options) => {
25658
25653
  }
25659
25654
  } : {};
25660
25655
  };
25661
- const ellipseAnnotationsConfig = ({
25662
- data,
25663
- borderColor: pointBorderColor
25664
- }) => {
25665
- return data == null ? void 0 : data.map(({ ellipseOptions }, index2) => {
25666
- if (!ellipseOptions)
25667
- return;
25668
- const {
25669
- xMinPoint,
25670
- xMaxPoint,
25671
- yMinPoint,
25672
- yMaxPoint,
25673
- rotation,
25674
- borderColor = pointBorderColor,
25675
- backgroundColor = "rgba(0, 0, 0, 0)"
25676
- } = ellipseOptions ?? {};
25677
- return {
25678
- id: `ellipse${index2}`,
25679
- type: "ellipse",
25680
- xMin: xMinPoint,
25681
- xMax: xMaxPoint,
25682
- yMin: yMinPoint,
25683
- yMax: yMaxPoint,
25684
- rotation,
25685
- borderColor,
25686
- backgroundColor
25687
- };
25688
- }).filter(Boolean);
25689
- };
25690
- const ellipsisAnnotation = (datasets) => {
25691
- return datasets.flatMap((dataset) => ellipseAnnotationsConfig(dataset)).reduce(
25692
- (acc, annotation2) => {
25693
- if (annotation2) {
25694
- acc[annotation2.id] = annotation2;
25695
- }
25696
- return acc;
25697
- },
25698
- {}
25699
- );
25700
- };
25701
25656
  const useChartOptions = ({
25702
25657
  chartRef,
25703
25658
  state,
@@ -25728,7 +25683,9 @@ const useChartOptions = ({
25728
25683
  lineEnabled,
25729
25684
  showAnnotationLineIndex
25730
25685
  } = state;
25731
- const [hoveredPoint, setHoveredPoint] = useState(null);
25686
+ const [hoveredPoint, setHoveredPoint] = useState(
25687
+ null
25688
+ );
25732
25689
  const { updateAxesRangesFromChart, onHover } = useChartFunctions({
25733
25690
  chartRef,
25734
25691
  state,
@@ -25782,15 +25739,9 @@ const useChartOptions = ({
25782
25739
  }),
25783
25740
  [zoomEnabled]
25784
25741
  );
25785
- const mergedAnnotation = {
25786
- ...annotation2.annotations,
25787
- ...ellipsisAnnotation(generatedDatasets)
25788
- };
25789
25742
  const plugins = {
25790
25743
  datalabels,
25791
- annotation: {
25792
- annotations: mergedAnnotation
25793
- },
25744
+ annotation: annotation2,
25794
25745
  zoom: { pan: panOptions, zoom: zoomOptions },
25795
25746
  tooltip,
25796
25747
  legend: { ...legend2, display: false },
@@ -25830,7 +25781,8 @@ const useChartOptions = ({
25830
25781
  elements: {
25831
25782
  line: {
25832
25783
  pointStyle: PointStyle.Circle,
25833
- showLine: lineEnabled
25784
+ showLine: lineEnabled,
25785
+ tension: 0
25834
25786
  }
25835
25787
  },
25836
25788
  scales,
@@ -25846,7 +25798,7 @@ const useChartPlugins = ({ options, resetZoom: resetZoom2 }) => {
25846
25798
  debounce$3(() => {
25847
25799
  resetZoom2();
25848
25800
  }, 100),
25849
- // 300ms debounce delay
25801
+ // 100ms debounce delay
25850
25802
  [resetZoom2]
25851
25803
  );
25852
25804
  const handleDoubleClick = useCallback(
@@ -25872,7 +25824,7 @@ const getAxesRangesFromChart = (chartRef, axes) => {
25872
25824
  const { scales = {} } = chartRef.current || {};
25873
25825
  return Object.entries(scales).map(([key, { min, max }], i2) => {
25874
25826
  var _a2;
25875
- const axesArray = axes.x.concat(axes.y);
25827
+ const axesArray = [...axes.x, ...axes.y];
25876
25828
  const unit = (_a2 = axesArray == null ? void 0 : axesArray[i2]) == null ? void 0 : _a2.unit;
25877
25829
  return {
25878
25830
  id: key,
@@ -26393,29 +26345,15 @@ const getDefaultProps$1 = (props) => {
26393
26345
  }
26394
26346
  };
26395
26347
  };
26396
- Chart$2.register(
26397
- LinearScale$1,
26398
- CategoryScale$1,
26399
- LogarithmicScale$1,
26400
- ArcElement$1,
26401
- plugin_legend,
26402
- plugin_tooltip,
26403
- plugin_title,
26404
- index,
26405
- plugin$1,
26406
- plugin
26407
- );
26408
- const PieChart = (props) => {
26409
- setDefaultTheme();
26410
- const chart2 = getDefaultProps$1(props);
26411
- const chartRef = useRef(null);
26348
+ const usePieChartConfig = (chart2) => {
26412
26349
  const [pointHover, setPointHover] = useState(false);
26413
- const { data, options, testId } = chart2;
26350
+ const { data, options } = chart2;
26414
26351
  const generateDatasets = (datasets) => {
26352
+ var _a2;
26415
26353
  const copyDataset = [...datasets];
26416
26354
  if (options.graph.stacked) {
26417
26355
  const generatedDataset = {
26418
- label: copyDataset[0].label,
26356
+ label: ((_a2 = copyDataset == null ? void 0 : copyDataset[0]) == null ? void 0 : _a2.label) ?? "",
26419
26357
  backgroundColor: [],
26420
26358
  borderColor: [],
26421
26359
  borderWidth: Number(copyDataset[0].borderWidth) || 1,
@@ -26438,8 +26376,9 @@ const PieChart = (props) => {
26438
26376
  }
26439
26377
  const generatedDatasets2 = copyDataset.map(
26440
26378
  (pieDataset, index2) => {
26441
- const borderWidth = parseFloat(pieDataset.borderWidth) || "1";
26442
- const color2 = pieDataset.data.map((_pie, i2) => COLORS[i2]) || generateRandomColor(COLORS);
26379
+ const { borderWidth: inputBorderWidth = "1", data: data2 = [] } = pieDataset ?? {};
26380
+ const borderWidth = parseFloat(String(inputBorderWidth)) || 1;
26381
+ const color2 = data2.map((_2, i2) => COLORS[i2]) || generateRandomColor(COLORS);
26443
26382
  const borderColor = pieDataset.borderColor || color2;
26444
26383
  const backgroundColor = pieDataset.backgroundColor || color2.map((col) => col + `${99 - 11 * index2}`);
26445
26384
  return {
@@ -26459,49 +26398,18 @@ const PieChart = (props) => {
26459
26398
  text: chart2.options.title
26460
26399
  } : {};
26461
26400
  };
26462
- const legendClick = (_e2, legendItem2, legend2) => {
26463
- const chartInstance = legend2.chart;
26464
- const { datasets } = chartInstance.data;
26465
- const { index: index2 = 0, text = "", hidden = false } = legendItem2 || {};
26466
- if (options.graph.stacked) {
26467
- if (options.legend.useDataset) {
26468
- for (let i2 = 0; i2 < chartInstance.config._config.data.datasets[0].data.length; i2++) {
26469
- if (i2 % data.datasets.length === index2) {
26470
- const meta = chartInstance.getDatasetMeta(0);
26471
- const arc = meta.data[i2];
26472
- arc.hidden = !arc.hidden;
26473
- }
26474
- }
26475
- } else {
26476
- for (let i2 = 0; i2 < chartInstance.config._config.data.datasets[0].data.length; i2++) {
26477
- if (parseInt(String(i2 / data.datasets.length)) === index2) {
26478
- const meta = chartInstance.getDatasetMeta(0);
26479
- const arc = meta.data[i2];
26480
- arc.hidden = !arc.hidden;
26481
- }
26482
- }
26483
- }
26484
- } else {
26485
- if (options.legend.useDataset) {
26486
- const meta = chartInstance.getDatasetMeta(index2);
26487
- meta.hidden = !meta.hidden;
26488
- } else {
26489
- if (datasets.length > 1) {
26490
- for (let i2 = 0; i2 < data.datasets.length; i2++) {
26491
- const meta = chartInstance.getDatasetMeta(i2);
26492
- const arc = meta.data[index2];
26493
- arc.hidden = !arc.hidden;
26494
- }
26495
- } else {
26496
- const meta = chartInstance.getDatasetMeta(0);
26497
- const arc = meta.data[index2];
26498
- arc.hidden = !arc.hidden;
26499
- }
26401
+ const legendClick = (_2, legendItem2, legend2) => {
26402
+ var _a2;
26403
+ const { chart: chart22 } = legend2 ?? {};
26404
+ if (legendItem2 && chart22) {
26405
+ const { index: index2 = 0 } = legendItem2;
26406
+ chart22.toggleDataVisibility(index2);
26407
+ chart22.update();
26408
+ if ((_a2 = options.interactions) == null ? void 0 : _a2.onLegendClick) {
26409
+ const hidden = chart22.isDatasetVisible(index2);
26410
+ options.interactions.onLegendClick(legendItem2.text, !hidden);
26500
26411
  }
26501
26412
  }
26502
- if (options.interactions.onLegendClick)
26503
- options.interactions.onLegendClick(text, hidden);
26504
- chartInstance.update();
26505
26413
  };
26506
26414
  const onClick = (_evt, _elements, chartInstance) => {
26507
26415
  chartInstance.resetZoom();
@@ -26532,7 +26440,7 @@ const PieChart = (props) => {
26532
26440
  display: "auto",
26533
26441
  align: "center",
26534
26442
  anchor: "center",
26535
- formatter: (_value, context) => {
26443
+ formatter: (_2, context) => {
26536
26444
  if (context.chart.getDatasetMeta(
26537
26445
  options.graph.stacked ? 0 : context.datasetIndex
26538
26446
  ).data[context.dataIndex].hidden)
@@ -26551,66 +26459,11 @@ const PieChart = (props) => {
26551
26459
  };
26552
26460
  };
26553
26461
  const getLegend2 = () => {
26554
- const generateLabels = (chartInstance) => {
26555
- const meta = chartInstance.getDatasetMeta(0);
26556
- const getStyles = (dataset, i2) => {
26557
- const dataPoint = dataset.data[i2 % dataset.data.length];
26558
- const { label } = dataPoint;
26559
- const arc = meta.data[i2];
26560
- const text = arc.hidden ? "-".repeat(label.length) : label;
26561
- const backgroundColor = dataPoint == null ? void 0 : dataPoint.backgroundColor;
26562
- const borderColor = dataPoint == null ? void 0 : dataPoint.borderColor;
26563
- return {
26564
- text,
26565
- fillStyle: (Array.isArray(backgroundColor) ? backgroundColor[0] : backgroundColor) || COLORS[0] + `${99 - 20 * i2}`,
26566
- strokeStyle: (Array.isArray(borderColor) ? borderColor[0] : borderColor) || COLORS[0],
26567
- index: i2
26568
- };
26569
- };
26570
- let mappedData;
26571
- if (options.graph.stacked) {
26572
- if (options.legend.useDataset) {
26573
- mappedData = data.datasets.map(getStyles);
26574
- } else {
26575
- mappedData = data.labels.map((label, i2) => {
26576
- var _a2, _b2;
26577
- const arc = meta.data[parseInt(String(i2 * data.datasets.length))];
26578
- const text = arc.hidden ? "-".repeat(label.length) : label;
26579
- const backgroundColor = (_a2 = data.datasets[0]) == null ? void 0 : _a2.backgroundColor;
26580
- const borderColor = (_b2 = data.datasets[0]) == null ? void 0 : _b2.borderColor;
26581
- return {
26582
- text,
26583
- fillStyle: (Array.isArray(backgroundColor) ? backgroundColor[i2 % backgroundColor.length] : backgroundColor) || COLORS[i2] + "99",
26584
- strokeStyle: (Array.isArray(borderColor) ? borderColor[i2 % ((backgroundColor == null ? void 0 : backgroundColor.length) ?? 0)] : borderColor) || COLORS[i2],
26585
- index: i2
26586
- };
26587
- });
26588
- }
26589
- } else if (options.legend.useDataset) {
26590
- mappedData = data.datasets.map(getStyles);
26591
- } else {
26592
- mappedData = data.labels.map((label, i2) => {
26593
- var _a2, _b2;
26594
- const arc = meta.data[i2];
26595
- const text = arc.hidden ? "-".repeat(label.length) : label;
26596
- const backgroundColor = (_a2 = data.datasets[0]) == null ? void 0 : _a2.backgroundColor;
26597
- const borderColor = (_b2 = data.datasets[0]) == null ? void 0 : _b2.borderColor;
26598
- return {
26599
- text,
26600
- fillStyle: (Array.isArray(backgroundColor) ? backgroundColor[i2 % backgroundColor.length] : backgroundColor) || COLORS[i2] + "99",
26601
- strokeStyle: (Array.isArray(borderColor) ? borderColor[i2 % ((backgroundColor == null ? void 0 : backgroundColor.length) ?? 0)] : borderColor) || COLORS[i2],
26602
- index: i2
26603
- };
26604
- });
26605
- }
26606
- return mappedData;
26607
- };
26608
26462
  return {
26609
26463
  position: options.legend.position,
26610
26464
  display: options.legend.display,
26611
26465
  align: options.legend.align,
26612
26466
  labels: {
26613
- generateLabels,
26614
26467
  boxHeight: 6,
26615
26468
  boxWidth: 6,
26616
26469
  usePointStyle: true,
@@ -26652,17 +26505,54 @@ const PieChart = (props) => {
26652
26505
  usePointStyle: true
26653
26506
  };
26654
26507
  };
26655
- return /* @__PURE__ */ jsx(
26656
- "div",
26657
- {
26658
- className: cx(
26659
- styles$1.chart,
26660
- !options.chartStyling.width || !options.chartStyling.height ? options.chartStyling.staticChartHeight ? styles$1.fixedHeight : styles$1.stretchHeight : ""
26661
- ),
26662
- style: {
26663
- width: options.chartStyling.width || "auto",
26664
- height: options.chartStyling.height || "auto"
26665
- },
26508
+ return {
26509
+ generatedDatasets,
26510
+ getTitle: getTitle2,
26511
+ legendClick,
26512
+ onClick,
26513
+ onHover,
26514
+ getDatalabels,
26515
+ getLegend: getLegend2,
26516
+ getToolTips
26517
+ };
26518
+ };
26519
+ Chart$2.register(
26520
+ LinearScale$1,
26521
+ CategoryScale$1,
26522
+ LogarithmicScale$1,
26523
+ ArcElement$1,
26524
+ plugin_legend,
26525
+ plugin_tooltip,
26526
+ plugin_title,
26527
+ index,
26528
+ plugin$1,
26529
+ plugin
26530
+ );
26531
+ const PieChart = (props) => {
26532
+ setDefaultTheme();
26533
+ const chart2 = getDefaultProps$1(props);
26534
+ const chartRef = useRef(null);
26535
+ const { data, options, testId } = chart2;
26536
+ const {
26537
+ generatedDatasets,
26538
+ getTitle: getTitle2,
26539
+ onClick,
26540
+ onHover,
26541
+ getDatalabels,
26542
+ getLegend: getLegend2,
26543
+ getToolTips
26544
+ } = usePieChartConfig(chart2);
26545
+ return /* @__PURE__ */ jsx(
26546
+ "div",
26547
+ {
26548
+ className: cx(
26549
+ styles$1.chart,
26550
+ !options.chartStyling.width || !options.chartStyling.height ? options.chartStyling.staticChartHeight ? styles$1.fixedHeight : styles$1.stretchHeight : ""
26551
+ ),
26552
+ style: {
26553
+ width: options.chartStyling.width || "auto",
26554
+ height: options.chartStyling.height || "auto"
26555
+ },
26666
26556
  "data-testid": testId,
26667
26557
  children: /* @__PURE__ */ jsx(
26668
26558
  Pie,
@@ -39060,107 +38950,123 @@ const Ht = { id: "dragdata", afterInit: function(t) {
39060
38950
  return t.tooltip && t.tooltip.update(), false;
39061
38951
  } };
39062
38952
  Chart.register(Ht);
39063
- const chart = "_chart_1t41j_1";
39064
- const fixedHeight = "_fixedHeight_1t41j_13";
39065
- const stretchHeight = "_stretchHeight_1t41j_19";
39066
- const zoomForm = "_zoomForm_1t41j_32";
39067
- const zoomReset = "_zoomReset_1t41j_40";
39068
- const help = "_help_1t41j_43";
39069
- const autoWeight = "_autoWeight_1t41j_47";
39070
- const styles = {
39071
- chart,
39072
- fixedHeight,
39073
- stretchHeight,
39074
- zoomForm,
39075
- zoomReset,
39076
- help,
39077
- autoWeight
39078
- };
39079
- const defaultAxes = (axes) => ({
39080
- x: (axes == null ? void 0 : axes.x) || [{}],
39081
- y: (axes == null ? void 0 : axes.y) || [{}]
39082
- });
39083
- const defaultAdditionalAxesOptions = (options) => ({
39084
- chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
39085
- reverse: (options == null ? void 0 : options.reverse) || false,
39086
- stacked: (options == null ? void 0 : options.stacked) || false,
39087
- beginAtZero: (options == null ? void 0 : options.beginAtZero) ?? true,
39088
- stepSize: options == null ? void 0 : options.stepSize,
39089
- suggestedMin: options == null ? void 0 : options.suggestedMin,
39090
- suggestedMax: options == null ? void 0 : options.suggestedMax,
39091
- min: options == null ? void 0 : options.min,
39092
- max: options == null ? void 0 : options.max
39093
- });
39094
- const defaultChartStyling = (styling) => ({
39095
- width: styling == null ? void 0 : styling.width,
39096
- height: styling == null ? void 0 : styling.height,
39097
- maintainAspectRatio: (styling == null ? void 0 : styling.maintainAspectRatio) || false,
39098
- staticChartHeight: (styling == null ? void 0 : styling.staticChartHeight) || false,
39099
- performanceMode: (styling == null ? void 0 : styling.performanceMode) ?? true
39100
- });
39101
- const defaultTooltip = (tooltip) => ({
39102
- tooltips: (tooltip == null ? void 0 : tooltip.tooltips) ?? true,
39103
- showLabelsInTooltips: (tooltip == null ? void 0 : tooltip.showLabelsInTooltips) || false
39104
- });
39105
- const defaultGraph = (graph) => ({
39106
- showDataLabels: (graph == null ? void 0 : graph.showDataLabels) || false,
39107
- showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) || false
39108
- });
39109
- const defaultAnnotations = (annotations) => ({
39110
- showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? true,
39111
- controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) || false,
39112
- annotationsData: (annotations == null ? void 0 : annotations.annotationsData) || []
39113
- });
39114
- const defaultLegend = (legend2) => ({
39115
- display: (legend2 == null ? void 0 : legend2.display) ?? true,
39116
- position: (legend2 == null ? void 0 : legend2.position) || Position.Bottom,
39117
- align: (legend2 == null ? void 0 : legend2.align) || AlignOptions.Center,
39118
- customLegend: (legend2 == null ? void 0 : legend2.customLegend) || {
39119
- customLegendPlugin: null,
39120
- customLegendContainerID: ""
39121
- }
39122
- });
39123
- const defaultChartOptions = (options) => ({
39124
- enableZoom: (options == null ? void 0 : options.enableZoom) || false,
39125
- enablePan: (options == null ? void 0 : options.enablePan) || false
39126
- });
39127
- const defaultInteractions = (interactions) => ({
39128
- onLegendClick: interactions == null ? void 0 : interactions.onLegendClick,
39129
- onHover: interactions == null ? void 0 : interactions.onHover,
39130
- onUnhover: interactions == null ? void 0 : interactions.onUnhover
39131
- });
39132
- const defaultDragData = (dragData) => ({
39133
- enableDragData: (dragData == null ? void 0 : dragData.enableDragData) ?? false,
39134
- showTooltip: (dragData == null ? void 0 : dragData.showTooltip) ?? true,
39135
- roundPoints: (dragData == null ? void 0 : dragData.roundPoints) ?? true,
39136
- dragX: (dragData == null ? void 0 : dragData.dragX) ?? true,
39137
- dragY: (dragData == null ? void 0 : dragData.dragY) ?? true,
39138
- onDragStart: dragData == null ? void 0 : dragData.onDragStart,
39139
- onDrag: dragData == null ? void 0 : dragData.onDrag,
39140
- onDragEnd: dragData == null ? void 0 : dragData.onDragEnd
39141
- });
39142
- const getDefaultProps = (props) => {
39143
- const chart2 = (props == null ? void 0 : props.chart) || {};
39144
- const options = (chart2 == null ? void 0 : chart2.options) || {};
39145
- return {
39146
- testId: (chart2 == null ? void 0 : chart2.testId) ?? "",
39147
- data: chart2 == null ? void 0 : chart2.data,
39148
- options: {
39149
- title: (options == null ? void 0 : options.title) || "",
39150
- direction: (options == null ? void 0 : options.direction) || "vertical",
39151
- axes: defaultAxes(options == null ? void 0 : options.axes),
39152
- additionalAxesOptions: defaultAdditionalAxesOptions(
39153
- options == null ? void 0 : options.additionalAxesOptions
39154
- ),
39155
- chartStyling: defaultChartStyling(options == null ? void 0 : options.chartStyling),
39156
- tooltip: defaultTooltip(options == null ? void 0 : options.tooltip),
39157
- graph: defaultGraph(options == null ? void 0 : options.graph),
39158
- annotations: defaultAnnotations(options == null ? void 0 : options.annotations),
39159
- legend: defaultLegend(options == null ? void 0 : options.legend),
39160
- chartOptions: defaultChartOptions(options == null ? void 0 : options.chartOptions),
39161
- interactions: defaultInteractions(options == null ? void 0 : options.interactions),
39162
- dragData: defaultDragData(options == null ? void 0 : options.dragData)
38953
+ const useBarChartConfig = ({
38954
+ chart: chart2,
38955
+ chartRef
38956
+ }) => {
38957
+ var _a2;
38958
+ const { options } = chart2;
38959
+ const { annotations, interactions } = options;
38960
+ const [pointHover, setPointHover] = useState(false);
38961
+ const [visibleAnnotationsIndexes, setVisibleAnnotationsIndexes] = useState(
38962
+ setAnnotations(annotations.annotationsData)
38963
+ );
38964
+ const generateBarChartDatasets = ({
38965
+ datasets,
38966
+ options: options2
38967
+ }) => {
38968
+ const {
38969
+ annotations: { controlAnnotation, showAnnotations, annotationsData } = {}
38970
+ } = options2;
38971
+ const barDatasetsCopy = [...datasets];
38972
+ if (controlAnnotation && showAnnotations && (annotationsData == null ? void 0 : annotationsData.length)) {
38973
+ annotationsData.forEach(
38974
+ (annotation2, index2) => {
38975
+ barDatasetsCopy.push({
38976
+ isAnnotation: true,
38977
+ label: annotation2.label,
38978
+ annotationIndex: index2,
38979
+ backgroundColor: annotation2.color || COLORS[index2],
38980
+ borderColor: annotation2.color || COLORS[index2],
38981
+ data: [],
38982
+ type: ChartType.Bar
38983
+ });
38984
+ }
38985
+ );
39163
38986
  }
38987
+ const generatedDatasets2 = barDatasetsCopy.map((barDataset, index2) => {
38988
+ const colorSchema = COLORS;
38989
+ const colors2 = barDataset.data.map((_2, i2) => {
38990
+ const colorSelectionIndex = datasets.length > 1 ? index2 : i2;
38991
+ return colorSchema[colorSelectionIndex] || generateRandomColor(COLORS);
38992
+ });
38993
+ const backgroundColors = barDataset.backgroundColor || colors2.map((color2) => color2 + ALPHA_CHANEL);
38994
+ return {
38995
+ ...barDataset,
38996
+ borderWidth: parseFloat(String(barDataset.borderWidth)) ?? 1,
38997
+ borderColor: barDataset.borderColor || colors2[index2],
38998
+ backgroundColor: backgroundColors
38999
+ };
39000
+ });
39001
+ return generatedDatasets2 || [];
39002
+ };
39003
+ const generatedDatasets = generateBarChartDatasets({
39004
+ datasets: (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets,
39005
+ options
39006
+ });
39007
+ const legendClick = (_e2, legendItem2) => {
39008
+ const index2 = (legendItem2 == null ? void 0 : legendItem2.datasetIndex) ?? null;
39009
+ const chartInstance = chartRef.current;
39010
+ if (chartInstance && index2 !== null) {
39011
+ const { datasets } = chartInstance.data;
39012
+ const dataset = datasets[index2];
39013
+ const meta = chartInstance.getDatasetMeta(index2);
39014
+ meta.hidden = meta.hidden === null ? !dataset.hidden : null;
39015
+ if (annotations.controlAnnotation && dataset.isAnnotation) {
39016
+ const { annotationIndex } = dataset;
39017
+ if (visibleAnnotationsIndexes.includes(annotationIndex)) {
39018
+ setVisibleAnnotationsIndexes(
39019
+ visibleAnnotationsIndexes.filter((ann) => ann !== annotationIndex)
39020
+ );
39021
+ } else {
39022
+ setVisibleAnnotationsIndexes([
39023
+ ...visibleAnnotationsIndexes,
39024
+ annotationIndex
39025
+ ]);
39026
+ }
39027
+ }
39028
+ if (dataset.displayGroup) {
39029
+ datasets.forEach((ds, ix) => {
39030
+ if (ds.displayGroup !== dataset.displayGroup) {
39031
+ return;
39032
+ }
39033
+ chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
39034
+ });
39035
+ }
39036
+ if (interactions.onLegendClick) {
39037
+ interactions.onLegendClick(
39038
+ legendItem2 == null ? void 0 : legendItem2.text,
39039
+ (legendItem2 == null ? void 0 : legendItem2.hidden) ?? false
39040
+ );
39041
+ }
39042
+ chartInstance.update();
39043
+ }
39044
+ };
39045
+ const onClick = (_evt, _elements, chartInstance) => {
39046
+ chartInstance.resetZoom();
39047
+ };
39048
+ const onHover = (evt, hoveredItems) => {
39049
+ if (pointHover && !(hoveredItems == null ? void 0 : hoveredItems.length)) {
39050
+ setPointHover(false);
39051
+ if (interactions.onUnhover) {
39052
+ interactions.onUnhover(evt);
39053
+ }
39054
+ }
39055
+ if (!pointHover && (hoveredItems == null ? void 0 : hoveredItems.length)) {
39056
+ setPointHover(true);
39057
+ if (interactions.onHover) {
39058
+ const { index: index2, datasetIndex } = hoveredItems[0];
39059
+ const generatedDataset = generatedDatasets;
39060
+ interactions.onHover(evt, datasetIndex, index2, generatedDataset);
39061
+ }
39062
+ }
39063
+ };
39064
+ return {
39065
+ generatedDatasets,
39066
+ legendClick,
39067
+ onClick,
39068
+ onHover,
39069
+ visibleAnnotationsIndexes
39164
39070
  };
39165
39071
  };
39166
39072
  const getBarChartAxis = ({
@@ -39169,27 +39075,29 @@ const getBarChartAxis = ({
39169
39075
  currentScale,
39170
39076
  i: i2
39171
39077
  }) => {
39172
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2;
39078
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
39173
39079
  const isDirectionVertical = isVertical(chart2.options.direction);
39174
- const axisData = currentScale || chart2.options.axes[axisType][0];
39080
+ 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]);
39175
39081
  const isDirectionCompatibleWithAxisType = isDirectionVertical && axisType === AxisType.Y || !isDirectionVertical && axisType === AxisType.X;
39176
39082
  const grid = (axisData == null ? void 0 : axisData.gridLines) || {};
39177
39083
  const getScaleType = () => {
39084
+ var _a3, _b3;
39178
39085
  const scaleType = chart2.data.labels ? ScaleType.Category : ScaleType.Linear;
39179
39086
  const axisWithScale = isDirectionVertical ? AxisType.X : AxisType.Y;
39180
- return axisType === axisWithScale ? scaleType : chart2.options.additionalAxesOptions.chartScaleType;
39087
+ return axisType === axisWithScale ? scaleType : (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions) == null ? void 0 : _b3.chartScaleType;
39181
39088
  };
39182
39089
  const getReverse = () => {
39090
+ var _a3, _b3;
39183
39091
  const axisWithReverse = isDirectionVertical ? AxisType.Y : AxisType.X;
39184
- return axisType === axisWithReverse ? chart2.options.additionalAxesOptions.reverse : false;
39092
+ return axisType === axisWithReverse ? (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions) == null ? void 0 : _b3.reverse : false;
39185
39093
  };
39186
39094
  const getTicks = () => {
39187
39095
  var _a3, _b3, _c3, _d3;
39188
39096
  const additionalAxesOptions = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions;
39189
39097
  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;
39190
39098
  const isLogarithmic = isDirectionCompatibleWithAxisType && (additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic;
39191
- const ticksFormattingCallback = (tick, _index, ticks2) => {
39192
- return isLogarithmic ? LOGARITHMIC_STEPS.includes(tick) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
39099
+ const ticksFormattingCallback = (tick, _2, ticks2) => {
39100
+ return isLogarithmic ? LOGARITHMIC_STEPS.includes(Number(tick)) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
39193
39101
  };
39194
39102
  const stepSize = !isLogarithmic ? {
39195
39103
  stepSize: axisData.stepSize ?? (axisType === AxisType.Y ? additionalAxesOptions == null ? void 0 : additionalAxesOptions.stepSize : null)
@@ -39200,7 +39108,7 @@ const getBarChartAxis = ({
39200
39108
  //OW-10088 disable irregular axis ticks
39201
39109
  ...ticksConfigFromProps,
39202
39110
  font: {
39203
- size: 14
39111
+ size: DEFAULT_FONT_SIZE
39204
39112
  }
39205
39113
  };
39206
39114
  if ((additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic) {
@@ -39211,14 +39119,14 @@ const getBarChartAxis = ({
39211
39119
  return {
39212
39120
  type: getScaleType(),
39213
39121
  position: axisData == null ? void 0 : axisData.position,
39214
- beginAtZero: (_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.additionalAxesOptions) == null ? void 0 : _b2.beginAtZero,
39122
+ beginAtZero: (_e2 = (_d2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _d2.additionalAxesOptions) == null ? void 0 : _e2.beginAtZero,
39215
39123
  reverse: getReverse(),
39216
- suggestedMax: (_d2 = (_c2 = chart2.options) == null ? void 0 : _c2.additionalAxesOptions) == null ? void 0 : _d2.suggestedMax,
39217
- suggestedMin: (_f2 = (_e2 = chart2.options) == null ? void 0 : _e2.additionalAxesOptions) == null ? void 0 : _f2.suggestedMin,
39218
- min: isDirectionCompatibleWithAxisType ? (_h2 = (_g2 = chart2.options) == null ? void 0 : _g2.additionalAxesOptions) == null ? void 0 : _h2.min : void 0,
39219
- max: isDirectionCompatibleWithAxisType ? (_j2 = (_i2 = chart2.options) == null ? void 0 : _i2.additionalAxesOptions) == null ? void 0 : _j2.max : void 0,
39124
+ suggestedMax: (_g2 = (_f2 = chart2.options) == null ? void 0 : _f2.additionalAxesOptions) == null ? void 0 : _g2.suggestedMax,
39125
+ suggestedMin: (_i2 = (_h2 = chart2.options) == null ? void 0 : _h2.additionalAxesOptions) == null ? void 0 : _i2.suggestedMin,
39126
+ min: isDirectionCompatibleWithAxisType ? (_k2 = (_j2 = chart2.options) == null ? void 0 : _j2.additionalAxesOptions) == null ? void 0 : _k2.min : void 0,
39127
+ max: isDirectionCompatibleWithAxisType ? (_m2 = (_l2 = chart2.options) == null ? void 0 : _l2.additionalAxesOptions) == null ? void 0 : _m2.max : void 0,
39220
39128
  title: {
39221
- display: ((_k2 = axisData == null ? void 0 : axisData.label) == null ? void 0 : _k2.length) || ((_l2 = axisData == null ? void 0 : axisData.unit) == null ? void 0 : _l2.length),
39129
+ 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),
39222
39130
  text: (axisData == null ? void 0 : axisData.label) || (axisData == null ? void 0 : axisData.unit),
39223
39131
  padding: 0
39224
39132
  },
@@ -39226,7 +39134,7 @@ const getBarChartAxis = ({
39226
39134
  grid: {
39227
39135
  ...grid
39228
39136
  },
39229
- stacked: (_n2 = (_m2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _m2.additionalAxesOptions) == null ? void 0 : _n2.stacked
39137
+ stacked: (_q2 = (_p2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _p2.additionalAxesOptions) == null ? void 0 : _q2.stacked
39230
39138
  };
39231
39139
  };
39232
39140
  const getBarChartAxes = (chart2, axisType) => {
@@ -39257,13 +39165,40 @@ const getBarChartScales = (chart2) => {
39257
39165
  ...yAxesScales
39258
39166
  };
39259
39167
  };
39168
+ const getBarChartDataLabels = (options) => {
39169
+ var _a2;
39170
+ const { beginAtZero, reverse } = (options == null ? void 0 : options.additionalAxesOptions) || {};
39171
+ const formatterCallback = (_2, context) => {
39172
+ const { datasetIndex, dataIndex } = context;
39173
+ const dataset = context.chart.data.datasets[datasetIndex];
39174
+ const dataElement = dataset.data[dataIndex];
39175
+ let dataLabel = "";
39176
+ if (typeof dataElement === "number") {
39177
+ dataLabel = Number.isInteger(dataElement) ? dataElement : dataElement.toFixed(2);
39178
+ }
39179
+ if (Array.isArray(dataElement)) {
39180
+ dataLabel = dataElement.reduce((acc, curr, i2) => {
39181
+ return i2 === 0 ? `${acc} ${curr}` : `${acc}, ${curr}`;
39182
+ }, "");
39183
+ }
39184
+ return dataLabel;
39185
+ };
39186
+ const beginAtNotZeroAlign = reverse ? AlignOptions.End : AlignOptions.Start;
39187
+ const beginAtNotZeroAnchor = reverse ? AlignOptions.Start : AlignOptions.End;
39188
+ return ((_a2 = options == null ? void 0 : options.graph) == null ? void 0 : _a2.showDataLabels) ? {
39189
+ display: AUTO,
39190
+ align: beginAtZero ? AlignOptions.Center : beginAtNotZeroAlign,
39191
+ anchor: beginAtZero ? AlignOptions.Center : beginAtNotZeroAnchor,
39192
+ formatter: formatterCallback
39193
+ } : { display: false };
39194
+ };
39260
39195
  const getBarChartToolTips = (options) => {
39261
39196
  var _a2;
39262
39197
  const getTooltipLabels = (dataset) => {
39263
39198
  var _a3, _b2;
39264
39199
  const isDirectionVertical = isVertical(options.direction);
39265
- const x2 = ((_a3 = options.axes) == null ? void 0 : _a3.x) || [];
39266
- const y2 = ((_b2 = options.axes) == null ? void 0 : _b2.y) || [];
39200
+ const x2 = Array.isArray((_a3 = options.axes) == null ? void 0 : _a3.x) ? options.axes.x : [];
39201
+ const y2 = Array.isArray((_b2 = options.axes) == null ? void 0 : _b2.y) ? options.axes.y : [];
39267
39202
  const getAxisIndex = (axisID) => {
39268
39203
  if (!axisID)
39269
39204
  return 0;
@@ -39346,32 +39281,147 @@ const getBarChartToolTips = (options) => {
39346
39281
  }
39347
39282
  };
39348
39283
  };
39349
- const getBarChartDataLabels = (options) => {
39350
- var _a2;
39351
- const { beginAtZero, reverse } = (options == null ? void 0 : options.additionalAxesOptions) || {};
39352
- const formatterCallback = (_value, context) => {
39353
- const { datasetIndex, dataIndex } = context;
39354
- const dataset = context.chart.data.datasets[datasetIndex];
39355
- const dataElement = dataset.data[dataIndex];
39356
- let dataLabel = "";
39357
- if (typeof dataElement === "number") {
39358
- dataLabel = Number.isInteger(dataElement) ? dataElement : dataElement.toFixed(2);
39284
+ const useBarChartOptions = ({
39285
+ chart: chart2,
39286
+ chartRef
39287
+ }) => {
39288
+ var _a2, _b2, _c2, _d2;
39289
+ const { options } = chart2;
39290
+ const { chartStyling, dragData } = options;
39291
+ const { legendClick, onClick, onHover, visibleAnnotationsIndexes } = useBarChartConfig({ chart: chart2, chartRef });
39292
+ return {
39293
+ onClick,
39294
+ onHover,
39295
+ indexAxis: isVertical(options.direction) ? AxisType.X : AxisType.Y,
39296
+ maintainAspectRatio: chartStyling.maintainAspectRatio,
39297
+ animation: chartStyling.performanceMode && {
39298
+ duration: ANIMATION_DURATION.FAST
39299
+ },
39300
+ hover: {
39301
+ mode: ChartHoverMode.Nearest,
39302
+ intersect: true
39303
+ },
39304
+ scales: getBarChartScales(chart2),
39305
+ plugins: {
39306
+ title: getTitle(options),
39307
+ datalabels: getBarChartDataLabels(options),
39308
+ annotation: getAnnotation(options, {
39309
+ showAnnotationLineIndex: visibleAnnotationsIndexes
39310
+ }),
39311
+ tooltip: getBarChartToolTips(options),
39312
+ legend: getLegend(options, legendClick),
39313
+ [CUSTOM_LEGEND_PLUGIN_NAME]: ((_b2 = (_a2 = options == null ? void 0 : options.legend) == null ? void 0 : _a2.customLegend) == null ? void 0 : _b2.customLegendPlugin) && {
39314
+ containerID: ((_d2 = (_c2 = options == null ? void 0 : options.legend) == null ? void 0 : _c2.customLegend) == null ? void 0 : _d2.customLegendContainerID) ?? ""
39315
+ },
39316
+ chartAreaBorder: {
39317
+ borderColor: BORDER_COLOR
39318
+ },
39319
+ dragData: (dragData == null ? void 0 : dragData.enableDragData) && getDraggableData(options)
39359
39320
  }
39360
- if (Array.isArray(dataElement)) {
39361
- dataLabel = dataElement.reduce((acc, curr, i2) => {
39362
- return i2 === 0 ? `${acc} ${curr}` : `${acc}, ${curr}`;
39363
- }, "");
39321
+ };
39322
+ };
39323
+ const chart = "_chart_1t41j_1";
39324
+ const fixedHeight = "_fixedHeight_1t41j_13";
39325
+ const stretchHeight = "_stretchHeight_1t41j_19";
39326
+ const zoomForm = "_zoomForm_1t41j_32";
39327
+ const zoomReset = "_zoomReset_1t41j_40";
39328
+ const help = "_help_1t41j_43";
39329
+ const autoWeight = "_autoWeight_1t41j_47";
39330
+ const styles = {
39331
+ chart,
39332
+ fixedHeight,
39333
+ stretchHeight,
39334
+ zoomForm,
39335
+ zoomReset,
39336
+ help,
39337
+ autoWeight
39338
+ };
39339
+ const defaultAxes = (axes) => ({
39340
+ x: (axes == null ? void 0 : axes.x) || [{}],
39341
+ y: (axes == null ? void 0 : axes.y) || [{}]
39342
+ });
39343
+ const defaultAdditionalAxesOptions = (options) => ({
39344
+ chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
39345
+ reverse: (options == null ? void 0 : options.reverse) || false,
39346
+ stacked: (options == null ? void 0 : options.stacked) || false,
39347
+ beginAtZero: (options == null ? void 0 : options.beginAtZero) ?? true,
39348
+ stepSize: options == null ? void 0 : options.stepSize,
39349
+ suggestedMin: options == null ? void 0 : options.suggestedMin,
39350
+ suggestedMax: options == null ? void 0 : options.suggestedMax,
39351
+ min: options == null ? void 0 : options.min,
39352
+ max: options == null ? void 0 : options.max
39353
+ });
39354
+ const defaultChartStyling = (styling) => ({
39355
+ width: styling == null ? void 0 : styling.width,
39356
+ height: styling == null ? void 0 : styling.height,
39357
+ maintainAspectRatio: (styling == null ? void 0 : styling.maintainAspectRatio) || false,
39358
+ staticChartHeight: (styling == null ? void 0 : styling.staticChartHeight) || false,
39359
+ performanceMode: (styling == null ? void 0 : styling.performanceMode) ?? true
39360
+ });
39361
+ const defaultTooltip = (tooltip) => ({
39362
+ tooltips: (tooltip == null ? void 0 : tooltip.tooltips) ?? true,
39363
+ showLabelsInTooltips: (tooltip == null ? void 0 : tooltip.showLabelsInTooltips) || false
39364
+ });
39365
+ const defaultGraph = (graph) => ({
39366
+ showDataLabels: (graph == null ? void 0 : graph.showDataLabels) || false,
39367
+ showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) || false
39368
+ });
39369
+ const defaultAnnotations = (annotations) => ({
39370
+ showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? true,
39371
+ controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) || false,
39372
+ annotationsData: (annotations == null ? void 0 : annotations.annotationsData) || []
39373
+ });
39374
+ const defaultLegend = (legend2) => ({
39375
+ display: (legend2 == null ? void 0 : legend2.display) ?? true,
39376
+ position: (legend2 == null ? void 0 : legend2.position) || Position.Bottom,
39377
+ align: (legend2 == null ? void 0 : legend2.align) || AlignOptions.Center,
39378
+ customLegend: (legend2 == null ? void 0 : legend2.customLegend) || {
39379
+ customLegendPlugin: null,
39380
+ customLegendContainerID: ""
39381
+ }
39382
+ });
39383
+ const defaultChartOptions = (options) => ({
39384
+ enableZoom: (options == null ? void 0 : options.enableZoom) || false,
39385
+ enablePan: (options == null ? void 0 : options.enablePan) || false
39386
+ });
39387
+ const defaultInteractions = (interactions) => ({
39388
+ onLegendClick: interactions == null ? void 0 : interactions.onLegendClick,
39389
+ onHover: interactions == null ? void 0 : interactions.onHover,
39390
+ onUnhover: interactions == null ? void 0 : interactions.onUnhover
39391
+ });
39392
+ const defaultDragData = (dragData) => ({
39393
+ enableDragData: (dragData == null ? void 0 : dragData.enableDragData) ?? false,
39394
+ showTooltip: (dragData == null ? void 0 : dragData.showTooltip) ?? true,
39395
+ roundPoints: (dragData == null ? void 0 : dragData.roundPoints) ?? true,
39396
+ dragX: (dragData == null ? void 0 : dragData.dragX) ?? true,
39397
+ dragY: (dragData == null ? void 0 : dragData.dragY) ?? true,
39398
+ onDragStart: dragData == null ? void 0 : dragData.onDragStart,
39399
+ onDrag: dragData == null ? void 0 : dragData.onDrag,
39400
+ onDragEnd: dragData == null ? void 0 : dragData.onDragEnd
39401
+ });
39402
+ const getDefaultProps = (props) => {
39403
+ const chart2 = (props == null ? void 0 : props.chart) || {};
39404
+ const options = (chart2 == null ? void 0 : chart2.options) || {};
39405
+ return {
39406
+ testId: (chart2 == null ? void 0 : chart2.testId) ?? "",
39407
+ data: chart2 == null ? void 0 : chart2.data,
39408
+ options: {
39409
+ title: (options == null ? void 0 : options.title) || "",
39410
+ direction: (options == null ? void 0 : options.direction) || "vertical",
39411
+ axes: defaultAxes(options == null ? void 0 : options.axes),
39412
+ additionalAxesOptions: defaultAdditionalAxesOptions(
39413
+ options == null ? void 0 : options.additionalAxesOptions
39414
+ ),
39415
+ chartStyling: defaultChartStyling(options == null ? void 0 : options.chartStyling),
39416
+ tooltip: defaultTooltip(options == null ? void 0 : options.tooltip),
39417
+ graph: defaultGraph(options == null ? void 0 : options.graph),
39418
+ annotations: defaultAnnotations(options == null ? void 0 : options.annotations),
39419
+ legend: defaultLegend(options == null ? void 0 : options.legend),
39420
+ chartOptions: defaultChartOptions(options == null ? void 0 : options.chartOptions),
39421
+ interactions: defaultInteractions(options == null ? void 0 : options.interactions),
39422
+ dragData: defaultDragData(options == null ? void 0 : options.dragData)
39364
39423
  }
39365
- return dataLabel;
39366
39424
  };
39367
- const beginAtNotZeroAlign = reverse ? AlignOptions.End : AlignOptions.Start;
39368
- const beginAtNotZeroAnchor = reverse ? AlignOptions.Start : AlignOptions.End;
39369
- return ((_a2 = options == null ? void 0 : options.graph) == null ? void 0 : _a2.showDataLabels) ? {
39370
- display: AUTO,
39371
- align: beginAtZero ? AlignOptions.Center : beginAtNotZeroAlign,
39372
- anchor: beginAtZero ? AlignOptions.Center : beginAtNotZeroAnchor,
39373
- formatter: formatterCallback
39374
- } : { display: false };
39375
39425
  };
39376
39426
  Chart$2.register(
39377
39427
  LinearScale$1,
@@ -39388,108 +39438,14 @@ Chart$2.register(
39388
39438
  Ht
39389
39439
  );
39390
39440
  const BarChart = (props) => {
39391
- var _a2, _b2, _c2;
39441
+ var _a2, _b2;
39392
39442
  setDefaultTheme();
39393
39443
  const chartRef = useRef(null);
39394
- const [pointHover, setPointHover] = useState(false);
39395
39444
  const chart2 = getDefaultProps(props);
39396
39445
  const { options, testId } = chart2;
39397
- const { annotations, chartStyling, interactions, graph, dragData } = chart2.options;
39398
- const [visibleAnnotationsIndices, setVisibleAnnotationsIndices] = useState(
39399
- setAnnotations(annotations.annotationsData)
39400
- );
39401
- const generateBarChartDatasets = (datasets) => {
39402
- var _a3;
39403
- const barDatasetsCopy = [...datasets];
39404
- if (annotations.controlAnnotation && annotations.showAnnotations && ((_a3 = annotations.annotationsData) == null ? void 0 : _a3.length)) {
39405
- annotations.annotationsData.forEach(
39406
- (annotation2, index2) => {
39407
- barDatasetsCopy.push({
39408
- isAnnotation: true,
39409
- label: annotation2.label,
39410
- annotationIndex: index2,
39411
- backgroundColor: annotation2.color || COLORS[index2],
39412
- borderColor: annotation2.color || COLORS[index2],
39413
- data: [],
39414
- type: ChartType.Bar
39415
- });
39416
- }
39417
- );
39418
- }
39419
- const generatedDatasets2 = barDatasetsCopy.map((barDataset, index2) => {
39420
- const colorSchema = COLORS;
39421
- const colors2 = barDataset.data.map((_2, i2) => {
39422
- const colorSelectionIndex = datasets.length > 1 ? index2 : i2;
39423
- return colorSchema[colorSelectionIndex] || generateRandomColor(COLORS);
39424
- });
39425
- const backgroundColors = barDataset.backgroundColor || colors2.map((color2) => color2 + ALPHA_CHANEL);
39426
- return {
39427
- ...barDataset,
39428
- borderWidth: parseFloat(String(barDataset.borderWidth)) ?? 1,
39429
- borderColor: barDataset.borderColor || colors2[index2],
39430
- backgroundColor: backgroundColors
39431
- };
39432
- });
39433
- return generatedDatasets2 || [];
39434
- };
39435
- const generatedDatasets = generateBarChartDatasets((_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets);
39436
- const legendClick = (_e2, legendItem2) => {
39437
- const index2 = (legendItem2 == null ? void 0 : legendItem2.datasetIndex) ?? null;
39438
- const chartInstance = chartRef.current;
39439
- if (chartInstance && index2 !== null) {
39440
- const { datasets } = chartInstance.data;
39441
- const dataset = datasets[index2];
39442
- const meta = chartInstance.getDatasetMeta(index2);
39443
- meta.hidden = meta.hidden === null ? !dataset.hidden : null;
39444
- if (annotations.controlAnnotation && dataset.isAnnotation) {
39445
- const { annotationIndex } = dataset;
39446
- if (visibleAnnotationsIndices.includes(annotationIndex)) {
39447
- setVisibleAnnotationsIndices(
39448
- visibleAnnotationsIndices.filter((ann) => ann !== annotationIndex)
39449
- );
39450
- } else {
39451
- setVisibleAnnotationsIndices([
39452
- ...visibleAnnotationsIndices,
39453
- annotationIndex
39454
- ]);
39455
- }
39456
- }
39457
- if (dataset.displayGroup) {
39458
- datasets.forEach((ds, ix) => {
39459
- if (ds.displayGroup !== dataset.displayGroup) {
39460
- return;
39461
- }
39462
- chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
39463
- });
39464
- }
39465
- if (interactions.onLegendClick) {
39466
- interactions.onLegendClick(
39467
- legendItem2 == null ? void 0 : legendItem2.text,
39468
- (legendItem2 == null ? void 0 : legendItem2.hidden) ?? false
39469
- );
39470
- }
39471
- chartInstance.update();
39472
- }
39473
- };
39474
- const onClick = (_evt, _elements, chartInstance) => {
39475
- chartInstance.resetZoom();
39476
- };
39477
- const onHover = (evt, hoveredItems) => {
39478
- if (pointHover && !(hoveredItems == null ? void 0 : hoveredItems.length)) {
39479
- setPointHover(false);
39480
- if (interactions.onUnhover) {
39481
- interactions.onUnhover(evt);
39482
- }
39483
- }
39484
- if (!pointHover && (hoveredItems == null ? void 0 : hoveredItems.length)) {
39485
- setPointHover(true);
39486
- if (interactions.onHover) {
39487
- const { index: index2, datasetIndex } = hoveredItems[0];
39488
- const generatedDataset = generatedDatasets;
39489
- interactions.onHover(evt, datasetIndex, index2, generatedDataset);
39490
- }
39491
- }
39492
- };
39446
+ const { chartStyling, graph } = options;
39447
+ const { generatedDatasets } = useBarChartConfig({ chart: chart2, chartRef });
39448
+ const barChartOptions = useBarChartOptions({ chart: chart2, chartRef });
39493
39449
  return /* @__PURE__ */ jsx(
39494
39450
  "div",
39495
39451
  {
@@ -39504,39 +39460,10 @@ const BarChart = (props) => {
39504
39460
  {
39505
39461
  ref: chartRef,
39506
39462
  data: {
39507
- labels: ((_c2 = (_b2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _b2.labels) == null ? void 0 : _c2.length) ? chart2.data.labels : [""],
39463
+ labels: ((_b2 = (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.labels) == null ? void 0 : _b2.length) ? chart2.data.labels : [""],
39508
39464
  datasets: generatedDatasets
39509
39465
  },
39510
- options: {
39511
- onClick,
39512
- onHover,
39513
- indexAxis: isVertical(options.direction) ? AxisType.X : AxisType.Y,
39514
- maintainAspectRatio: chartStyling.maintainAspectRatio,
39515
- animation: chartStyling.performanceMode ? false : {
39516
- duration: ANIMATION_DURATION.FAST
39517
- },
39518
- hover: {
39519
- mode: ChartHoverMode.Nearest,
39520
- intersect: true
39521
- },
39522
- scales: getBarChartScales(chart2),
39523
- plugins: {
39524
- title: getTitle(options),
39525
- datalabels: getBarChartDataLabels(options),
39526
- annotation: getAnnotation(options, {
39527
- showAnnotationLineIndex: visibleAnnotationsIndices
39528
- }),
39529
- tooltip: getBarChartToolTips(options),
39530
- legend: getLegend(options, legendClick),
39531
- [CUSTOM_LEGEND_PLUGIN_NAME]: options.legend.customLegend.customLegendPlugin && {
39532
- containerID: options.legend.customLegend.customLegendContainerID
39533
- },
39534
- chartAreaBorder: {
39535
- borderColor: BORDER_COLOR
39536
- },
39537
- dragData: (dragData == null ? void 0 : dragData.enableDragData) && getDraggableData(options)
39538
- }
39539
- },
39466
+ options: barChartOptions,
39540
39467
  plugins: getPlugins(graph, options.legend)
39541
39468
  }
39542
39469
  )
@@ -39555,7 +39482,7 @@ export {
39555
39482
  try {
39556
39483
  if (typeof document != "undefined") {
39557
39484
  var elementStyle = document.createElement("style");
39558
- 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}"));
39485
+ elementStyle.appendChild(document.createTextNode("html[data-theme='dark'] ._chart_e3qdd_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_e3qdd_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_e3qdd_1._fixedHeight_e3qdd_20 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_e3qdd_1._stretchHeight_e3qdd_26 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_e3qdd_1._squareAspectRatio_e3qdd_32 {\n aspect-ratio: 1;\n min-height: 0;\n min-width: 0;\n}\n._chart_e3qdd_1:focus {\n outline: none;\n}\n._chart_e3qdd_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_e3qdd_43 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_e3qdd_43 ._zoomReset_e3qdd_51 {\n margin-left: 10px;\n}\n._zoomForm_e3qdd_43 ._help_e3qdd_54 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_e3qdd_58 {\n width: auto;\n height: auto;\n}\n._table_e3qdd_62 {\n overflow: auto;\n}\n._controls_gbo9q_1 {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: var(--padding-xs);\n}\n._buttons_gbo9q_7 {\n display: flex;\n align-items: flex-start;\n margin-left: auto;\n gap: var(--padding-xxs);\n}\n._legend_wpro0_1 {\n position: absolute;\n opacity: 0.9;\n display: flex;\n flex-direction: column;\n z-index: 1;\n}\n._legend_wpro0_1._isDragging_wpro0_8 {\n opacity: 0;\n}\n._legendItems_wpro0_11 {\n background-color: var(--color-background-raised);\n border: 1px solid var(--color-border);\n padding: 4px 8px;\n border-radius: 2px;\n overflow-y: auto;\n max-height: 100%;\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._legendItems_wpro0_11::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-button {\n display: none;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n pointer-events: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n display: none;\n}\n._legendToggle_wpro0_50 {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50,\n._legend_wpro0_1:hover ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: block;\n}\n._legend_wpro0_1:active ._legendToggle_wpro0_50._legendToggle_wpro0_50:not(:hover) {\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n position: static;\n transform: none;\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: none;\n}\n._legendItem_wpro0_11 {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n user-select: none;\n cursor: pointer;\n font-size: 12px;\n line-height: 16px;\n}\n._legendItemSymbol_wpro0_80 {\n display: flex;\n align-items: center;\n height: 16px;\n position: relative;\n flex-shrink: 0;\n}\nhtml[data-theme='dark'] ._legendItemSymbol_wpro0_80._legendItemSymbol_wpro0_80 {\n filter: invert(1) hue-rotate(180deg);\n}\n._legendItemBox_wpro0_90 {\n width: 100%;\n height: 12px;\n display: block;\n}\n._legendItemLine_wpro0_95 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 0;\n width: 100%;\n transform: translateY(-50%);\n}\n._legendItemPoint_wpro0_103 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n._isHidden_wpro0_47 ._legendItemText_wpro0_110._legendItemText_wpro0_110 {\n text-decoration: line-through;\n}\n._scrollbars_wpro0_113 {\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-button {\n display: none;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._dropzoneContainer_wpro0_140 {\n position: absolute;\n}\n._dropzone_wpro0_140 {\n position: absolute;\n width: 50%;\n height: 50%;\n display: flex;\n}\n._dropzone_wpro0_140._left_wpro0_149 {\n left: 0;\n justify-content: flex-start;\n}\n._dropzone_wpro0_140._right_wpro0_153 {\n right: 0;\n justify-content: flex-end;\n}\n._dropzone_wpro0_140._top_wpro0_157 {\n top: 0;\n align-items: flex-start;\n}\n._dropzone_wpro0_140._bottom_wpro0_161 {\n bottom: 0;\n align-items: flex-end;\n}\n._dropzonePlaceholder_wpro0_165 {\n position: absolute;\n background-color: rgba(0, 0, 0, 0.05);\n display: none;\n}\n[data-theme='dark'] ._dropzonePlaceholder_wpro0_165 {\n background-color: rgba(255, 255, 255, 0.05);\n}\n._isActive_wpro0_173 ._dropzonePlaceholder_wpro0_165._dropzonePlaceholder_wpro0_165 {\n display: block;\n}\n._resizeContainer_wpro0_176 {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\nhtml[data-theme='dark'] ._chart_1jdnu_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1jdnu_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1jdnu_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1jdnu_1._fixedHeight_1jdnu_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1jdnu_1._stretchHeight_1jdnu_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1jdnu_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1jdnu_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1jdnu_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1jdnu_32 ._zoomReset_1jdnu_40 {\n margin-left: 10px;\n}\n._zoomForm_1jdnu_32 ._help_1jdnu_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1jdnu_47 {\n width: 'auto';\n height: 'auto';\n}\nhtml[data-theme='dark'] ._chart_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}"));
39559
39486
  document.head.appendChild(elementStyle);
39560
39487
  }
39561
39488
  } catch (e) {