@oliasoft-open-source/charts-library 3.7.1 → 3.7.2-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.
package/dist/index.js CHANGED
@@ -25908,23 +25908,26 @@ const useUpdateAxesRanges = ({
25908
25908
  }
25909
25909
  }, [range]);
25910
25910
  };
25911
- const useSaveInitialAxesRanges = (chartRef, axes, dispatch) => {
25911
+ const useSaveInitialAxesRanges = (chartRef, axes, dispatch, generatedDatasets) => {
25912
+ const prevDatasets = useRef(null);
25912
25913
  useEffect(() => {
25913
- if (chartRef.current) {
25914
+ if (chartRef.current && !isEqual(prevDatasets.current, generatedDatasets)) {
25914
25915
  const initialAxesRanges = getAxesRangesFromChart(chartRef, axes);
25915
25916
  dispatch({
25916
25917
  type: SAVE_INITIAL_AXES_RANGES,
25917
25918
  payload: { initialAxesRanges }
25918
25919
  });
25920
+ prevDatasets.current = generatedDatasets;
25919
25921
  }
25920
- }, []);
25922
+ }, [generatedDatasets]);
25921
25923
  };
25922
25924
  const useChartState = ({
25923
25925
  chartRef,
25924
25926
  options,
25925
25927
  state,
25926
25928
  dispatch,
25927
- persistenceId
25929
+ persistenceId,
25930
+ generatedDatasets
25928
25931
  }) => {
25929
25932
  const memoState = useMemo(() => state, [state]);
25930
25933
  const memoOptions = useMemo(() => options, [options]);
@@ -25942,7 +25945,7 @@ const useChartState = ({
25942
25945
  chartRef,
25943
25946
  annotationsData
25944
25947
  });
25945
- useSaveInitialAxesRanges(chartRef, axes, dispatch);
25948
+ useSaveInitialAxesRanges(chartRef, axes, dispatch, generatedDatasets);
25946
25949
  };
25947
25950
  const WORD_SEPARATOR = " ";
25948
25951
  const SEMI_TRANSPARENT = "rgba(0, 0, 0, 0.5)";
@@ -26179,7 +26182,8 @@ const LineChart = (props) => {
26179
26182
  options,
26180
26183
  state,
26181
26184
  dispatch,
26182
- persistenceId
26185
+ persistenceId,
26186
+ generatedDatasets
26183
26187
  });
26184
26188
  const { resetZoom: resetZoom2, handleKeyDown, handleKeyUp } = useChartFunctions({
26185
26189
  chartRef,