@mui/x-charts 8.5.1 → 8.5.3
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/CHANGELOG.md +187 -10
- package/ChartsGrid/ChartsHorizontalGrid.js +1 -1
- package/ChartsGrid/ChartsVerticalGrid.js +1 -1
- package/ChartsLegend/ChartsLegend.d.ts +1 -0
- package/ChartsLegend/ChartsLegend.js +1 -0
- package/ChartsLegend/ContinuousColorLegend.d.ts +1 -0
- package/ChartsLegend/PiecewiseColorLegend.d.ts +1 -0
- package/ChartsLegend/chartsLegendClasses.d.ts +3 -1
- package/ChartsLegend/chartsLegendClasses.js +2 -1
- package/ChartsSurface/ChartsSurface.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/RadarChart/index.d.ts +1 -1
- package/ScatterChart/Scatter.d.ts +2 -0
- package/ScatterChart/Scatter.js +9 -1
- package/ScatterChart/index.d.ts +3 -1
- package/ScatterChart/index.js +16 -1
- package/ScatterChart/scatterClasses.d.ts +8 -0
- package/ScatterChart/scatterClasses.js +22 -0
- package/Toolbar/Toolbar.js +1 -0
- package/esm/ChartsGrid/ChartsHorizontalGrid.js +1 -1
- package/esm/ChartsGrid/ChartsVerticalGrid.js +1 -1
- package/esm/ChartsLegend/ChartsLegend.d.ts +1 -0
- package/esm/ChartsLegend/ChartsLegend.js +1 -0
- package/esm/ChartsLegend/ContinuousColorLegend.d.ts +1 -0
- package/esm/ChartsLegend/PiecewiseColorLegend.d.ts +1 -0
- package/esm/ChartsLegend/chartsLegendClasses.d.ts +3 -1
- package/esm/ChartsLegend/chartsLegendClasses.js +2 -1
- package/esm/ChartsSurface/ChartsSurface.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/esm/RadarChart/index.d.ts +1 -1
- package/esm/ScatterChart/Scatter.d.ts +2 -0
- package/esm/ScatterChart/Scatter.js +9 -1
- package/esm/ScatterChart/index.d.ts +3 -1
- package/esm/ScatterChart/index.js +2 -1
- package/esm/ScatterChart/scatterClasses.d.ts +8 -0
- package/esm/ScatterChart/scatterClasses.js +13 -0
- package/esm/Toolbar/Toolbar.js +1 -0
- package/esm/hooks/useItemHighlighted.js +2 -2
- package/esm/index.js +1 -1
- package/esm/internals/createSeriesSelectorOfType.js +2 -2
- package/esm/internals/defaultValueFormatters.d.ts +6 -0
- package/esm/internals/defaultValueFormatters.js +15 -0
- package/esm/internals/index.d.ts +5 -0
- package/esm/internals/index.js +5 -0
- package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +3 -29
- package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.js +1 -1
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +14 -724
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +10 -10
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +3 -29
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +1 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +6 -54
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +12 -208
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +7 -66
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +2 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +21 -6222
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +4 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +50 -5
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +18 -622
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +3 -3
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +18 -230
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +6 -6
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +17 -2012
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +39 -4
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +3 -27
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +1 -1
- package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +5 -40
- package/esm/internals/plugins/models/seriesConfig/colorProcessor.types.d.ts +5 -0
- package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +3 -2
- package/esm/internals/plugins/utils/selectors.d.ts +18 -6
- package/esm/internals/plugins/utils/selectors.js +3 -3
- package/esm/internals/store/useSelector.d.ts +2 -2
- package/esm/internals/store/useSelector.js +5 -3
- package/esm/models/axis.d.ts +3 -2
- package/esm/models/index.d.ts +1 -1
- package/hooks/useItemHighlighted.js +2 -2
- package/index.js +1 -1
- package/internals/createSeriesSelectorOfType.js +2 -2
- package/internals/defaultValueFormatters.d.ts +6 -0
- package/internals/defaultValueFormatters.js +21 -0
- package/internals/index.d.ts +5 -0
- package/internals/index.js +52 -0
- package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +3 -29
- package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.js +1 -1
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +14 -724
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +11 -10
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +3 -29
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +1 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +6 -54
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +12 -208
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +7 -66
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +4 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +21 -6222
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +4 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +50 -5
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +18 -622
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +3 -3
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +18 -230
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +6 -6
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +17 -2012
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +39 -4
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +3 -27
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +1 -1
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +5 -40
- package/internals/plugins/models/seriesConfig/colorProcessor.types.d.ts +5 -0
- package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +3 -2
- package/internals/plugins/utils/selectors.d.ts +18 -6
- package/internals/plugins/utils/selectors.js +3 -3
- package/internals/store/useSelector.d.ts +2 -2
- package/internals/store/useSelector.js +6 -3
- package/models/axis.d.ts +3 -2
- package/models/index.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { UseChartVoronoiSignature } from "./useChartVoronoi.types.js";
|
|
3
|
-
export declare const selectorChartsVoronoiIsVoronoiEnabled: ((state: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./useChartVoronoi.types.js").UseChartVoronoiState & Partial<{}> & {
|
|
1
|
+
export declare const selectorChartsVoronoiIsVoronoiEnabled: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./useChartVoronoi.types.js").UseChartVoronoiState & Partial<{}> & {
|
|
4
2
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
|
-
}) => boolean | undefined) & {
|
|
6
|
-
clearCache: () => void;
|
|
7
|
-
resultsCount: () => number;
|
|
8
|
-
resetResultsCount: () => void;
|
|
9
3
|
} & {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}) => boolean | undefined;
|
|
13
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
14
|
-
isVoronoiEnabled?: boolean;
|
|
15
|
-
}) => boolean | undefined) & {
|
|
16
|
-
clearCache: () => void;
|
|
17
|
-
resultsCount: () => number;
|
|
18
|
-
resetResultsCount: () => void;
|
|
19
|
-
};
|
|
20
|
-
lastResult: () => boolean | undefined;
|
|
21
|
-
dependencies: [ChartRootSelector<UseChartVoronoiSignature>];
|
|
22
|
-
recomputations: () => number;
|
|
23
|
-
resetRecomputations: () => void;
|
|
24
|
-
dependencyRecomputations: () => number;
|
|
25
|
-
resetDependencyRecomputations: () => void;
|
|
26
|
-
} & {
|
|
27
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
28
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
29
|
-
};
|
|
4
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
|
+
}, boolean | undefined, any[]>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createSelector } from "../../utils/selectors.js";
|
|
2
2
|
const selectVoronoi = state => state.voronoi;
|
|
3
|
-
export const selectorChartsVoronoiIsVoronoiEnabled = createSelector(selectVoronoi, voronoi => voronoi?.isVoronoiEnabled);
|
|
3
|
+
export const selectorChartsVoronoiIsVoronoiEnabled = createSelector([selectVoronoi], voronoi => voronoi?.isVoronoiEnabled);
|
|
@@ -1,45 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { UseChartZAxisSignature } from "./useChartZAxis.types.js";
|
|
3
|
-
export declare const selectorChartZAxis: ((state: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./useChartZAxis.types.js").UseChartZAxisState & Partial<{}> & {
|
|
1
|
+
export declare const selectorChartZAxis: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./useChartZAxis.types.js").UseChartZAxisState & Partial<{}> & {
|
|
4
2
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
|
-
}
|
|
3
|
+
} & {
|
|
4
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
|
+
}, {
|
|
6
6
|
axis: {
|
|
7
7
|
[axisId: string]: import("../../../index.js").ZAxisDefaultized;
|
|
8
8
|
};
|
|
9
9
|
axisIds: import("../../../index.js").AxisId[];
|
|
10
|
-
}
|
|
11
|
-
clearCache: () => void;
|
|
12
|
-
resultsCount: () => number;
|
|
13
|
-
resetResultsCount: () => void;
|
|
14
|
-
} & {
|
|
15
|
-
resultFunc: (resultFuncArgs_0: ChartState<[UseChartZAxisSignature]>) => {
|
|
16
|
-
axis: {
|
|
17
|
-
[axisId: string]: import("../../../index.js").ZAxisDefaultized;
|
|
18
|
-
};
|
|
19
|
-
axisIds: import("../../../index.js").AxisId[];
|
|
20
|
-
};
|
|
21
|
-
memoizedResultFunc: ((resultFuncArgs_0: ChartState<[UseChartZAxisSignature]>) => {
|
|
22
|
-
axis: {
|
|
23
|
-
[axisId: string]: import("../../../index.js").ZAxisDefaultized;
|
|
24
|
-
};
|
|
25
|
-
axisIds: import("../../../index.js").AxisId[];
|
|
26
|
-
}) & {
|
|
27
|
-
clearCache: () => void;
|
|
28
|
-
resultsCount: () => number;
|
|
29
|
-
resetResultsCount: () => void;
|
|
30
|
-
};
|
|
31
|
-
lastResult: () => {
|
|
32
|
-
axis: {
|
|
33
|
-
[axisId: string]: import("../../../index.js").ZAxisDefaultized;
|
|
34
|
-
};
|
|
35
|
-
axisIds: import("../../../index.js").AxisId[];
|
|
36
|
-
};
|
|
37
|
-
dependencies: [(state: ChartState<[UseChartZAxisSignature]>) => ChartState<[UseChartZAxisSignature]>];
|
|
38
|
-
recomputations: () => number;
|
|
39
|
-
resetRecomputations: () => void;
|
|
40
|
-
dependencyRecomputations: () => number;
|
|
41
|
-
resetDependencyRecomputations: () => void;
|
|
42
|
-
} & {
|
|
43
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
44
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
45
|
-
};
|
|
10
|
+
}, []>;
|
|
@@ -10,5 +10,10 @@ export type ColorGetter<TSeriesType extends ChartSeriesType> = TSeriesType exten
|
|
|
10
10
|
/**
|
|
11
11
|
* Transforms charts config to a color getter.
|
|
12
12
|
* If dataIndex is not defined, it falls back to the series color.
|
|
13
|
+
* @param {DefaultizedSeriesType<TSeriesType>} series - The series configuration.
|
|
14
|
+
* @param {ComputedXAxis | undefined} xAxis - The computed x-axis configuration.
|
|
15
|
+
* @param {ComputedYAxis | undefined} yAxis - The computed y-axis configuration.
|
|
16
|
+
* @param {ZAxisDefaultized | undefined} zAxis - The defaulted z-axis configuration.
|
|
17
|
+
* @returns {ColorGetter<TSeriesType>} A function that takes a data index and returns a color string.
|
|
13
18
|
*/
|
|
14
19
|
export type ColorProcessor<TSeriesType extends ChartSeriesType> = (series: DefaultizedSeriesType<TSeriesType>, xAxis?: ComputedXAxis, yAxis?: ComputedYAxis, zAxis?: ZAxisDefaultized) => ColorGetter<TSeriesType>;
|
|
@@ -62,9 +62,10 @@ export type TooltipGetter<TSeriesType extends ChartSeriesType> = (params: {
|
|
|
62
62
|
identifier: ChartItemIdentifier<TSeriesType> | null;
|
|
63
63
|
}) => (TSeriesType extends 'radar' ? ItemTooltipWithMultipleValues<TSeriesType> : ItemTooltip<TSeriesType>) | null;
|
|
64
64
|
/**
|
|
65
|
-
* Return an array of the axes that should trigger the tooltip.
|
|
66
|
-
*
|
|
67
65
|
* If `axisId` is set to undefined, the default axis will be used.
|
|
66
|
+
*
|
|
67
|
+
* @param {Record<SeriesId, ChartSeriesDefaultized<TSeriesType>>} series A map of series ID to their series configuration.
|
|
68
|
+
* @returns {{ direction: Directions; axisId: AxisId | undefined }[]} an array of the axes that should trigger the tooltip.
|
|
68
69
|
*/
|
|
69
70
|
export type AxisTooltipGetter<TSeriesType extends ChartSeriesType, Directions extends 'x' | 'y' | 'rotation' | 'radius' = 'x' | 'y'> = (series: Record<SeriesId, ChartSeriesDefaultized<TSeriesType>>) => {
|
|
70
71
|
direction: Directions;
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ChartAnyPluginSignature, ChartState } from "../models/index.js";
|
|
3
|
-
export type ChartRootSelector<TSignature extends ChartAnyPluginSignature> = <
|
|
4
|
-
export type ChartOptionalRootSelector<TSignature extends ChartAnyPluginSignature> = <
|
|
5
|
-
export type ChartsSelector<
|
|
1
|
+
import { SelectorArray, Combiner, Selector, GetStateFromSelectors, GetParamsFromSelectors, CreateSelectorOptions } from 'reselect';
|
|
2
|
+
import { ChartAnyPluginSignature, ChartState, ChartStateCacheKey } from "../models/index.js";
|
|
3
|
+
export type ChartRootSelector<TSignature extends ChartAnyPluginSignature> = Selector<ChartState<[TSignature]>, TSignature['state'][keyof TSignature['state']]>;
|
|
4
|
+
export type ChartOptionalRootSelector<TSignature extends ChartAnyPluginSignature> = Selector<ChartState<[], [TSignature]>, TSignature['state'][keyof TSignature['state']] | undefined>;
|
|
5
|
+
export type ChartsSelector<Signatures extends readonly ChartAnyPluginSignature[] = [], OptionalSignatures extends readonly ChartAnyPluginSignature[] = [], Result = unknown, Args extends readonly any[] = []> = Selector<ChartState<Signatures, OptionalSignatures>, Result, Args>;
|
|
6
|
+
type InterruptRecursion = NonNullable<unknown>;
|
|
7
|
+
type AnyFunction = (...args: any[]) => any;
|
|
8
|
+
export type Simplify<T> = T extends AnyFunction ? T : { [KeyType in keyof T]: T[KeyType] } & NonNullable<unknown>;
|
|
6
9
|
/**
|
|
7
10
|
* Method wrapping reselect's createSelector to provide caching for chart instances.
|
|
8
11
|
*
|
|
9
12
|
*/
|
|
10
|
-
export declare const createSelector:
|
|
13
|
+
export declare const createSelector: <InputSelectors extends SelectorArray<any>, Result>(...createSelectorArgs: [inputSelectors: [...InputSelectors], combiner: Combiner<InputSelectors, Result>, createSelectorOptions?: Simplify<CreateSelectorOptions<any,
|
|
14
|
+
// MemoizeFunction,
|
|
15
|
+
any,
|
|
16
|
+
// ArgsMemoizeFunction,
|
|
17
|
+
any,
|
|
18
|
+
// OverrideMemoizeFunction,
|
|
19
|
+
any>>]) => Selector<GetStateFromSelectors<InputSelectors> & {
|
|
20
|
+
cacheKey: ChartStateCacheKey;
|
|
21
|
+
}, Result, GetParamsFromSelectors<InputSelectors> & InterruptRecursion>;
|
|
22
|
+
export {};
|
|
@@ -12,7 +12,7 @@ const cache = new WeakMap();
|
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
14
|
export const createSelector = (...createSelectorArgs) => {
|
|
15
|
-
const selector = (state, selectorArgs) => {
|
|
15
|
+
const selector = (state, ...selectorArgs) => {
|
|
16
16
|
const cacheKey = state.cacheKey;
|
|
17
17
|
|
|
18
18
|
// If there is no cache for the current chart instance, create one.
|
|
@@ -25,13 +25,13 @@ export const createSelector = (...createSelectorArgs) => {
|
|
|
25
25
|
// If there is a cached selector, execute it.
|
|
26
26
|
const cachedSelector = cacheForCurrentChartInstance.get(createSelectorArgs);
|
|
27
27
|
if (cachedSelector) {
|
|
28
|
-
return cachedSelector(state, selectorArgs);
|
|
28
|
+
return cachedSelector(state, ...selectorArgs);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// Otherwise, create a new selector and cache it and execute it.
|
|
32
32
|
const fn = reselectCreateSelector(...createSelectorArgs);
|
|
33
33
|
cacheForCurrentChartInstance.set(createSelectorArgs, fn);
|
|
34
|
-
return fn(state, selectorArgs);
|
|
34
|
+
return fn(state, ...selectorArgs);
|
|
35
35
|
};
|
|
36
36
|
return selector;
|
|
37
37
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChartAnyPluginSignature
|
|
1
|
+
import { ChartAnyPluginSignature } from "../plugins/models/index.js";
|
|
2
2
|
import { ChartsSelector } from "../plugins/utils/selectors.js";
|
|
3
3
|
import { ChartStore } from "../plugins/utils/ChartStore.js";
|
|
4
|
-
export declare const useSelector: <TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[], TArgs,
|
|
4
|
+
export declare const useSelector: <TSignatures extends readonly ChartAnyPluginSignature[], TOptionalSignatures extends readonly ChartAnyPluginSignature[], TArgs extends readonly any[], TResult = unknown>(store: ChartStore<TSignatures, TOptionalSignatures>, selector: ChartsSelector<TSignatures, TOptionalSignatures, TResult, TArgs>, args?: [TArgs] extends [never] ? [] : TArgs, equals?: (a: TResult, b: TResult) => boolean) => TResult;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
/* We need to import the shim because React 17 does not support the `useSyncExternalStore` API.
|
|
2
|
+
* More info: https://github.com/mui/mui-x/issues/18303#issuecomment-2958392341 */
|
|
3
|
+
import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';
|
|
2
4
|
const defaultCompare = Object.is;
|
|
3
|
-
export const useSelector = (store, selector, args =
|
|
4
|
-
const selectorWithArgs = state => selector(state, args);
|
|
5
|
+
export const useSelector = (store, selector, args = [], equals = defaultCompare) => {
|
|
6
|
+
const selectorWithArgs = state => selector(state, ...args);
|
|
5
7
|
return useSyncExternalStoreWithSelector(store.subscribe, store.getSnapshot, store.getSnapshot, selectorWithArgs, equals);
|
|
6
8
|
};
|
package/esm/models/axis.d.ts
CHANGED
|
@@ -272,15 +272,16 @@ export type AxisValueFormatterContext<S extends ScaleName = ScaleName> = {
|
|
|
272
272
|
* - `'legend'` The value is displayed in the legend when using color legend.
|
|
273
273
|
* - `'zoom-slider-tooltip'` The value is displayed in the zoom slider tooltip.
|
|
274
274
|
*/
|
|
275
|
-
location: 'legend'
|
|
275
|
+
location: 'legend';
|
|
276
276
|
} | {
|
|
277
277
|
/**
|
|
278
278
|
* Location indicates where the value will be displayed.
|
|
279
279
|
* - `'tick'` The value is displayed on the axis ticks.
|
|
280
280
|
* - `'tooltip'` The value is displayed in the tooltip when hovering the chart.
|
|
281
281
|
* - `'legend'` The value is displayed in the legend when using color legend.
|
|
282
|
+
* - `'zoom-slider-tooltip'` The value is displayed in the zoom slider tooltip.
|
|
282
283
|
*/
|
|
283
|
-
location: 'tick' | 'tooltip';
|
|
284
|
+
location: 'tick' | 'tooltip' | 'zoom-slider-tooltip';
|
|
284
285
|
/**
|
|
285
286
|
* The d3-scale instance associated to the axis.
|
|
286
287
|
*/
|
package/esm/models/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from "./seriesType/index.js";
|
|
2
2
|
export * from "./stacking.js";
|
|
3
3
|
export * from "./slots/index.js";
|
|
4
|
-
export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis } from "./axis.js";
|
|
4
|
+
export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis, AxisValueFormatterContext } from "./axis.js";
|
|
5
5
|
export type { PropsFromSlot } from '@mui/x-internals/slots';
|
|
6
6
|
export type { Position } from "./position.js";
|
|
7
7
|
export type { CurveType } from "./curve.js";
|
|
@@ -19,8 +19,8 @@ var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHi
|
|
|
19
19
|
*/
|
|
20
20
|
function useItemHighlighted(item) {
|
|
21
21
|
const store = (0, _useStore.useStore)();
|
|
22
|
-
const isHighlighted = (0, _useSelector.useSelector)(store, _useChartHighlight.selectorChartsIsHighlighted, item);
|
|
23
|
-
const isFaded = (0, _useSelector.useSelector)(store, _useChartHighlight.selectorChartsIsFaded, item);
|
|
22
|
+
const isHighlighted = (0, _useSelector.useSelector)(store, _useChartHighlight.selectorChartsIsHighlighted, [item]);
|
|
23
|
+
const isFaded = (0, _useSelector.useSelector)(store, _useChartHighlight.selectorChartsIsFaded, [item]);
|
|
24
24
|
return {
|
|
25
25
|
isHighlighted,
|
|
26
26
|
isFaded: !isHighlighted && isFaded
|
package/index.js
CHANGED
|
@@ -38,11 +38,11 @@ function createSeriesSelectorsOfType(seriesType) {
|
|
|
38
38
|
});
|
|
39
39
|
return ids => {
|
|
40
40
|
const store = (0, _useStore.useStore)();
|
|
41
|
-
return (0, _useSelector.useSelector)(store, selectorSeriesWithIds, ids, _fastArrayCompare.fastArrayCompare);
|
|
41
|
+
return (0, _useSelector.useSelector)(store, selectorSeriesWithIds, [ids], _fastArrayCompare.fastArrayCompare);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
function createAllSeriesSelectorOfType(seriesType) {
|
|
45
|
-
const selectorSeries = (0, _selectors.createSelector)(_useChartSeries.selectorChartSeriesProcessed, processedSeries => processedSeries[seriesType]);
|
|
45
|
+
const selectorSeries = (0, _selectors.createSelector)([_useChartSeries.selectorChartSeriesProcessed], processedSeries => processedSeries[seriesType]);
|
|
46
46
|
return () => {
|
|
47
47
|
const store = (0, _useStore.useStore)();
|
|
48
48
|
return (0, _useSelector.useSelector)(store, selectorSeries);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AxisValueFormatterContext, ContinuousScaleName, D3ContinuousScale } from "../models/axis.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a default formatter function for continuous scales (e.g., linear, sqrt, log).
|
|
4
|
+
* @returns A formatter function for continuous values.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createScalarFormatter(tickNumber: number, zoomScale: D3ContinuousScale): <S extends ContinuousScaleName = ContinuousScaleName>(value: any, context: AxisValueFormatterContext<S>) => string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createScalarFormatter = createScalarFormatter;
|
|
7
|
+
/**
|
|
8
|
+
* Creates a default formatter function for continuous scales (e.g., linear, sqrt, log).
|
|
9
|
+
* @returns A formatter function for continuous values.
|
|
10
|
+
*/
|
|
11
|
+
function createScalarFormatter(tickNumber, zoomScale) {
|
|
12
|
+
return function defaultScalarValueFormatter(value, context) {
|
|
13
|
+
if (context.location === 'tick') {
|
|
14
|
+
return context.scale.tickFormat(tickNumber)(value);
|
|
15
|
+
}
|
|
16
|
+
if (context.location === 'zoom-slider-tooltip') {
|
|
17
|
+
return zoomScale.tickFormat(2)(value);
|
|
18
|
+
}
|
|
19
|
+
return `${value}`;
|
|
20
|
+
};
|
|
21
|
+
}
|
package/internals/index.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export * from "./plugins/featurePlugins/useChartInteraction/index.js";
|
|
|
21
21
|
export * from "./plugins/featurePlugins/useChartHighlight/index.js";
|
|
22
22
|
export * from "./plugins/featurePlugins/useChartVoronoi/index.js";
|
|
23
23
|
export * from "./plugins/utils/selectors.js";
|
|
24
|
+
export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js";
|
|
25
|
+
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
|
|
24
26
|
export * from "./store/useCharts.js";
|
|
25
27
|
export * from "./store/useStore.js";
|
|
26
28
|
export * from "./store/useSelector.js";
|
|
@@ -40,8 +42,11 @@ export * from "./getCurve.js";
|
|
|
40
42
|
export * from "./consumeSlots.js";
|
|
41
43
|
export * from "./consumeThemeProps.js";
|
|
42
44
|
export * from "./defaultizeMargin.js";
|
|
45
|
+
export * from "./colorScale.js";
|
|
46
|
+
export * from "./ticks.js";
|
|
43
47
|
export * from "./dateHelpers.js";
|
|
44
48
|
export * from "./invertScale.js";
|
|
49
|
+
export * from "./isBandScale.js";
|
|
45
50
|
export { getAxisExtremum } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js";
|
|
46
51
|
export * from "../context/ChartProvider/index.js";
|
|
47
52
|
export * from "../context/ChartsSlotsContext.js";
|
package/internals/index.js
CHANGED
|
@@ -11,6 +11,8 @@ var _exportNames = {
|
|
|
11
11
|
useLineChartProps: true,
|
|
12
12
|
useBarChartProps: true,
|
|
13
13
|
useRadarChartProps: true,
|
|
14
|
+
getCartesianAxisTriggerTooltip: true,
|
|
15
|
+
getCartesianAxisIndex: true,
|
|
14
16
|
getAxisExtremum: true
|
|
15
17
|
};
|
|
16
18
|
Object.defineProperty(exports, "getAxisExtremum", {
|
|
@@ -19,6 +21,18 @@ Object.defineProperty(exports, "getAxisExtremum", {
|
|
|
19
21
|
return _getAxisExtremum.getAxisExtremum;
|
|
20
22
|
}
|
|
21
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "getCartesianAxisIndex", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _getAxisValue.getAxisIndex;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "getCartesianAxisTriggerTooltip", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _getAxisTriggerTooltip.getAxisTriggerTooltip;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
22
36
|
Object.defineProperty(exports, "useBarChartProps", {
|
|
23
37
|
enumerable: true,
|
|
24
38
|
get: function () {
|
|
@@ -260,6 +274,8 @@ Object.keys(_selectors).forEach(function (key) {
|
|
|
260
274
|
}
|
|
261
275
|
});
|
|
262
276
|
});
|
|
277
|
+
var _getAxisTriggerTooltip = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip");
|
|
278
|
+
var _getAxisValue = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisValue");
|
|
263
279
|
var _useCharts = require("./store/useCharts");
|
|
264
280
|
Object.keys(_useCharts).forEach(function (key) {
|
|
265
281
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -488,6 +504,30 @@ Object.keys(_defaultizeMargin).forEach(function (key) {
|
|
|
488
504
|
}
|
|
489
505
|
});
|
|
490
506
|
});
|
|
507
|
+
var _colorScale = require("./colorScale");
|
|
508
|
+
Object.keys(_colorScale).forEach(function (key) {
|
|
509
|
+
if (key === "default" || key === "__esModule") return;
|
|
510
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
511
|
+
if (key in exports && exports[key] === _colorScale[key]) return;
|
|
512
|
+
Object.defineProperty(exports, key, {
|
|
513
|
+
enumerable: true,
|
|
514
|
+
get: function () {
|
|
515
|
+
return _colorScale[key];
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
});
|
|
519
|
+
var _ticks = require("./ticks");
|
|
520
|
+
Object.keys(_ticks).forEach(function (key) {
|
|
521
|
+
if (key === "default" || key === "__esModule") return;
|
|
522
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
523
|
+
if (key in exports && exports[key] === _ticks[key]) return;
|
|
524
|
+
Object.defineProperty(exports, key, {
|
|
525
|
+
enumerable: true,
|
|
526
|
+
get: function () {
|
|
527
|
+
return _ticks[key];
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
});
|
|
491
531
|
var _dateHelpers = require("./dateHelpers");
|
|
492
532
|
Object.keys(_dateHelpers).forEach(function (key) {
|
|
493
533
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -512,6 +552,18 @@ Object.keys(_invertScale).forEach(function (key) {
|
|
|
512
552
|
}
|
|
513
553
|
});
|
|
514
554
|
});
|
|
555
|
+
var _isBandScale = require("./isBandScale");
|
|
556
|
+
Object.keys(_isBandScale).forEach(function (key) {
|
|
557
|
+
if (key === "default" || key === "__esModule") return;
|
|
558
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
559
|
+
if (key in exports && exports[key] === _isBandScale[key]) return;
|
|
560
|
+
Object.defineProperty(exports, key, {
|
|
561
|
+
enumerable: true,
|
|
562
|
+
get: function () {
|
|
563
|
+
return _isBandScale[key];
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
});
|
|
515
567
|
var _getAxisExtremum = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum");
|
|
516
568
|
var _ChartProvider = require("../context/ChartProvider");
|
|
517
569
|
Object.keys(_ChartProvider).forEach(function (key) {
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import type { UseChartAnimationSignature } from "./useChartAnimation.types.js";
|
|
3
|
-
export declare const selectorChartSkipAnimation: ((state: import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("./useChartAnimation.types.js").UseChartAnimationState & Partial<{}> & {
|
|
1
|
+
export declare const selectorChartSkipAnimation: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("./useChartAnimation.types.js").UseChartAnimationState & Partial<{}> & {
|
|
4
2
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
|
-
}) => boolean) & {
|
|
6
|
-
clearCache: () => void;
|
|
7
|
-
resultsCount: () => number;
|
|
8
|
-
resetResultsCount: () => void;
|
|
9
3
|
} & {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
skipAnimationRequests: number;
|
|
13
|
-
}) => boolean;
|
|
14
|
-
memoizedResultFunc: ((resultFuncArgs_0: {
|
|
15
|
-
skip: boolean;
|
|
16
|
-
skipAnimationRequests: number;
|
|
17
|
-
}) => boolean) & {
|
|
18
|
-
clearCache: () => void;
|
|
19
|
-
resultsCount: () => number;
|
|
20
|
-
resetResultsCount: () => void;
|
|
21
|
-
};
|
|
22
|
-
lastResult: () => boolean;
|
|
23
|
-
dependencies: [ChartRootSelector<UseChartAnimationSignature>];
|
|
24
|
-
recomputations: () => number;
|
|
25
|
-
resetRecomputations: () => void;
|
|
26
|
-
dependencyRecomputations: () => number;
|
|
27
|
-
resetDependencyRecomputations: () => void;
|
|
28
|
-
} & {
|
|
29
|
-
memoize: typeof import("reselect").weakMapMemoize;
|
|
30
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
31
|
-
};
|
|
4
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
5
|
+
}, boolean, any[]>;
|
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.selectorChartSkipAnimation = void 0;
|
|
7
7
|
var _selectors = require("../../utils/selectors");
|
|
8
8
|
const selectorChartAnimationState = state => state.animation;
|
|
9
|
-
const selectorChartSkipAnimation = exports.selectorChartSkipAnimation = (0, _selectors.createSelector)(selectorChartAnimationState, state => state.skip || state.skipAnimationRequests > 0);
|
|
9
|
+
const selectorChartSkipAnimation = exports.selectorChartSkipAnimation = (0, _selectors.createSelector)([selectorChartAnimationState], state => state.skip || state.skipAnimationRequests > 0);
|