@oliasoft-open-source/charts-library 3.5.3 → 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
|
@@ -22275,9 +22275,12 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22275
22275
|
} = options;
|
|
22276
22276
|
const getStateAxesByType = (axisType, customAxesRange2) => {
|
|
22277
22277
|
var _a2, _b2, _c2, _d2, _e2;
|
|
22278
|
+
console.log("axisType", axisType);
|
|
22279
|
+
console.log("axes", axes);
|
|
22278
22280
|
if (!axes[axisType]) {
|
|
22279
22281
|
return [];
|
|
22280
22282
|
}
|
|
22283
|
+
console.log("getStateAxesByType");
|
|
22281
22284
|
if (((_a2 = axes[axisType]) == null ? void 0 : _a2.length) > 1) {
|
|
22282
22285
|
return axes[axisType].map(
|
|
22283
22286
|
(axisObj, index2) => {
|
|
@@ -22300,6 +22303,7 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22300
22303
|
const customMin = (_b2 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _b2.min;
|
|
22301
22304
|
const customMax = (_c2 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _c2.max;
|
|
22302
22305
|
const unit = (_e2 = (_d2 = axes == null ? void 0 : axes[id]) == null ? void 0 : _d2[0]) == null ? void 0 : _e2.unit;
|
|
22306
|
+
console.log("id", id);
|
|
22303
22307
|
return [
|
|
22304
22308
|
{
|
|
22305
22309
|
id,
|
|
@@ -22314,6 +22318,7 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22314
22318
|
const xStateAxes = getStateAxesByType(AxisType.X, customAxesRange);
|
|
22315
22319
|
const yStateAxes = getStateAxesByType(AxisType.Y, customAxesRange);
|
|
22316
22320
|
const stateAxes = [...xStateAxes, ...yStateAxes];
|
|
22321
|
+
console.log("stateAxes", stateAxes);
|
|
22317
22322
|
const {
|
|
22318
22323
|
zoomEnabled,
|
|
22319
22324
|
panEnabled,
|
|
@@ -23711,9 +23716,9 @@ const useChartFunctions = ({
|
|
|
23711
23716
|
const onResetAxes = useCallback(() => {
|
|
23712
23717
|
dispatch({ type: RESET_AXES_RANGES });
|
|
23713
23718
|
}, []);
|
|
23714
|
-
const onUpdateAxes =
|
|
23719
|
+
const onUpdateAxes = ({ axes: axes2 }) => {
|
|
23715
23720
|
dispatch({ type: UPDATE_AXES_RANGES, payload: { axes: axes2 } });
|
|
23716
|
-
}
|
|
23721
|
+
};
|
|
23717
23722
|
return {
|
|
23718
23723
|
legendClick,
|
|
23719
23724
|
resetZoom: resetZoom2,
|
|
@@ -24540,8 +24545,8 @@ const TextLabelPosition = {
|
|
|
24540
24545
|
BOTTOM_RIGHT: "bottom-right"
|
|
24541
24546
|
};
|
|
24542
24547
|
const defaultAxes$1 = (axes) => ({
|
|
24543
|
-
x: (axes == null ? void 0 : axes.x) || [],
|
|
24544
|
-
y: (axes == null ? void 0 : axes.y) || []
|
|
24548
|
+
x: (axes == null ? void 0 : axes.x) || [{}],
|
|
24549
|
+
y: (axes == null ? void 0 : axes.y) || [{}]
|
|
24545
24550
|
});
|
|
24546
24551
|
const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
24547
24552
|
chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
|
|
@@ -24550,7 +24555,7 @@ const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
|
24550
24555
|
stepSize: options == null ? void 0 : options.stepSize,
|
|
24551
24556
|
suggestedMin: options == null ? void 0 : options.suggestedMin,
|
|
24552
24557
|
suggestedMax: options == null ? void 0 : options.suggestedMax,
|
|
24553
|
-
range:
|
|
24558
|
+
range: options == null ? void 0 : options.range,
|
|
24554
24559
|
autoAxisPadding: (options == null ? void 0 : options.autoAxisPadding) ?? false
|
|
24555
24560
|
});
|
|
24556
24561
|
const defaultChartStyling$2 = (options) => ({
|
|
@@ -25265,7 +25270,7 @@ const useChartOptions = ({
|
|
|
25265
25270
|
);
|
|
25266
25271
|
const scales = useMemo(
|
|
25267
25272
|
() => autoScale(options, state, generatedDatasets, chartRef),
|
|
25268
|
-
[options, state, generatedDatasets]
|
|
25273
|
+
[options, state, generatedDatasets, chartRef]
|
|
25269
25274
|
);
|
|
25270
25275
|
const dragData = useMemo(
|
|
25271
25276
|
() => enableDragPoints && getDraggableData(options),
|
|
@@ -25348,7 +25353,7 @@ const useChartOptions = ({
|
|
|
25348
25353
|
plugins,
|
|
25349
25354
|
events: Object.values(Events)
|
|
25350
25355
|
}),
|
|
25351
|
-
[state, options]
|
|
25356
|
+
[state, options, chartRef]
|
|
25352
25357
|
);
|
|
25353
25358
|
};
|
|
25354
25359
|
const useChartPlugins = ({ options, resetZoom: resetZoom2 }) => {
|
|
@@ -25423,25 +25428,31 @@ const useStoreChartStateInStorage = (memoState, persistenceId) => {
|
|
|
25423
25428
|
]);
|
|
25424
25429
|
};
|
|
25425
25430
|
const useUpdateAxesRanges = (range, dispatch) => {
|
|
25426
|
-
const
|
|
25427
|
-
const
|
|
25428
|
-
|
|
25429
|
-
|
|
25430
|
-
|
|
25431
|
-
|
|
25432
|
-
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
|
|
25437
|
-
|
|
25438
|
-
|
|
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]);
|
|
25439
25449
|
};
|
|
25440
25450
|
const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
|
|
25441
25451
|
const prevGeneratedDatasets = useRef();
|
|
25442
25452
|
const saveInitialAxesRanges = useCallback(() => {
|
|
25443
25453
|
if (chartRef && !isEqual(generatedDatasets, prevGeneratedDatasets.current)) {
|
|
25444
25454
|
const initialAxesRanges = getAxesRangesFromChart(chartRef, axes);
|
|
25455
|
+
console.log("initialAxesRanges", initialAxesRanges);
|
|
25445
25456
|
dispatch({
|
|
25446
25457
|
type: SAVE_INITIAL_AXES_RANGES,
|
|
25447
25458
|
payload: { initialAxesRanges }
|
|
@@ -25464,7 +25475,7 @@ const useChartState = ({
|
|
|
25464
25475
|
const memoState = useMemo(() => state, [state]);
|
|
25465
25476
|
const memoOptions = useMemo(() => options, [options]);
|
|
25466
25477
|
const {
|
|
25467
|
-
additionalAxesOptions: { range =
|
|
25478
|
+
additionalAxesOptions: { range = void 0 },
|
|
25468
25479
|
axes
|
|
25469
25480
|
} = memoOptions;
|
|
25470
25481
|
useStoreChartStateInStorage(memoState, persistenceId);
|
|
@@ -25724,6 +25735,8 @@ const LineChart = (props) => {
|
|
|
25724
25735
|
generatedDatasets
|
|
25725
25736
|
});
|
|
25726
25737
|
const usePlugins = useChartPlugins({ options, resetZoom: resetZoom2 });
|
|
25738
|
+
console.log("State", state);
|
|
25739
|
+
console.log("options", options);
|
|
25727
25740
|
return /* @__PURE__ */ jsxs(
|
|
25728
25741
|
"div",
|
|
25729
25742
|
{
|