@oliasoft-open-source/charts-library 3.4.12-beta-1 → 3.5.0-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 +7 -33
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25404,42 +25404,22 @@ const useStoreChartStateInStorage = (memoState, persistenceId) => {
|
|
|
25404
25404
|
memoState.zoomEnabled
|
|
25405
25405
|
]);
|
|
25406
25406
|
};
|
|
25407
|
-
const useUpdateAxesRanges = (range, dispatch
|
|
25408
|
-
const
|
|
25409
|
-
range: null,
|
|
25410
|
-
datasets: null
|
|
25411
|
-
});
|
|
25412
|
-
const { annotations: { annotationsData = [] } = {} } = options || {};
|
|
25407
|
+
const useUpdateAxesRanges = (range, dispatch) => {
|
|
25408
|
+
const prevRange = useRef(null);
|
|
25413
25409
|
const updateAxesRanges = useCallback(() => {
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
axes = Object.entries(range).map(([key, { min, max }]) => ({
|
|
25410
|
+
if (range && range.x && range.y && !isEqual(range, prevRange.current)) {
|
|
25411
|
+
const axes = Object.entries(range).map(([key, { min, max }]) => ({
|
|
25417
25412
|
id: key,
|
|
25418
25413
|
min: min ?? 0,
|
|
25419
25414
|
max: max ?? 0
|
|
25420
25415
|
}));
|
|
25421
|
-
prevProps.current.range = range;
|
|
25422
|
-
} else if (range && !isEqual(generatedDatasets, prevProps.current.datasets)) {
|
|
25423
|
-
const scalesKeys = Object.keys(range) ?? [];
|
|
25424
|
-
const data = getAxesDataFromMetasets(
|
|
25425
|
-
chartRef,
|
|
25426
|
-
scalesKeys,
|
|
25427
|
-
annotationsData
|
|
25428
|
-
);
|
|
25429
|
-
axes = Object.keys(range).map((key) => ({
|
|
25430
|
-
id: key,
|
|
25431
|
-
min: Math.min(...data[key]) ?? 0,
|
|
25432
|
-
max: Math.max(...data[key]) ?? 0
|
|
25433
|
-
}));
|
|
25434
|
-
prevProps.current.datasets = generatedDatasets;
|
|
25435
|
-
}
|
|
25436
|
-
if (axes) {
|
|
25437
25416
|
dispatch({
|
|
25438
25417
|
type: UPDATE_AXES_RANGES,
|
|
25439
25418
|
payload: { axes }
|
|
25440
25419
|
});
|
|
25420
|
+
prevRange.current = range;
|
|
25441
25421
|
}
|
|
25442
|
-
}, [range
|
|
25422
|
+
}, [range]);
|
|
25443
25423
|
useEffect(() => {
|
|
25444
25424
|
updateAxesRanges();
|
|
25445
25425
|
}, [updateAxesRanges]);
|
|
@@ -25476,13 +25456,7 @@ const useChartState = ({
|
|
|
25476
25456
|
} = memoOptions;
|
|
25477
25457
|
useStoreChartStateInStorage(memoState, persistenceId);
|
|
25478
25458
|
useToggleCustomLegendVisibility(memoState, memoOptions);
|
|
25479
|
-
useUpdateAxesRanges(
|
|
25480
|
-
range,
|
|
25481
|
-
dispatch,
|
|
25482
|
-
generatedDatasets,
|
|
25483
|
-
chartRef,
|
|
25484
|
-
memoOptions
|
|
25485
|
-
);
|
|
25459
|
+
useUpdateAxesRanges(range, dispatch);
|
|
25486
25460
|
useSaveInitialAxesRanges(chartRef, axes, generatedDatasets, dispatch);
|
|
25487
25461
|
};
|
|
25488
25462
|
const WORD_SEPARATOR = " ";
|