@mui/x-charts 8.13.0 → 8.14.0
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/BarChart/BarChart.js +44 -36
- package/CHANGELOG.md +171 -1
- package/ChartContainer/ChartContainer.js +68 -56
- package/ChartsTooltip/ChartsTooltipContainer.js +2 -0
- package/ChartsXAxis/useAxisTicksProps.d.ts +197 -355
- package/ChartsYAxis/useAxisTicksProps.d.ts +197 -355
- package/LineChart/LineChart.js +44 -36
- package/PieChart/PieArc.d.ts +18 -4
- package/PieChart/PieArc.js +11 -5
- package/PieChart/PieArcPlot.js +3 -1
- package/ScatterChart/ScatterChart.js +44 -36
- package/SparkLineChart/SparkLineChart.js +44 -36
- package/esm/BarChart/BarChart.js +44 -36
- package/esm/ChartContainer/ChartContainer.js +68 -56
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +2 -0
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +197 -355
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +197 -355
- package/esm/LineChart/LineChart.js +44 -36
- package/esm/PieChart/PieArc.d.ts +18 -4
- package/esm/PieChart/PieArc.js +11 -5
- package/esm/PieChart/PieArcPlot.js +3 -1
- package/esm/ScatterChart/ScatterChart.js +44 -36
- package/esm/SparkLineChart/SparkLineChart.js +44 -36
- package/esm/hooks/animation/useAnimate.js +5 -3
- package/esm/hooks/useScale.d.ts +5 -1
- package/esm/index.js +1 -1
- package/esm/internals/animation/useAnimateInternal.d.ts +1 -1
- package/esm/internals/animation/useAnimateInternal.js +1 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +8 -8
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +4 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +9 -11
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -28
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +4 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +3 -24
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/domain.d.ts +20 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/domain.js +77 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +4 -65
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +7 -104
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +31 -39
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +166 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +158 -47
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +10 -3
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +3 -2
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.types.d.ts +6 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +5 -1
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +9 -1
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +10 -1
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +2 -1
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -2
- package/esm/internals/scaleGuards.d.ts +12 -6
- package/esm/internals/symlogScale.js +5 -0
- package/esm/locales/enUS.js +4 -4
- package/esm/locales/ptBR.js +97 -99
- package/esm/models/axis.d.ts +39 -17
- package/esm/models/axis.js +3 -0
- package/hooks/animation/useAnimate.js +4 -3
- package/hooks/useScale.d.ts +5 -1
- package/index.js +1 -1
- package/internals/animation/useAnimateInternal.d.ts +1 -1
- package/internals/animation/useAnimateInternal.js +1 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +7 -7
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +4 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +9 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -28
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +4 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +3 -25
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.d.ts +20 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.js +84 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +4 -65
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +8 -108
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +29 -37
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +166 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +158 -47
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +10 -3
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +3 -2
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.types.d.ts +6 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +5 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +9 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +11 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -1
- package/internals/scaleGuards.d.ts +12 -6
- package/internals/symlogScale.js +5 -0
- package/locales/enUS.js +4 -4
- package/locales/ptBR.js +97 -99
- package/models/axis.d.ts +39 -17
- package/models/axis.js +4 -0
- package/package.json +6 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { NumberValue } from '@mui/x-charts-vendor/d3-scale';
|
|
1
2
|
import { ZoomData } from "./zoom.types.js";
|
|
2
|
-
import { AxisId } from "../../../../models/axis.js";
|
|
3
|
+
import { AxisId, D3Scale } from "../../../../models/axis.js";
|
|
3
4
|
export declare const createZoomMap: (zoom: readonly ZoomData[]) => Map<AxisId, ZoomData>;
|
|
4
5
|
/**
|
|
5
6
|
* Following selectors are not exported because they exist in the MIT chart only to ba able to reuse the Zoom state from the pro.
|
|
@@ -33,21 +34,55 @@ export declare const selectorDefaultYAxisTickNumber: import("reselect").Selector
|
|
|
33
34
|
} & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
34
35
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
35
36
|
}, number, []>;
|
|
36
|
-
|
|
37
|
+
type DomainDefinition = {
|
|
38
|
+
domain: ReadonlyArray<string | NumberValue>;
|
|
39
|
+
tickNumber?: number;
|
|
40
|
+
};
|
|
41
|
+
export declare const selectorChartXDomains: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
37
42
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
38
43
|
} & Partial<{}> & {
|
|
39
44
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
40
|
-
}, Record<AxisId,
|
|
41
|
-
export declare const
|
|
45
|
+
}, Record<AxisId, DomainDefinition>, []>;
|
|
46
|
+
export declare const selectorChartYDomains: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
42
47
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
43
48
|
} & Partial<{}> & {
|
|
44
49
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
45
|
-
}, Record<AxisId,
|
|
50
|
+
}, Record<AxisId, DomainDefinition>, []>;
|
|
46
51
|
export declare const selectorChartZoomAxisFilters: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
47
52
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
48
53
|
} & {
|
|
49
54
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
50
55
|
} & Partial<{}>, import("./zoom.types.js").GetZoomAxisFilters | undefined, []>;
|
|
56
|
+
export declare const selectorChartFilteredXDomains: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
57
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
58
|
+
} & Partial<{}> & {
|
|
59
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
60
|
+
}, Record<AxisId, readonly (string | NumberValue)[]>, []>;
|
|
61
|
+
export declare const selectorChartFilteredYDomains: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
62
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
63
|
+
} & Partial<{}> & {
|
|
64
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
65
|
+
}, Record<AxisId, readonly (string | NumberValue)[]>, []>;
|
|
66
|
+
export declare const selectorChartNormalizedXScales: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
67
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
68
|
+
} & Partial<{}> & {
|
|
69
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
70
|
+
}, Record<AxisId, D3Scale>, []>;
|
|
71
|
+
export declare const selectorChartNormalizedYScales: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
72
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
73
|
+
} & Partial<{}> & {
|
|
74
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
75
|
+
}, Record<AxisId, D3Scale>, []>;
|
|
76
|
+
export declare const selectorChartXScales: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
77
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
78
|
+
} & Partial<{}> & {
|
|
79
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
80
|
+
}, Record<AxisId, D3Scale>, []>;
|
|
81
|
+
export declare const selectorChartYScales: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
82
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
83
|
+
} & Partial<{}> & {
|
|
84
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
85
|
+
}, Record<AxisId, D3Scale>, []>;
|
|
51
86
|
/**
|
|
52
87
|
* The only interesting selectors that merge axis data and zoom if provided.
|
|
53
88
|
*/
|
|
@@ -62,4 +97,129 @@ export declare const selectorChartYAxis: import("reselect").Selector<import("../
|
|
|
62
97
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
63
98
|
}, import("./computeAxisValue.js").ComputeResult<import("../../../index.js").ChartsYAxisProps>, []>;
|
|
64
99
|
export declare const selectorChartAxis: import("reselect").Selector<any, import("../../../index.js").ComputedAxis<keyof import("../../../index.js").AxisScaleConfig, any, import("../../../index.js").ChartsXAxisProps>, [axisId: AxisId]>;
|
|
65
|
-
export declare const selectorChartRawAxis: import("reselect").Selector<any,
|
|
100
|
+
export declare const selectorChartRawAxis: import("reselect").Selector<any, ({
|
|
101
|
+
offset?: number;
|
|
102
|
+
} & {
|
|
103
|
+
id: AxisId;
|
|
104
|
+
data?: readonly any[] | undefined;
|
|
105
|
+
dataKey?: string;
|
|
106
|
+
valueFormatter?: (<TScaleName extends keyof import("../../../index.js").AxisScaleConfig>(value: any, context: import("../../../index.js").AxisValueFormatterContext<TScaleName>) => string) | undefined;
|
|
107
|
+
hideTooltip?: boolean;
|
|
108
|
+
reverse?: boolean;
|
|
109
|
+
domainLimit?: "nice" | "strict" | ((min: number, max: number) => {
|
|
110
|
+
min: number;
|
|
111
|
+
max: number;
|
|
112
|
+
});
|
|
113
|
+
ignoreTooltip?: boolean;
|
|
114
|
+
} & Omit<Partial<import("../../../index.js").ChartsXAxisProps>, "axisId"> & Partial<Omit<{
|
|
115
|
+
scaleType: "time";
|
|
116
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleTime<number, number>;
|
|
117
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
118
|
+
} | {
|
|
119
|
+
scaleType: "linear";
|
|
120
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleLinear<number, number>;
|
|
121
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
122
|
+
} | {
|
|
123
|
+
scaleType: "log";
|
|
124
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleLogarithmic<number, number>;
|
|
125
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
126
|
+
} | {
|
|
127
|
+
scaleType: "symlog";
|
|
128
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleSymLog<number, number>;
|
|
129
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
130
|
+
constant?: number;
|
|
131
|
+
} | {
|
|
132
|
+
scaleType: "pow";
|
|
133
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePower<number, number>;
|
|
134
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
135
|
+
} | {
|
|
136
|
+
scaleType: "sqrt";
|
|
137
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePower<number, number>;
|
|
138
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
139
|
+
} | {
|
|
140
|
+
scaleType: "utc";
|
|
141
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleTime<number, number>;
|
|
142
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
143
|
+
} | ({
|
|
144
|
+
scaleType: "band";
|
|
145
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleBand<{
|
|
146
|
+
toString(): string;
|
|
147
|
+
}>;
|
|
148
|
+
categoryGapRatio: number;
|
|
149
|
+
barGapRatio: number;
|
|
150
|
+
colorMap?: import("../../../../models/colorMapping.js").OrdinalColorConfig | import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
151
|
+
} & import("../../../index.js").AxisGroups & Pick<import("../../../../hooks/useTicks.js").TickParams, "tickPlacement" | "tickLabelPlacement">) | ({
|
|
152
|
+
scaleType: "point";
|
|
153
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePoint<{
|
|
154
|
+
toString(): string;
|
|
155
|
+
}>;
|
|
156
|
+
colorMap?: import("../../../../models/colorMapping.js").OrdinalColorConfig | import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
157
|
+
} & import("../../../index.js").AxisGroups), "scale">> & {
|
|
158
|
+
position?: "top" | "bottom" | "none";
|
|
159
|
+
height?: number;
|
|
160
|
+
} & import("../../../../hooks/useTicks.js").TickParams & import("../../../index.js").AxisConfigExtension & {
|
|
161
|
+
zoom: import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions | undefined;
|
|
162
|
+
}) | ({
|
|
163
|
+
offset?: number;
|
|
164
|
+
} & {
|
|
165
|
+
id: AxisId;
|
|
166
|
+
data?: readonly any[] | undefined;
|
|
167
|
+
dataKey?: string;
|
|
168
|
+
valueFormatter?: (<TScaleName extends keyof import("../../../index.js").AxisScaleConfig>(value: any, context: import("../../../index.js").AxisValueFormatterContext<TScaleName>) => string) | undefined;
|
|
169
|
+
hideTooltip?: boolean;
|
|
170
|
+
reverse?: boolean;
|
|
171
|
+
domainLimit?: "nice" | "strict" | ((min: number, max: number) => {
|
|
172
|
+
min: number;
|
|
173
|
+
max: number;
|
|
174
|
+
});
|
|
175
|
+
ignoreTooltip?: boolean;
|
|
176
|
+
} & Omit<Partial<import("../../../index.js").ChartsYAxisProps>, "axisId"> & Partial<Omit<{
|
|
177
|
+
scaleType: "time";
|
|
178
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleTime<number, number>;
|
|
179
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
180
|
+
} | {
|
|
181
|
+
scaleType: "linear";
|
|
182
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleLinear<number, number>;
|
|
183
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
184
|
+
} | {
|
|
185
|
+
scaleType: "log";
|
|
186
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleLogarithmic<number, number>;
|
|
187
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
188
|
+
} | {
|
|
189
|
+
scaleType: "symlog";
|
|
190
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleSymLog<number, number>;
|
|
191
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
192
|
+
constant?: number;
|
|
193
|
+
} | {
|
|
194
|
+
scaleType: "pow";
|
|
195
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePower<number, number>;
|
|
196
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
197
|
+
} | {
|
|
198
|
+
scaleType: "sqrt";
|
|
199
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePower<number, number>;
|
|
200
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
201
|
+
} | {
|
|
202
|
+
scaleType: "utc";
|
|
203
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleTime<number, number>;
|
|
204
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
205
|
+
} | ({
|
|
206
|
+
scaleType: "band";
|
|
207
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleBand<{
|
|
208
|
+
toString(): string;
|
|
209
|
+
}>;
|
|
210
|
+
categoryGapRatio: number;
|
|
211
|
+
barGapRatio: number;
|
|
212
|
+
colorMap?: import("../../../../models/colorMapping.js").OrdinalColorConfig | import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
213
|
+
} & import("../../../index.js").AxisGroups & Pick<import("../../../../hooks/useTicks.js").TickParams, "tickPlacement" | "tickLabelPlacement">) | ({
|
|
214
|
+
scaleType: "point";
|
|
215
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePoint<{
|
|
216
|
+
toString(): string;
|
|
217
|
+
}>;
|
|
218
|
+
colorMap?: import("../../../../models/colorMapping.js").OrdinalColorConfig | import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
219
|
+
} & import("../../../index.js").AxisGroups), "scale">> & {
|
|
220
|
+
position?: "left" | "right" | "none";
|
|
221
|
+
width?: number;
|
|
222
|
+
} & import("../../../../hooks/useTicks.js").TickParams & import("../../../index.js").AxisConfigExtension & {
|
|
223
|
+
zoom: import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions | undefined;
|
|
224
|
+
}) | undefined, [axisId: AxisId]>;
|
|
225
|
+
export {};
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.selectorDefaultYAxisTickNumber = exports.selectorDefaultXAxisTickNumber = exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomAxisFilters = exports.selectorChartYScales = exports.selectorChartYAxis = exports.selectorChartXScales = exports.selectorChartXAxis = exports.selectorChartRawAxis = exports.selectorChartAxisZoomOptionsLookup = exports.selectorChartAxis = exports.createZoomMap = void 0;
|
|
7
|
+
exports.selectorDefaultYAxisTickNumber = exports.selectorDefaultXAxisTickNumber = exports.selectorChartZoomOptionsLookup = exports.selectorChartZoomMap = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomAxisFilters = exports.selectorChartYScales = exports.selectorChartYDomains = exports.selectorChartYAxis = exports.selectorChartXScales = exports.selectorChartXDomains = exports.selectorChartXAxis = exports.selectorChartRawAxis = exports.selectorChartNormalizedYScales = exports.selectorChartNormalizedXScales = exports.selectorChartFilteredYDomains = exports.selectorChartFilteredXDomains = exports.selectorChartAxisZoomOptionsLookup = exports.selectorChartAxis = exports.createZoomMap = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _useChartDimensions = require("../../corePlugins/useChartDimensions");
|
|
10
10
|
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
@@ -12,10 +12,15 @@ var _selectors = require("../../utils/selectors");
|
|
|
12
12
|
var _computeAxisValue = require("./computeAxisValue");
|
|
13
13
|
var _createAxisFilterMapper = require("./createAxisFilterMapper");
|
|
14
14
|
var _createZoomLookup = require("./createZoomLookup");
|
|
15
|
+
var _axis = require("../../../../models/axis");
|
|
15
16
|
var _useChartCartesianAxisLayout = require("./useChartCartesianAxisLayout.selectors");
|
|
16
17
|
var _useChartExperimentalFeature = require("../../corePlugins/useChartExperimentalFeature");
|
|
17
|
-
var _getAxisScale = require("./getAxisScale");
|
|
18
18
|
var _ticks = require("../../../ticks");
|
|
19
|
+
var _getAxisScale = require("./getAxisScale");
|
|
20
|
+
var _scaleGuards = require("../../../scaleGuards");
|
|
21
|
+
var _zoom = require("./zoom");
|
|
22
|
+
var _getAxisExtrema = require("./getAxisExtrema");
|
|
23
|
+
var _domain = require("./domain");
|
|
19
24
|
const createZoomMap = zoom => {
|
|
20
25
|
const zoomItemMap = new Map();
|
|
21
26
|
zoom.forEach(zoomItem => {
|
|
@@ -34,66 +39,176 @@ const selectorChartZoomIsInteracting = exports.selectorChartZoomIsInteracting =
|
|
|
34
39
|
const selectorChartZoomMap = exports.selectorChartZoomMap = (0, _selectors.createSelector)([selectorChartZoomState], zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
|
|
35
40
|
const selectorChartZoomOptionsLookup = exports.selectorChartZoomOptionsLookup = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis], (xAxis, yAxis) => (0, _extends2.default)({}, (0, _createZoomLookup.createZoomLookup)('x')(xAxis), (0, _createZoomLookup.createZoomLookup)('y')(yAxis)));
|
|
36
41
|
const selectorChartAxisZoomOptionsLookup = exports.selectorChartAxisZoomOptionsLookup = (0, _selectors.createSelector)([selectorChartZoomOptionsLookup, (_, axisId) => axisId], (axisLookup, axisId) => axisLookup[axisId]);
|
|
37
|
-
const selectorChartXFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)(zoomMap, zoomOptions, 'x'));
|
|
38
|
-
const selectorChartYFilter = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && (0, _createAxisFilterMapper.createAxisFilterMapper)(zoomMap, zoomOptions, 'y'));
|
|
39
42
|
const selectorDefaultXAxisTickNumber = exports.selectorDefaultXAxisTickNumber = (0, _selectors.createSelector)([_useChartDimensions.selectorChartDrawingArea], function selectorDefaultXAxisTickNumber(drawingArea) {
|
|
40
43
|
return (0, _ticks.getDefaultTickNumber)(drawingArea.width);
|
|
41
44
|
});
|
|
42
45
|
const selectorDefaultYAxisTickNumber = exports.selectorDefaultYAxisTickNumber = (0, _selectors.createSelector)([_useChartDimensions.selectorChartDrawingArea], function selectorDefaultYAxisTickNumber(drawingArea) {
|
|
43
46
|
return (0, _ticks.getDefaultTickNumber)(drawingArea.height);
|
|
44
47
|
});
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
axis
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
const selectorChartXDomains = exports.selectorChartXDomains = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorDefaultXAxisTickNumber], function selectorChartXDomains(axes, formattedSeries, seriesConfig, preferStrictDomainInLineCharts, defaultTickNumber) {
|
|
49
|
+
const axisDirection = 'x';
|
|
50
|
+
const domains = {};
|
|
51
|
+
axes?.forEach((eachAxis, axisIndex) => {
|
|
52
|
+
const axis = eachAxis;
|
|
53
|
+
if ((0, _axis.isBandScaleConfig)(axis) || (0, _axis.isPointScaleConfig)(axis)) {
|
|
54
|
+
domains[axis.id] = {
|
|
55
|
+
domain: axis.data
|
|
56
|
+
};
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const axisExtrema = (0, _getAxisExtrema.getAxisExtrema)(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
|
|
60
|
+
domains[axis.id] = (0, _domain.calculateInitialDomainAndTickNumber)(axis, 'x', axisIndex, formattedSeries, axisExtrema, defaultTickNumber, preferStrictDomainInLineCharts);
|
|
54
61
|
});
|
|
62
|
+
return domains;
|
|
55
63
|
});
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
axis
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
const selectorChartYDomains = exports.selectorChartYDomains = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorDefaultYAxisTickNumber], function selectorChartYDomains(axes, formattedSeries, seriesConfig, preferStrictDomainInLineCharts, defaultTickNumber) {
|
|
65
|
+
const axisDirection = 'y';
|
|
66
|
+
const domains = {};
|
|
67
|
+
axes?.forEach((eachAxis, axisIndex) => {
|
|
68
|
+
const axis = eachAxis;
|
|
69
|
+
if ((0, _axis.isBandScaleConfig)(axis) || (0, _axis.isPointScaleConfig)(axis)) {
|
|
70
|
+
domains[axis.id] = {
|
|
71
|
+
domain: axis.data
|
|
72
|
+
};
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const axisExtrema = (0, _getAxisExtrema.getAxisExtrema)(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
|
|
76
|
+
domains[axis.id] = (0, _domain.calculateInitialDomainAndTickNumber)(axis, 'y', axisIndex, formattedSeries, axisExtrema, defaultTickNumber, preferStrictDomainInLineCharts);
|
|
65
77
|
});
|
|
78
|
+
return domains;
|
|
66
79
|
});
|
|
67
|
-
const selectorChartZoomAxisFilters = exports.selectorChartZoomAxisFilters = (0, _selectors.createSelector)([
|
|
68
|
-
if (
|
|
69
|
-
// Early return if there is no zoom.
|
|
80
|
+
const selectorChartZoomAxisFilters = exports.selectorChartZoomAxisFilters = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup, _useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartXDomains, selectorChartYDomains], (zoomMap, zoomOptions, xAxis, yAxis, xDomains, yDomains) => {
|
|
81
|
+
if (!zoomMap || !zoomOptions) {
|
|
70
82
|
return undefined;
|
|
71
83
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
let hasFilter = false;
|
|
85
|
+
const filters = {};
|
|
86
|
+
const axes = [...(xAxis ?? []), ...(yAxis ?? [])];
|
|
87
|
+
for (let i = 0; i < axes.length; i += 1) {
|
|
88
|
+
const axis = axes[i];
|
|
89
|
+
if (!zoomOptions[axis.id] || zoomOptions[axis.id].filterMode !== 'discard') {
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const zoom = zoomMap.get(axis.id);
|
|
93
|
+
if (zoom === undefined || zoom.start <= 0 && zoom.end >= 100) {
|
|
94
|
+
// No zoom, or zoom with all data visible
|
|
95
|
+
continue;
|
|
76
96
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
97
|
+
const axisDirection = i < (xAxis?.length ?? 0) ? 'x' : 'y';
|
|
98
|
+
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
99
|
+
filters[axis.id] = (0, _createAxisFilterMapper.createDiscreteScaleGetAxisFilter)(axis.data, zoom.start, zoom.end, axisDirection);
|
|
100
|
+
} else {
|
|
101
|
+
const {
|
|
102
|
+
domain
|
|
103
|
+
} = axisDirection === 'x' ? xDomains[axis.id] : yDomains[axis.id];
|
|
104
|
+
filters[axis.id] = (0, _createAxisFilterMapper.createContinuousScaleGetAxisFilter)(
|
|
105
|
+
// For continuous scales, the domain is always a two-value array.
|
|
106
|
+
domain, zoom.start, zoom.end, axisDirection, axis.data);
|
|
83
107
|
}
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
if (
|
|
108
|
+
hasFilter = true;
|
|
109
|
+
}
|
|
110
|
+
if (!hasFilter) {
|
|
87
111
|
return undefined;
|
|
88
112
|
}
|
|
89
|
-
return (0, _createAxisFilterMapper.createGetAxisFilters)(
|
|
113
|
+
return (0, _createAxisFilterMapper.createGetAxisFilters)(filters);
|
|
114
|
+
});
|
|
115
|
+
const selectorChartFilteredXDomains = exports.selectorChartFilteredXDomains = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartXDomains], (axes, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, domains) => {
|
|
116
|
+
const filteredDomains = {};
|
|
117
|
+
axes?.forEach((axis, axisIndex) => {
|
|
118
|
+
const domain = domains[axis.id].domain;
|
|
119
|
+
if ((0, _axis.isBandScaleConfig)(axis) || (0, _axis.isPointScaleConfig)(axis)) {
|
|
120
|
+
filteredDomains[axis.id] = domain;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const zoom = zoomMap?.get(axis.id);
|
|
124
|
+
const zoomOption = zoomOptions?.[axis.id];
|
|
125
|
+
const filter = zoom === undefined && !zoomOption ? getFilters : undefined; // Do not apply filtering if zoom is already defined.
|
|
126
|
+
|
|
127
|
+
if (!filter) {
|
|
128
|
+
filteredDomains[axis.id] = domain;
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const rawTickNumber = domains[axis.id].tickNumber;
|
|
132
|
+
const axisExtrema = (0, _getAxisExtrema.getAxisExtrema)(axis, 'x', seriesConfig, axisIndex, formattedSeries, filter);
|
|
133
|
+
filteredDomains[axis.id] = (0, _domain.calculateFinalDomain)(axis, 'x', axisIndex, formattedSeries, axisExtrema, rawTickNumber, preferStrictDomainInLineCharts);
|
|
134
|
+
});
|
|
135
|
+
return filteredDomains;
|
|
136
|
+
});
|
|
137
|
+
const selectorChartFilteredYDomains = exports.selectorChartFilteredYDomains = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartYDomains], (axes, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, domains) => {
|
|
138
|
+
const filteredDomains = {};
|
|
139
|
+
axes?.forEach((axis, axisIndex) => {
|
|
140
|
+
const domain = domains[axis.id].domain;
|
|
141
|
+
if ((0, _axis.isBandScaleConfig)(axis) || (0, _axis.isPointScaleConfig)(axis)) {
|
|
142
|
+
filteredDomains[axis.id] = domain;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const zoom = zoomMap?.get(axis.id);
|
|
146
|
+
const zoomOption = zoomOptions?.[axis.id];
|
|
147
|
+
const filter = zoom === undefined && !zoomOption ? getFilters : undefined; // Do not apply filtering if zoom is already defined.
|
|
148
|
+
|
|
149
|
+
if (!filter) {
|
|
150
|
+
filteredDomains[axis.id] = domain;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const rawTickNumber = domains[axis.id].tickNumber;
|
|
154
|
+
const axisExtrema = (0, _getAxisExtrema.getAxisExtrema)(axis, 'y', seriesConfig, axisIndex, formattedSeries, filter);
|
|
155
|
+
filteredDomains[axis.id] = (0, _domain.calculateFinalDomain)(axis, 'y', axisIndex, formattedSeries, axisExtrema, rawTickNumber, preferStrictDomainInLineCharts);
|
|
156
|
+
});
|
|
157
|
+
return filteredDomains;
|
|
158
|
+
});
|
|
159
|
+
const selectorChartNormalizedXScales = exports.selectorChartNormalizedXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, selectorChartFilteredXDomains], function selectorChartNormalizedXScales(axes, filteredDomains) {
|
|
160
|
+
const scales = {};
|
|
161
|
+
axes?.forEach(eachAxis => {
|
|
162
|
+
const axis = eachAxis;
|
|
163
|
+
const domain = filteredDomains[axis.id];
|
|
164
|
+
scales[axis.id] = (0, _getAxisScale.getNormalizedAxisScale)(axis, domain);
|
|
165
|
+
});
|
|
166
|
+
return scales;
|
|
167
|
+
});
|
|
168
|
+
const selectorChartNormalizedYScales = exports.selectorChartNormalizedYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartFilteredYDomains], function selectorChartNormalizedYScales(axes, filteredDomains) {
|
|
169
|
+
const scales = {};
|
|
170
|
+
axes?.forEach(eachAxis => {
|
|
171
|
+
const axis = eachAxis;
|
|
172
|
+
const domain = filteredDomains[axis.id];
|
|
173
|
+
scales[axis.id] = (0, _getAxisScale.getNormalizedAxisScale)(axis, domain);
|
|
174
|
+
});
|
|
175
|
+
return scales;
|
|
176
|
+
});
|
|
177
|
+
const selectorChartXScales = exports.selectorChartXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, selectorChartNormalizedXScales, _useChartDimensions.selectorChartDrawingArea, selectorChartZoomMap], function selectorChartXScales(axes, normalizedScales, drawingArea, zoomMap) {
|
|
178
|
+
const scales = {};
|
|
179
|
+
axes?.forEach(eachAxis => {
|
|
180
|
+
const axis = eachAxis;
|
|
181
|
+
const zoom = zoomMap?.get(axis.id);
|
|
182
|
+
const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
|
|
183
|
+
const range = (0, _getAxisScale.getRange)(drawingArea, 'x', axis);
|
|
184
|
+
const scale = normalizedScales[axis.id].copy();
|
|
185
|
+
const zoomedRange = (0, _zoom.zoomScaleRange)(range, zoomRange);
|
|
186
|
+
scale.range(zoomedRange);
|
|
187
|
+
scales[axis.id] = scale;
|
|
188
|
+
});
|
|
189
|
+
return scales;
|
|
190
|
+
});
|
|
191
|
+
const selectorChartYScales = exports.selectorChartYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartNormalizedYScales, _useChartDimensions.selectorChartDrawingArea, selectorChartZoomMap], function selectorChartYScales(axes, normalizedScales, drawingArea, zoomMap) {
|
|
192
|
+
const scales = {};
|
|
193
|
+
axes?.forEach(eachAxis => {
|
|
194
|
+
const axis = eachAxis;
|
|
195
|
+
const zoom = zoomMap?.get(axis.id);
|
|
196
|
+
const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
|
|
197
|
+
const range = (0, _getAxisScale.getRange)(drawingArea, 'y', axis);
|
|
198
|
+
const scale = normalizedScales[axis.id].copy();
|
|
199
|
+
const scaleRange = (0, _scaleGuards.isOrdinalScale)(scale) ? range.reverse() : range;
|
|
200
|
+
const zoomedRange = (0, _zoom.zoomScaleRange)(scaleRange, zoomRange);
|
|
201
|
+
scale.range(zoomedRange);
|
|
202
|
+
scales[axis.id] = scale;
|
|
203
|
+
});
|
|
204
|
+
return scales;
|
|
90
205
|
});
|
|
91
206
|
|
|
92
207
|
/**
|
|
93
208
|
* The only interesting selectors that merge axis data and zoom if provided.
|
|
94
209
|
*/
|
|
95
210
|
|
|
96
|
-
const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap,
|
|
211
|
+
const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartXDomains, selectorChartXScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, domains, scales) => (0, _computeAxisValue.computeAxisValue)({
|
|
97
212
|
scales,
|
|
98
213
|
drawingArea,
|
|
99
214
|
formattedSeries,
|
|
@@ -101,11 +216,9 @@ const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSel
|
|
|
101
216
|
seriesConfig,
|
|
102
217
|
axisDirection: 'x',
|
|
103
218
|
zoomMap,
|
|
104
|
-
|
|
105
|
-
getFilters,
|
|
106
|
-
preferStrictDomainInLineCharts
|
|
219
|
+
domains
|
|
107
220
|
}));
|
|
108
|
-
const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap,
|
|
221
|
+
const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartYDomains, selectorChartYScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, domains, scales) => (0, _computeAxisValue.computeAxisValue)({
|
|
109
222
|
scales,
|
|
110
223
|
drawingArea,
|
|
111
224
|
formattedSeries,
|
|
@@ -113,9 +226,7 @@ const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSel
|
|
|
113
226
|
seriesConfig,
|
|
114
227
|
axisDirection: 'y',
|
|
115
228
|
zoomMap,
|
|
116
|
-
|
|
117
|
-
getFilters,
|
|
118
|
-
preferStrictDomainInLineCharts
|
|
229
|
+
domains
|
|
119
230
|
}));
|
|
120
231
|
const selectorChartAxis = exports.selectorChartAxis = (0, _selectors.createSelector)([selectorChartXAxis, selectorChartYAxis, (_, axisId) => axisId], (xAxes, yAxes, axisId) => xAxes?.axis[axisId] ?? yAxes?.axis[axisId]);
|
|
121
232
|
const selectorChartRawAxis = exports.selectorChartRawAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis, (state, axisId) => axisId], (xAxes, yAxes, axisId) => {
|
|
@@ -30,9 +30,14 @@ const useChartHighlight = ({
|
|
|
30
30
|
}, [store, params.highlightedItem]);
|
|
31
31
|
const clearHighlight = (0, _useEventCallback.default)(() => {
|
|
32
32
|
params.onHighlightChange?.(null);
|
|
33
|
+
const prevItem = store.getSnapshot().highlight.item;
|
|
34
|
+
if (prevItem === null) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
33
37
|
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
34
38
|
highlight: {
|
|
35
|
-
item: null
|
|
39
|
+
item: null,
|
|
40
|
+
lastUpdate: 'pointer'
|
|
36
41
|
}
|
|
37
42
|
}));
|
|
38
43
|
});
|
|
@@ -44,7 +49,8 @@ const useChartHighlight = ({
|
|
|
44
49
|
params.onHighlightChange?.(newItem);
|
|
45
50
|
store.update(prev => (0, _extends2.default)({}, prev, {
|
|
46
51
|
highlight: {
|
|
47
|
-
item: newItem
|
|
52
|
+
item: newItem,
|
|
53
|
+
lastUpdate: 'pointer'
|
|
48
54
|
}
|
|
49
55
|
}));
|
|
50
56
|
});
|
|
@@ -63,7 +69,8 @@ useChartHighlight.getDefaultizedParams = ({
|
|
|
63
69
|
});
|
|
64
70
|
useChartHighlight.getInitialState = params => ({
|
|
65
71
|
highlight: {
|
|
66
|
-
item: params.highlightedItem
|
|
72
|
+
item: params.highlightedItem,
|
|
73
|
+
lastUpdate: 'pointer'
|
|
67
74
|
}
|
|
68
75
|
});
|
|
69
76
|
useChartHighlight.params = {
|
|
@@ -8,24 +8,24 @@ export declare const selectorChartsHighlightScopePerSeriesId: import("reselect")
|
|
|
8
8
|
}, Map<SeriesId, Partial<HighlightScope> | undefined>, any[]>;
|
|
9
9
|
export declare const selectorChartsHighlightedItem: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & import("./useChartHighlight.types.js").UseChartHighlightState & Partial<{}> & {
|
|
10
10
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
11
|
-
} & {
|
|
11
|
+
} & Partial<import("../useChartKeyboardNavigation/useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState> & {
|
|
12
12
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
13
13
|
}, HighlightItemData | null, any[]>;
|
|
14
14
|
export declare const selectorChartsHighlightScope: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
15
15
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
16
16
|
} & {
|
|
17
17
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
18
|
-
} & import("./useChartHighlight.types.js").UseChartHighlightState
|
|
18
|
+
} & import("./useChartHighlight.types.js").UseChartHighlightState & Partial<import("../useChartKeyboardNavigation/useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState>, Partial<HighlightScope> | null, any[]>;
|
|
19
19
|
export declare const selectorChartsIsHighlightedCallback: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
20
20
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
21
21
|
} & {
|
|
22
22
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
23
|
-
} & import("./useChartHighlight.types.js").UseChartHighlightState
|
|
23
|
+
} & import("./useChartHighlight.types.js").UseChartHighlightState & Partial<import("../useChartKeyboardNavigation/useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState>, (item: HighlightItemData | null) => boolean, any[]>;
|
|
24
24
|
export declare const selectorChartsIsFadedCallback: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & 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("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
25
25
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
26
26
|
} & {
|
|
27
27
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
28
|
-
} & import("./useChartHighlight.types.js").UseChartHighlightState
|
|
28
|
+
} & import("./useChartHighlight.types.js").UseChartHighlightState & Partial<import("../useChartKeyboardNavigation/useChartKeyboardNavigation.types.js").UseChartKeyboardNavigationState>, (item: HighlightItemData | null) => boolean, any[]>;
|
|
29
29
|
export declare const selectorChartsIsHighlighted: import("reselect").Selector<any, boolean, [item: HighlightItemData | null]>;
|
|
30
30
|
export declare const selectorChartIsSeriesHighlighted: import("reselect").Selector<any, boolean, [seriesId: SeriesId]>;
|
|
31
31
|
export declare const selectorChartIsSeriesFaded: import("reselect").Selector<any, boolean, [seriesId: SeriesId]>;
|
|
@@ -8,6 +8,7 @@ var _selectors = require("../../utils/selectors");
|
|
|
8
8
|
var _createIsHighlighted = require("./createIsHighlighted");
|
|
9
9
|
var _createIsFaded = require("./createIsFaded");
|
|
10
10
|
var _highlightStates = require("./highlightStates");
|
|
11
|
+
var _useChartKeyboardNavigation = require("../useChartKeyboardNavigation");
|
|
11
12
|
const selectHighlight = state => state.highlight;
|
|
12
13
|
const selectSeries = state => state.series;
|
|
13
14
|
const selectorChartsHighlightScopePerSeriesId = exports.selectorChartsHighlightScopePerSeriesId = (0, _selectors.createSelector)([selectSeries], series => {
|
|
@@ -21,8 +22,8 @@ const selectorChartsHighlightScopePerSeriesId = exports.selectorChartsHighlightS
|
|
|
21
22
|
});
|
|
22
23
|
return map;
|
|
23
24
|
});
|
|
24
|
-
const selectorChartsHighlightedItem = exports.selectorChartsHighlightedItem = (0, _selectors.createSelector)([selectHighlight], function selectorChartsHighlightedItem(highlight) {
|
|
25
|
-
return highlight.item;
|
|
25
|
+
const selectorChartsHighlightedItem = exports.selectorChartsHighlightedItem = (0, _selectors.createSelector)([selectHighlight, _useChartKeyboardNavigation.selectorChartsKeyboardItem], function selectorChartsHighlightedItem(highlight, keyboardItem) {
|
|
26
|
+
return highlight.lastUpdate === 'pointer' ? highlight.item : keyboardItem;
|
|
26
27
|
});
|
|
27
28
|
const selectorChartsHighlightScope = exports.selectorChartsHighlightScope = (0, _selectors.createSelector)([selectorChartsHighlightScopePerSeriesId, selectorChartsHighlightedItem], function selectorChartsHighlightScope(seriesIdToHighlightScope, highlightedItem) {
|
|
28
29
|
if (!highlightedItem) {
|
|
@@ -28,6 +28,7 @@ export type HighlightItemData = {
|
|
|
28
28
|
*/
|
|
29
29
|
dataIndex?: number;
|
|
30
30
|
};
|
|
31
|
+
export type HighlightUpdateSource = 'pointer' | 'keyboard';
|
|
31
32
|
export interface UseChartHighlightInstance {
|
|
32
33
|
/**
|
|
33
34
|
* Remove all highlight.
|
|
@@ -59,6 +60,11 @@ export interface UseChartHighlightState {
|
|
|
59
60
|
* The item currently highlighted.
|
|
60
61
|
*/
|
|
61
62
|
item: HighlightItemData | null;
|
|
63
|
+
/**
|
|
64
|
+
* The last interaction highlight update.
|
|
65
|
+
* Used to decide if highlight should be based on pointer position or keyboard navigation.
|
|
66
|
+
*/
|
|
67
|
+
lastUpdate: HighlightUpdateSource;
|
|
62
68
|
};
|
|
63
69
|
}
|
|
64
70
|
export type UseChartHighlightSignature = ChartPluginSignature<{
|
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js
CHANGED
|
@@ -139,7 +139,11 @@ const useChartKeyboardNavigation = ({
|
|
|
139
139
|
}
|
|
140
140
|
if (newFocusedItem !== prevState.keyboardNavigation.item) {
|
|
141
141
|
event.preventDefault();
|
|
142
|
-
return (0, _extends2.default)({}, prevState, prevState.
|
|
142
|
+
return (0, _extends2.default)({}, prevState, prevState.highlight && {
|
|
143
|
+
highlight: (0, _extends2.default)({}, prevState.highlight, {
|
|
144
|
+
lastUpdate: 'keyboard'
|
|
145
|
+
})
|
|
146
|
+
}, prevState.interaction && {
|
|
143
147
|
interaction: (0, _extends2.default)({}, prevState.interaction, {
|
|
144
148
|
lastUpdate: 'keyboard'
|
|
145
149
|
})
|