@oliasoft-open-source/charts-library 3.5.4-beta-3 → 3.5.4-beta-4

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
@@ -23711,9 +23711,9 @@ const useChartFunctions = ({
23711
23711
  const onResetAxes = useCallback(() => {
23712
23712
  dispatch({ type: RESET_AXES_RANGES });
23713
23713
  }, []);
23714
- const onUpdateAxes = ({ axes: axes2 }) => {
23714
+ const onUpdateAxes = useCallback(({ axes: axes2 }) => {
23715
23715
  dispatch({ type: UPDATE_AXES_RANGES, payload: { axes: axes2 } });
23716
- };
23716
+ }, []);
23717
23717
  return {
23718
23718
  legendClick,
23719
23719
  resetZoom: resetZoom2,
@@ -23739,12 +23739,7 @@ const initializeFormState = ({
23739
23739
  axes = []
23740
23740
  }) => {
23741
23741
  return (initialAxesRanges == null ? void 0 : initialAxesRanges.map((initialAxisRange) => {
23742
- console.log("initializeFormState");
23743
- console.log("-------------------");
23744
23742
  const currentAxisRange = axes.find((a2) => a2.id === initialAxisRange.id);
23745
- console.log("currentAxisRange", currentAxisRange);
23746
- console.log("id: initialAxisRange.id,", initialAxisRange.id);
23747
- console.log("-------------------");
23748
23743
  return {
23749
23744
  id: initialAxisRange.id,
23750
23745
  min: (currentAxisRange == null ? void 0 : currentAxisRange.min) ?? (initialAxisRange == null ? void 0 : initialAxisRange.min),
@@ -23794,13 +23789,7 @@ const reducer = (state, action) => {
23794
23789
  return produce(state, (draft) => {
23795
23790
  const { name: name2, value, id } = action.payload;
23796
23791
  const axis = draft.find((a2) => a2.id === id);
23797
- console.log("actionTypes.ValueUpdated:");
23798
- console.log("1-----------------------");
23799
- console.log("axis", axis);
23800
- console.log("name", name2);
23801
- console.log("value", value);
23802
23792
  if (axis && value) {
23803
- console.log("2------------------------");
23804
23793
  axis[name2] = value;
23805
23794
  }
23806
23795
  });
@@ -25434,25 +25423,19 @@ const useStoreChartStateInStorage = (memoState, persistenceId) => {
25434
25423
  ]);
25435
25424
  };
25436
25425
  const useUpdateAxesRanges = (range, dispatch) => {
25437
- const prevRange = useRef();
25438
- const updateAxesRanges = useCallback(() => {
25439
- if (range && isRangeValid(range) && !isEqual(range, prevRange.current)) {
25440
- console.log("WRONG", range);
25441
- const axes = Object.entries(range).map(([key, { min, max }]) => ({
25442
- id: key,
25443
- min: min ?? 0,
25444
- max: max ?? 0
25445
- }));
25446
- dispatch({
25447
- type: UPDATE_AXES_RANGES,
25448
- payload: { axes }
25449
- });
25450
- prevRange.current = range;
25451
- }
25452
- }, [range]);
25453
- useEffect(() => {
25454
- updateAxesRanges();
25455
- }, [updateAxesRanges]);
25426
+ const prevAxes = useRef(null);
25427
+ const axes = range && isRangeValid(range) ? Object.entries(range).map(([key, { min, max }]) => ({
25428
+ id: key,
25429
+ min: min ?? 0,
25430
+ max: max ?? 0
25431
+ })) : null;
25432
+ if (!isEqual(axes, prevAxes.current) && axes !== null) {
25433
+ dispatch({
25434
+ type: UPDATE_AXES_RANGES,
25435
+ payload: { axes }
25436
+ });
25437
+ prevAxes.current = axes;
25438
+ }
25456
25439
  };
25457
25440
  const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
25458
25441
  const prevGeneratedDatasets = useRef();
@@ -25741,8 +25724,9 @@ const LineChart = (props) => {
25741
25724
  generatedDatasets
25742
25725
  });
25743
25726
  const usePlugins = useChartPlugins({ options, resetZoom: resetZoom2 });
25744
- console.log("State", state);
25727
+ console.log("state", state);
25745
25728
  console.log("options", options);
25729
+ console.log("generatedDatasets", generatedDatasets);
25746
25730
  return /* @__PURE__ */ jsxs(
25747
25731
  "div",
25748
25732
  {