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

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
@@ -22219,7 +22219,7 @@ const isPrimitiveValue = (value) => typeof value === "string" || typeof value ==
22219
22219
  const isRangeValid = (r2) => {
22220
22220
  if (!r2)
22221
22221
  return false;
22222
- return Object.values(r2).every((value) => !isNilOrEmpty(value));
22222
+ return Object.values(r2).some((value) => !isNilOrEmpty(value));
22223
22223
  };
22224
22224
  const getChartStateFromStorage = (persistenceId) => {
22225
22225
  if (!persistenceId)
@@ -24559,7 +24559,7 @@ const defaultChartStyling$2 = (options) => ({
24559
24559
  maintainAspectRatio: (options == null ? void 0 : options.maintainAspectRatio) ?? false,
24560
24560
  staticChartHeight: (options == null ? void 0 : options.staticChartHeight) ?? false,
24561
24561
  performanceMode: (options == null ? void 0 : options.performanceMode) ?? true,
24562
- squareAspectRatio: options == null ? void 0 : options.squareAspectRatio,
24562
+ squareAspectRatio: (options == null ? void 0 : options.squareAspectRatio) ?? false,
24563
24563
  layoutPadding: (options == null ? void 0 : options.layoutPadding) || {
24564
24564
  top: 0,
24565
24565
  bottom: 20,
@@ -25422,20 +25422,32 @@ const useStoreChartStateInStorage = (memoState, persistenceId) => {
25422
25422
  memoState.zoomEnabled
25423
25423
  ]);
25424
25424
  };
25425
- const useUpdateAxesRanges = (range, dispatch) => {
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
- }
25425
+ const useUpdateAxesRanges = ({
25426
+ range,
25427
+ state,
25428
+ dispatch
25429
+ }) => {
25430
+ const prevAxes = useRef(state.axes);
25431
+ useEffect(() => {
25432
+ if (range && isRangeValid(range)) {
25433
+ const newAxes = Object.entries(range).map(([key, { min, max }]) => ({
25434
+ id: key,
25435
+ min: min ?? 0,
25436
+ max: max ?? 0
25437
+ }));
25438
+ const mergedAxes = [...prevAxes.current ?? []].map((axis) => {
25439
+ const newAxis = newAxes.find((a2) => a2.id === axis.id);
25440
+ return newAxis ? { ...axis, ...newAxis } : axis;
25441
+ });
25442
+ if (!isEqual(mergedAxes, prevAxes.current)) {
25443
+ dispatch({
25444
+ type: UPDATE_AXES_RANGES,
25445
+ payload: { axes: mergedAxes }
25446
+ });
25447
+ prevAxes.current = mergedAxes;
25448
+ }
25449
+ }
25450
+ }, [range]);
25439
25451
  };
25440
25452
  const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
25441
25453
  const prevGeneratedDatasets = useRef();
@@ -25469,7 +25481,7 @@ const useChartState = ({
25469
25481
  } = memoOptions;
25470
25482
  useStoreChartStateInStorage(memoState, persistenceId);
25471
25483
  useToggleCustomLegendVisibility(memoState, memoOptions);
25472
- useUpdateAxesRanges(range, dispatch);
25484
+ useUpdateAxesRanges({ range, state: memoState, dispatch });
25473
25485
  useSaveInitialAxesRanges(chartRef, axes, generatedDatasets, dispatch);
25474
25486
  };
25475
25487
  const WORD_SEPARATOR = " ";
@@ -25724,9 +25736,6 @@ const LineChart = (props) => {
25724
25736
  generatedDatasets
25725
25737
  });
25726
25738
  const usePlugins = useChartPlugins({ options, resetZoom: resetZoom2 });
25727
- console.log("state", state);
25728
- console.log("options", options);
25729
- console.log("generatedDatasets", generatedDatasets);
25730
25739
  return /* @__PURE__ */ jsxs(
25731
25740
  "div",
25732
25741
  {