@oliasoft-open-source/charts-library 3.4.5-beta-1 → 3.4.5-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -13161,9 +13161,7 @@ const ANNOTATION_DASH = [10, 2];
13161
13161
  const DEFAULT_FONT_SIZE = 13;
13162
13162
  const DEFAULT_FONT_FAMILY = '"Lato", sans-serif';
13163
13163
  const DEFAULT_COLOR = "rgba(0,0,0,.87)";
13164
- const LEGEND_LABEL_BOX_SIZE = 12;
13165
- const TOOLTIP_PADDING = 8;
13166
- const TOOLTIP_BOX_PADDING = 4;
13164
+ const LEGEND_LABEL_BOX_SIZE = 6;
13167
13165
  const LOGARITHMIC_STEPS = [1, 10, 100, 1e3, 1e4];
13168
13166
  const COLORS = [
13169
13167
  "#3366cc",
@@ -23736,18 +23734,17 @@ const reducer = (state, action) => {
23736
23734
  return state;
23737
23735
  }
23738
23736
  };
23739
- const AxesOptionsPopover = (optionsPopover) => {
23737
+ const AxesOptionsPopover = ({
23738
+ initialAxesRanges,
23739
+ axes,
23740
+ controlsAxesLabels,
23741
+ onUpdateAxes,
23742
+ onResetAxes,
23743
+ close,
23744
+ depthType,
23745
+ translations
23746
+ }) => {
23740
23747
  var _a2;
23741
- const {
23742
- initialAxesRanges,
23743
- axes,
23744
- controlsAxesLabels,
23745
- onUpdateAxes,
23746
- onResetAxes,
23747
- close,
23748
- depthType,
23749
- translations
23750
- } = optionsPopover;
23751
23748
  const [depthTypeState, setDepthTypeState] = useState(
23752
23749
  depthType == null ? void 0 : depthType.selectedDepthType
23753
23750
  );
@@ -23762,20 +23759,14 @@ const AxesOptionsPopover = (optionsPopover) => {
23762
23759
  const { errors, valid } = validateAxes(formState);
23763
23760
  const onEditValue = ({ name: name2, value, id }) => {
23764
23761
  dispatch({
23765
- type: actionTypes.ValueUpdated,
23766
- payload: { name: name2, value, id }
23767
- });
23768
- };
23769
- const onEditUnit = ({ name: name2, value, id }) => {
23770
- dispatch({
23771
- type: actionTypes.UnitUpdated,
23762
+ type: actionTypes.valueUpdated,
23772
23763
  payload: { name: name2, value, id }
23773
23764
  });
23774
23765
  };
23775
23766
  const onDone = (e2) => {
23776
23767
  e2.preventDefault();
23777
23768
  if (valid) {
23778
- const sanitizedFormState = formState.map((axis) => ({
23769
+ const sanitizedFormState = formState.map((axis, i2) => ({
23779
23770
  ...axis,
23780
23771
  min: toNum(axis.min),
23781
23772
  max: toNum(axis.max)
@@ -23783,13 +23774,6 @@ const AxesOptionsPopover = (optionsPopover) => {
23783
23774
  onUpdateAxes({
23784
23775
  axes: sanitizedFormState
23785
23776
  });
23786
- sanitizedFormState.forEach((el, i2) => {
23787
- var _a3, _b2, _c2;
23788
- const selectedUnit = (_a3 = el.unit) == null ? void 0 : _a3.selectedUnit;
23789
- if (selectedUnit) {
23790
- (_c2 = (_b2 = axes == null ? void 0 : axes[i2]) == null ? void 0 : _b2.unit) == null ? void 0 : _c2.setSelectedUnit(selectedUnit);
23791
- }
23792
- });
23793
23777
  if (depthType) {
23794
23778
  depthType.setSelectedDepthType(depthTypeState);
23795
23779
  }
@@ -23798,14 +23782,13 @@ const AxesOptionsPopover = (optionsPopover) => {
23798
23782
  };
23799
23783
  const onReset = () => {
23800
23784
  dispatch({
23801
- type: actionTypes.Reset,
23785
+ type: actionTypes.reset,
23802
23786
  payload: { axes, initialAxesRanges }
23803
23787
  });
23804
- initialAxesRanges.forEach((el, i2) => {
23805
- var _a3, _b2, _c2;
23806
- const selectedUnit = (_a3 = el == null ? void 0 : el.unit) == null ? void 0 : _a3.selectedUnit;
23807
- if (selectedUnit) {
23808
- (_c2 = (_b2 = axes == null ? void 0 : axes[i2]) == null ? void 0 : _b2.unit) == null ? void 0 : _c2.setSelectedUnit(selectedUnit);
23788
+ initialAxesRanges.map((el, i2) => {
23789
+ var _a3;
23790
+ if ((_a3 = el == null ? void 0 : el.unit) == null ? void 0 : _a3.selectedUnit) {
23791
+ axes[i2].unit.setSelectedUnit(el.unit.selectedUnit);
23809
23792
  }
23810
23793
  });
23811
23794
  onResetAxes();
@@ -23864,15 +23847,10 @@ const AxesOptionsPopover = (optionsPopover) => {
23864
23847
  name: "selectedUnit",
23865
23848
  options: (_i2 = axis == null ? void 0 : axis.unit) == null ? void 0 : _i2.options,
23866
23849
  value: unit == null ? void 0 : unit.selectedUnit,
23867
- onChange: (e2) => {
23868
- onEditUnit({
23869
- name: e2.target.name,
23870
- value: e2.target.value,
23871
- id: axis.id
23872
- });
23873
- },
23850
+ onChange: unit == null ? void 0 : unit.setSelectedUnit,
23874
23851
  autoLayerWidth: true,
23875
- width: "15%"
23852
+ width: "15%",
23853
+ native: true
23876
23854
  }
23877
23855
  ) : null
23878
23856
  ] }) }, i2);
@@ -23919,16 +23897,15 @@ const AxesOptionsPopover = (optionsPopover) => {
23919
23897
  ] })
23920
23898
  ] });
23921
23899
  };
23922
- const AxesOptions = (optionsPopover) => {
23923
- const {
23924
- initialAxesRanges,
23925
- axes,
23926
- controlsAxesLabels,
23927
- onUpdateAxes,
23928
- onResetAxes,
23929
- depthType,
23930
- translations
23931
- } = optionsPopover;
23900
+ const AxesOptions = ({
23901
+ initialAxesRanges,
23902
+ axes,
23903
+ controlsAxesLabels,
23904
+ onUpdateAxes,
23905
+ onResetAxes,
23906
+ depthType,
23907
+ translations
23908
+ }) => {
23932
23909
  return /* @__PURE__ */ jsx(
23933
23910
  Popover,
23934
23911
  {
@@ -25094,7 +25071,7 @@ const getLineChartToolTips = (options) => {
25094
25071
  return `${roundedValue} ${titleAxisLabel}`;
25095
25072
  };
25096
25073
  const labelCallback = (tooltipItem) => {
25097
- const { showLabelsInTooltips } = options.tooltip;
25074
+ const { showLabelsInTooltips, hideSimulationName } = options.tooltip;
25098
25075
  let label = tooltipItem.dataset.label || "";
25099
25076
  const labels = getTooltipLabels(tooltipItem.dataset);
25100
25077
  const { valueLabel, valueAxisLabel } = labels;
@@ -25105,25 +25082,18 @@ const getLineChartToolTips = (options) => {
25105
25082
  roundScientificCoefficient: 4
25106
25083
  }) : displayNumber(labelNumber);
25107
25084
  };
25108
- const getTooltipItemUnits = () => {
25109
- const matches = valueAxisLabel.match(/\[(.*?)\]/g);
25110
- const units2 = matches && matches.length > 0 ? matches[0] : "";
25111
- return units2;
25112
- };
25085
+ const splitValueAxisLabel = valueAxisLabel.split(" ");
25086
+ const newValueAxisLabel = hideSimulationName ? splitValueAxisLabel[splitValueAxisLabel.length - 1] : valueAxisLabel;
25113
25087
  const tooltipItemValue = getTooltipItemValue();
25114
- const units = getTooltipItemUnits();
25088
+ const valAxisLabel = label === valueAxisLabel || valueAxisLabel.includes(label) ? "" : newValueAxisLabel;
25115
25089
  const tooltipLabel = getTooltipLabel(tooltipItem, showLabelsInTooltips);
25116
- return `${label}: ${tooltipItemValue} ${units} ${tooltipLabel}`;
25090
+ return `${label}: ${tooltipItemValue} ${valAxisLabel}${tooltipLabel}`;
25117
25091
  };
25118
25092
  return {
25119
25093
  enabled: options.tooltip.tooltips,
25120
25094
  mode: ChartHoverMode.Nearest,
25121
25095
  intersect: true,
25122
- padding: TOOLTIP_PADDING,
25123
- usePointStyle: true,
25124
- boxWidth: LEGEND_LABEL_BOX_SIZE,
25125
- boxHeight: LEGEND_LABEL_BOX_SIZE,
25126
- boxPadding: TOOLTIP_BOX_PADDING,
25096
+ padding: 8,
25127
25097
  callbacks: {
25128
25098
  title: titleCallback,
25129
25099
  label: labelCallback,
@@ -26105,12 +26075,7 @@ const PieChart = (props) => {
26105
26075
  const formattedValue = Math.abs(labelValue) < 1 ? roundNumberToPrecision(labelValue, { n: 3 }) : round$2(labelValue, 3);
26106
26076
  return `${dataLabel} ${formattedValue} ${unit}`;
26107
26077
  }
26108
- },
26109
- padding: TOOLTIP_PADDING,
26110
- boxWidth: LEGEND_LABEL_BOX_SIZE,
26111
- boxHeight: LEGEND_LABEL_BOX_SIZE,
26112
- boxPadding: TOOLTIP_BOX_PADDING,
26113
- usePointStyle: true
26078
+ }
26114
26079
  };
26115
26080
  };
26116
26081
  return /* @__PURE__ */ jsx(
@@ -38788,10 +38753,7 @@ const getBarChartToolTips = (options) => {
38788
38753
  enabled: options.tooltip.tooltips,
38789
38754
  mode: ChartHoverMode.Nearest,
38790
38755
  intersect: true,
38791
- padding: TOOLTIP_PADDING,
38792
- boxWidth: LEGEND_LABEL_BOX_SIZE,
38793
- boxHeight: LEGEND_LABEL_BOX_SIZE,
38794
- boxPadding: TOOLTIP_BOX_PADDING,
38756
+ padding: 8,
38795
38757
  callbacks: {
38796
38758
  title: titleCallback,
38797
38759
  label: labelCallback,