@oliasoft-open-source/charts-library 4.7.7 → 4.7.9-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 +21 -30
- package/dist/index.js.map +1 -1
- package/dist/src/components/line-chart/line-chart.stories.d.ts +127 -100
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22476,10 +22476,7 @@ const reducer$1 = (state, action) => {
|
|
|
22476
22476
|
}
|
|
22477
22477
|
case RESET_AXES_RANGES: {
|
|
22478
22478
|
const { initialAxesRanges } = draft;
|
|
22479
|
-
draft.axes = initialAxesRanges
|
|
22480
|
-
id: axis.id,
|
|
22481
|
-
...axis.unit && { unit: axis.unit }
|
|
22482
|
-
}));
|
|
22479
|
+
draft.axes = [...initialAxesRanges];
|
|
22483
22480
|
break;
|
|
22484
22481
|
}
|
|
22485
22482
|
case TOGGLE_DRAG_POINTS: {
|
|
@@ -26092,20 +26089,6 @@ const useChartPlugins = ({ options, resetZoom: resetZoom2 }) => {
|
|
|
26092
26089
|
];
|
|
26093
26090
|
}, [handleDoubleClick]);
|
|
26094
26091
|
};
|
|
26095
|
-
const getAxesRangesFromChart = (chartRef, axes) => {
|
|
26096
|
-
const { scales = {} } = chartRef.current || {};
|
|
26097
|
-
return Object.entries(scales).map(([key, { min, max }], i2) => {
|
|
26098
|
-
var _a2;
|
|
26099
|
-
const axesArray = [...axes.x, ...axes.y];
|
|
26100
|
-
const unit = (_a2 = axesArray == null ? void 0 : axesArray[i2]) == null ? void 0 : _a2.unit;
|
|
26101
|
-
return {
|
|
26102
|
-
id: key,
|
|
26103
|
-
min,
|
|
26104
|
-
max,
|
|
26105
|
-
...unit ? { unit } : {}
|
|
26106
|
-
};
|
|
26107
|
-
});
|
|
26108
|
-
};
|
|
26109
26092
|
const getAxisRangeByType = (chartRef, axesType, annotationsData) => {
|
|
26110
26093
|
if (!chartRef || !chartRef.current) return null;
|
|
26111
26094
|
const metasets = chartRef.current.getSortedVisibleDatasetMetas();
|
|
@@ -26182,18 +26165,27 @@ const useUpdateAxesRanges = ({
|
|
|
26182
26165
|
}
|
|
26183
26166
|
}, [range]);
|
|
26184
26167
|
};
|
|
26185
|
-
const useSaveInitialAxesRanges = (chartRef,
|
|
26168
|
+
const useSaveInitialAxesRanges = (chartRef, dispatch, generatedDatasets) => {
|
|
26186
26169
|
const prevDatasets = useRef(null);
|
|
26187
26170
|
useEffect(() => {
|
|
26188
|
-
if (chartRef.current
|
|
26189
|
-
|
|
26190
|
-
|
|
26191
|
-
|
|
26192
|
-
|
|
26193
|
-
|
|
26194
|
-
prevDatasets.current = generatedDatasets;
|
|
26171
|
+
if (!chartRef.current || isEqual(prevDatasets.current, generatedDatasets)) {
|
|
26172
|
+
return;
|
|
26173
|
+
}
|
|
26174
|
+
const { scales } = (chartRef == null ? void 0 : chartRef.current) ?? {};
|
|
26175
|
+
if (!scales) {
|
|
26176
|
+
return;
|
|
26195
26177
|
}
|
|
26196
|
-
|
|
26178
|
+
const initialAxesRanges = Object.entries(scales).map(([id, scale]) => ({
|
|
26179
|
+
id,
|
|
26180
|
+
min: scale == null ? void 0 : scale.min,
|
|
26181
|
+
max: scale == null ? void 0 : scale.max
|
|
26182
|
+
}));
|
|
26183
|
+
dispatch({
|
|
26184
|
+
type: SAVE_INITIAL_AXES_RANGES,
|
|
26185
|
+
payload: { initialAxesRanges }
|
|
26186
|
+
});
|
|
26187
|
+
prevDatasets.current = generatedDatasets;
|
|
26188
|
+
}, [generatedDatasets, dispatch]);
|
|
26197
26189
|
};
|
|
26198
26190
|
const useChartState = ({
|
|
26199
26191
|
chartRef,
|
|
@@ -26215,8 +26207,7 @@ const useChartState = ({
|
|
|
26215
26207
|
const memoOptions = useMemo(() => options, [options]);
|
|
26216
26208
|
const {
|
|
26217
26209
|
additionalAxesOptions: { range = void 0 },
|
|
26218
|
-
annotations: { annotationsData = [] } = {}
|
|
26219
|
-
axes
|
|
26210
|
+
annotations: { annotationsData = [] } = {}
|
|
26220
26211
|
} = memoOptions;
|
|
26221
26212
|
useStoreChartStateInStorage(memoState, persistenceId);
|
|
26222
26213
|
useToggleCustomLegendVisibility(memoState, memoOptions);
|
|
@@ -26227,7 +26218,7 @@ const useChartState = ({
|
|
|
26227
26218
|
chartRef,
|
|
26228
26219
|
annotationsData
|
|
26229
26220
|
});
|
|
26230
|
-
useSaveInitialAxesRanges(chartRef,
|
|
26221
|
+
useSaveInitialAxesRanges(chartRef, dispatch, generatedDatasets);
|
|
26231
26222
|
};
|
|
26232
26223
|
const WORD_SEPARATOR = " ";
|
|
26233
26224
|
const SEMI_TRANSPARENT = "rgba(0, 0, 0, 0.5)";
|