@oliasoft-open-source/charts-library 3.5.3-beta-6 → 3.5.4-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
@@ -24545,8 +24545,8 @@ const TextLabelPosition = {
24545
24545
  BOTTOM_RIGHT: "bottom-right"
24546
24546
  };
24547
24547
  const defaultAxes$1 = (axes) => ({
24548
- x: (axes == null ? void 0 : axes.x) || [],
24549
- y: (axes == null ? void 0 : axes.y) || []
24548
+ x: (axes == null ? void 0 : axes.x) || [{}],
24549
+ y: (axes == null ? void 0 : axes.y) || [{}]
24550
24550
  });
24551
24551
  const defaultAdditionalAxesOptions$1 = (options) => ({
24552
24552
  chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
@@ -24555,7 +24555,7 @@ const defaultAdditionalAxesOptions$1 = (options) => ({
24555
24555
  stepSize: options == null ? void 0 : options.stepSize,
24556
24556
  suggestedMin: options == null ? void 0 : options.suggestedMin,
24557
24557
  suggestedMax: options == null ? void 0 : options.suggestedMax,
24558
- range: (options == null ? void 0 : options.range) || null,
24558
+ range: options == null ? void 0 : options.range,
24559
24559
  autoAxisPadding: (options == null ? void 0 : options.autoAxisPadding) ?? false
24560
24560
  });
24561
24561
  const defaultChartStyling$2 = (options) => ({
@@ -25428,24 +25428,24 @@ const useStoreChartStateInStorage = (memoState, persistenceId) => {
25428
25428
  ]);
25429
25429
  };
25430
25430
  const useUpdateAxesRanges = (range, dispatch) => {
25431
- const prevAxes = useRef(null);
25432
- const axes = range && isRangeValid(range) ? Object.entries(range).map(([key, { min, max }]) => ({
25433
- id: key,
25434
- min: min ?? 0,
25435
- max: max ?? 0
25436
- })) : null;
25437
- if (!isEqual(axes, prevAxes.current) && axes !== null) {
25438
- console.log("------------");
25439
- console.log("WRONG");
25440
- console.log(axes);
25441
- console.log(prevAxes.current);
25442
- console.log("------------");
25443
- dispatch({
25444
- type: UPDATE_AXES_RANGES,
25445
- payload: { axes }
25446
- });
25447
- prevAxes.current = axes;
25448
- }
25431
+ const prevRange = useRef();
25432
+ const updateAxesRanges = useCallback(() => {
25433
+ if (range && isRangeValid(range) && !isEqual(range, prevRange.current)) {
25434
+ const axes = Object.entries(range).map(([key, { min, max }]) => ({
25435
+ id: key,
25436
+ min: min ?? 0,
25437
+ max: max ?? 0
25438
+ }));
25439
+ dispatch({
25440
+ type: UPDATE_AXES_RANGES,
25441
+ payload: { axes }
25442
+ });
25443
+ prevRange.current = range;
25444
+ }
25445
+ }, [range]);
25446
+ useEffect(() => {
25447
+ updateAxesRanges();
25448
+ }, [updateAxesRanges]);
25449
25449
  };
25450
25450
  const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
25451
25451
  const prevGeneratedDatasets = useRef();
@@ -25475,7 +25475,7 @@ const useChartState = ({
25475
25475
  const memoState = useMemo(() => state, [state]);
25476
25476
  const memoOptions = useMemo(() => options, [options]);
25477
25477
  const {
25478
- additionalAxesOptions: { range = null },
25478
+ additionalAxesOptions: { range = void 0 },
25479
25479
  axes
25480
25480
  } = memoOptions;
25481
25481
  useStoreChartStateInStorage(memoState, persistenceId);