@oliasoft-open-source/charts-library 3.5.1 → 3.5.2-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
@@ -25427,27 +25427,23 @@ const useUpdateAxesRanges = (range, dispatch) => {
25427
25427
  prevAxes.current = axes;
25428
25428
  }
25429
25429
  };
25430
- const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
25431
- const prevGeneratedDatasets = useRef();
25432
- const saveInitialAxesRanges = useCallback(() => {
25433
- if (chartRef && !isEqual(generatedDatasets, prevGeneratedDatasets.current)) {
25434
- const initialAxesRanges = getAxesRangesFromChart(chartRef, axes);
25430
+ const useSaveInitialAxesRanges = (chartRef, axes, dispatch) => {
25431
+ const initialAxesRanges = chartRef ? getAxesRangesFromChart(chartRef, axes) : null;
25432
+ const prevAxes = useRef(null);
25433
+ useEffect(() => {
25434
+ if (chartRef && !isEqual(initialAxesRanges, prevAxes.current)) {
25435
25435
  dispatch({
25436
25436
  type: SAVE_INITIAL_AXES_RANGES,
25437
25437
  payload: { initialAxesRanges }
25438
25438
  });
25439
- prevGeneratedDatasets.current = generatedDatasets;
25439
+ prevAxes.current = initialAxesRanges;
25440
25440
  }
25441
- }, [chartRef, generatedDatasets]);
25442
- useEffect(() => {
25443
- saveInitialAxesRanges();
25444
- }, [saveInitialAxesRanges, generatedDatasets]);
25441
+ }, [chartRef, initialAxesRanges, dispatch]);
25445
25442
  };
25446
25443
  const useChartState = ({
25447
25444
  chartRef,
25448
25445
  options,
25449
25446
  state,
25450
- generatedDatasets,
25451
25447
  dispatch,
25452
25448
  persistenceId
25453
25449
  }) => {
@@ -25460,7 +25456,7 @@ const useChartState = ({
25460
25456
  useStoreChartStateInStorage(memoState, persistenceId);
25461
25457
  useToggleCustomLegendVisibility(memoState, memoOptions);
25462
25458
  useUpdateAxesRanges(range, dispatch);
25463
- useSaveInitialAxesRanges(chartRef, axes, generatedDatasets, dispatch);
25459
+ useSaveInitialAxesRanges(chartRef, axes, dispatch);
25464
25460
  };
25465
25461
  const WORD_SEPARATOR = " ";
25466
25462
  const SEMI_TRANSPARENT = "rgba(0, 0, 0, 0.5)";
@@ -25695,7 +25691,6 @@ const LineChart = (props) => {
25695
25691
  chartRef,
25696
25692
  options,
25697
25693
  state,
25698
- generatedDatasets,
25699
25694
  dispatch,
25700
25695
  persistenceId
25701
25696
  });
@@ -25714,6 +25709,7 @@ const LineChart = (props) => {
25714
25709
  generatedDatasets
25715
25710
  });
25716
25711
  const usePlugins = useChartPlugins({ options, resetZoom: resetZoom2 });
25712
+ console.log(state);
25717
25713
  return /* @__PURE__ */ jsxs(
25718
25714
  "div",
25719
25715
  {
@@ -25770,7 +25766,8 @@ const LineChart = (props) => {
25770
25766
  state.enableDragPoints,
25771
25767
  state.zoomEnabled,
25772
25768
  state.panEnabled,
25773
- languageKey
25769
+ languageKey,
25770
+ Math.random()
25774
25771
  ])
25775
25772
  );
25776
25773
  };