@mui/x-charts 8.13.1 → 8.14.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/BarChart/BarChart.js +44 -36
- package/BarChart/useBarPlotData.js +20 -33
- package/CHANGELOG.md +204 -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/Gauge/Gauge.js +2 -9
- package/Gauge/GaugeReferenceArc.d.ts +4 -1
- package/Gauge/GaugeReferenceArc.js +12 -3
- package/Gauge/GaugeValueArc.d.ts +4 -1
- package/Gauge/GaugeValueArc.js +16 -8
- package/Gauge/GaugeValueText.js +3 -1
- 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/ScatterChart/seriesConfig/seriesProcessor.js +1 -1
- package/SparkLineChart/SparkLineChart.js +44 -36
- package/esm/BarChart/BarChart.js +44 -36
- package/esm/BarChart/useBarPlotData.js +20 -33
- 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/Gauge/Gauge.js +2 -9
- package/esm/Gauge/GaugeReferenceArc.d.ts +4 -1
- package/esm/Gauge/GaugeReferenceArc.js +11 -2
- package/esm/Gauge/GaugeValueArc.d.ts +4 -1
- package/esm/Gauge/GaugeValueArc.js +16 -8
- package/esm/Gauge/GaugeValueText.js +3 -1
- 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/ScatterChart/seriesConfig/seriesProcessor.js +1 -1
- 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/Flatbush.bench.d.ts +1 -0
- package/esm/internals/Flatbush.bench.js +42 -0
- package/esm/internals/Flatbush.d.ts +63 -0
- package/esm/internals/Flatbush.js +468 -0
- 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/getAxisValue.d.ts +6 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -6
- 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 +185 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +199 -47
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +4 -1
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +33 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +40 -81
- 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/esm/models/seriesType/scatter.d.ts +2 -0
- package/esm/themeAugmentation/components.d.ts +3 -0
- package/esm/themeAugmentation/overrides.d.ts +2 -0
- package/hooks/animation/useAnimate.js +4 -3
- package/hooks/useScale.d.ts +5 -1
- package/index.js +1 -1
- package/internals/Flatbush.bench.d.ts +1 -0
- package/internals/Flatbush.bench.js +44 -0
- package/internals/Flatbush.d.ts +63 -0
- package/internals/Flatbush.js +477 -0
- 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/getAxisValue.d.ts +6 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -6
- 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 +185 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +200 -47
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +4 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +39 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +39 -80
- 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/models/seriesType/scatter.d.ts +2 -0
- package/package.json +7 -6
- package/themeAugmentation/components.d.ts +3 -0
- package/themeAugmentation/overrides.d.ts +2 -0
|
@@ -1,5 +1,8 @@
|
|
|
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";
|
|
4
|
+
import { SeriesId } from "../../../../models/seriesType/common.js";
|
|
5
|
+
import { Flatbush } from "../../../Flatbush.js";
|
|
3
6
|
export declare const createZoomMap: (zoom: readonly ZoomData[]) => Map<AxisId, ZoomData>;
|
|
4
7
|
/**
|
|
5
8
|
* Following selectors are not exported because they exist in the MIT chart only to ba able to reuse the Zoom state from the pro.
|
|
@@ -14,6 +17,7 @@ export declare const selectorChartZoomMap: import("reselect").Selector<import(".
|
|
|
14
17
|
} & {
|
|
15
18
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
16
19
|
}, Map<AxisId, ZoomData> | undefined, []>;
|
|
20
|
+
export declare const selectorChartAxisZoomData: import("reselect").Selector<any, ZoomData | undefined, [axisId: AxisId]>;
|
|
17
21
|
export declare const selectorChartZoomOptionsLookup: 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> & {
|
|
18
22
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
19
23
|
} & {
|
|
@@ -33,21 +37,55 @@ export declare const selectorDefaultYAxisTickNumber: import("reselect").Selector
|
|
|
33
37
|
} & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
|
|
34
38
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
35
39
|
}, number, []>;
|
|
36
|
-
|
|
40
|
+
type DomainDefinition = {
|
|
41
|
+
domain: ReadonlyArray<string | NumberValue>;
|
|
42
|
+
tickNumber?: number;
|
|
43
|
+
};
|
|
44
|
+
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
45
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
38
46
|
} & Partial<{}> & {
|
|
39
47
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
40
|
-
}, Record<AxisId,
|
|
41
|
-
export declare const
|
|
48
|
+
}, Record<AxisId, DomainDefinition>, []>;
|
|
49
|
+
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
50
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
43
51
|
} & Partial<{}> & {
|
|
44
52
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
45
|
-
}, Record<AxisId,
|
|
53
|
+
}, Record<AxisId, DomainDefinition>, []>;
|
|
46
54
|
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
55
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
48
56
|
} & {
|
|
49
57
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
50
58
|
} & Partial<{}>, import("./zoom.types.js").GetZoomAxisFilters | undefined, []>;
|
|
59
|
+
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> & {
|
|
60
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
61
|
+
} & Partial<{}> & {
|
|
62
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
63
|
+
}, Record<AxisId, readonly (string | NumberValue)[]>, []>;
|
|
64
|
+
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> & {
|
|
65
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
66
|
+
} & Partial<{}> & {
|
|
67
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
68
|
+
}, Record<AxisId, readonly (string | NumberValue)[]>, []>;
|
|
69
|
+
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> & {
|
|
70
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
71
|
+
} & Partial<{}> & {
|
|
72
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
73
|
+
}, Record<AxisId, D3Scale>, []>;
|
|
74
|
+
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> & {
|
|
75
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
76
|
+
} & Partial<{}> & {
|
|
77
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
78
|
+
}, Record<AxisId, D3Scale>, []>;
|
|
79
|
+
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> & {
|
|
80
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
81
|
+
} & Partial<{}> & {
|
|
82
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
83
|
+
}, Record<AxisId, D3Scale>, []>;
|
|
84
|
+
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> & {
|
|
85
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
86
|
+
} & Partial<{}> & {
|
|
87
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
88
|
+
}, Record<AxisId, D3Scale>, []>;
|
|
51
89
|
/**
|
|
52
90
|
* The only interesting selectors that merge axis data and zoom if provided.
|
|
53
91
|
*/
|
|
@@ -62,4 +100,145 @@ export declare const selectorChartYAxis: import("reselect").Selector<import("../
|
|
|
62
100
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
63
101
|
}, import("./computeAxisValue.js").ComputeResult<import("../../../index.js").ChartsYAxisProps>, []>;
|
|
64
102
|
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,
|
|
103
|
+
export declare const selectorChartRawAxis: import("reselect").Selector<any, ({
|
|
104
|
+
offset?: number;
|
|
105
|
+
} & {
|
|
106
|
+
id: AxisId;
|
|
107
|
+
data?: readonly any[] | undefined;
|
|
108
|
+
dataKey?: string;
|
|
109
|
+
valueFormatter?: (<TScaleName extends keyof import("../../../index.js").AxisScaleConfig>(value: any, context: import("../../../index.js").AxisValueFormatterContext<TScaleName>) => string) | undefined;
|
|
110
|
+
hideTooltip?: boolean;
|
|
111
|
+
reverse?: boolean;
|
|
112
|
+
domainLimit?: "nice" | "strict" | ((min: number, max: number) => {
|
|
113
|
+
min: number;
|
|
114
|
+
max: number;
|
|
115
|
+
});
|
|
116
|
+
ignoreTooltip?: boolean;
|
|
117
|
+
} & Omit<Partial<import("../../../index.js").ChartsXAxisProps>, "axisId"> & Partial<Omit<{
|
|
118
|
+
scaleType: "time";
|
|
119
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleTime<number, number>;
|
|
120
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
121
|
+
} | {
|
|
122
|
+
scaleType: "linear";
|
|
123
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleLinear<number, number>;
|
|
124
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
125
|
+
} | {
|
|
126
|
+
scaleType: "log";
|
|
127
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleLogarithmic<number, number>;
|
|
128
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
129
|
+
} | {
|
|
130
|
+
scaleType: "symlog";
|
|
131
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleSymLog<number, number>;
|
|
132
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
133
|
+
constant?: number;
|
|
134
|
+
} | {
|
|
135
|
+
scaleType: "pow";
|
|
136
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePower<number, number>;
|
|
137
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
138
|
+
} | {
|
|
139
|
+
scaleType: "sqrt";
|
|
140
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePower<number, number>;
|
|
141
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
142
|
+
} | {
|
|
143
|
+
scaleType: "utc";
|
|
144
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleTime<number, number>;
|
|
145
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
146
|
+
} | ({
|
|
147
|
+
scaleType: "band";
|
|
148
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleBand<{
|
|
149
|
+
toString(): string;
|
|
150
|
+
}>;
|
|
151
|
+
categoryGapRatio: number;
|
|
152
|
+
barGapRatio: number;
|
|
153
|
+
colorMap?: import("../../../../models/colorMapping.js").OrdinalColorConfig | import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
154
|
+
} & import("../../../index.js").AxisGroups & Pick<import("../../../../hooks/useTicks.js").TickParams, "tickPlacement" | "tickLabelPlacement">) | ({
|
|
155
|
+
scaleType: "point";
|
|
156
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePoint<{
|
|
157
|
+
toString(): string;
|
|
158
|
+
}>;
|
|
159
|
+
colorMap?: import("../../../../models/colorMapping.js").OrdinalColorConfig | import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
160
|
+
} & import("../../../index.js").AxisGroups), "scale">> & {
|
|
161
|
+
position?: "top" | "bottom" | "none";
|
|
162
|
+
height?: number;
|
|
163
|
+
} & import("../../../../hooks/useTicks.js").TickParams & import("../../../index.js").AxisConfigExtension & {
|
|
164
|
+
zoom: import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions | undefined;
|
|
165
|
+
}) | ({
|
|
166
|
+
offset?: number;
|
|
167
|
+
} & {
|
|
168
|
+
id: AxisId;
|
|
169
|
+
data?: readonly any[] | undefined;
|
|
170
|
+
dataKey?: string;
|
|
171
|
+
valueFormatter?: (<TScaleName extends keyof import("../../../index.js").AxisScaleConfig>(value: any, context: import("../../../index.js").AxisValueFormatterContext<TScaleName>) => string) | undefined;
|
|
172
|
+
hideTooltip?: boolean;
|
|
173
|
+
reverse?: boolean;
|
|
174
|
+
domainLimit?: "nice" | "strict" | ((min: number, max: number) => {
|
|
175
|
+
min: number;
|
|
176
|
+
max: number;
|
|
177
|
+
});
|
|
178
|
+
ignoreTooltip?: boolean;
|
|
179
|
+
} & Omit<Partial<import("../../../index.js").ChartsYAxisProps>, "axisId"> & Partial<Omit<{
|
|
180
|
+
scaleType: "time";
|
|
181
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleTime<number, number>;
|
|
182
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
183
|
+
} | {
|
|
184
|
+
scaleType: "linear";
|
|
185
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleLinear<number, number>;
|
|
186
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
187
|
+
} | {
|
|
188
|
+
scaleType: "log";
|
|
189
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleLogarithmic<number, number>;
|
|
190
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
191
|
+
} | {
|
|
192
|
+
scaleType: "symlog";
|
|
193
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleSymLog<number, number>;
|
|
194
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
195
|
+
constant?: number;
|
|
196
|
+
} | {
|
|
197
|
+
scaleType: "pow";
|
|
198
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePower<number, number>;
|
|
199
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
200
|
+
} | {
|
|
201
|
+
scaleType: "sqrt";
|
|
202
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePower<number, number>;
|
|
203
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
204
|
+
} | {
|
|
205
|
+
scaleType: "utc";
|
|
206
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleTime<number, number>;
|
|
207
|
+
colorMap?: import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
208
|
+
} | ({
|
|
209
|
+
scaleType: "band";
|
|
210
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScaleBand<{
|
|
211
|
+
toString(): string;
|
|
212
|
+
}>;
|
|
213
|
+
categoryGapRatio: number;
|
|
214
|
+
barGapRatio: number;
|
|
215
|
+
colorMap?: import("../../../../models/colorMapping.js").OrdinalColorConfig | import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
216
|
+
} & import("../../../index.js").AxisGroups & Pick<import("../../../../hooks/useTicks.js").TickParams, "tickPlacement" | "tickLabelPlacement">) | ({
|
|
217
|
+
scaleType: "point";
|
|
218
|
+
scale: import("@mui/x-charts-vendor/d3-scale").ScalePoint<{
|
|
219
|
+
toString(): string;
|
|
220
|
+
}>;
|
|
221
|
+
colorMap?: import("../../../../models/colorMapping.js").OrdinalColorConfig | import("../../../../models/colorMapping.js").ContinuousColorConfig | import("../../../../models/colorMapping.js").PiecewiseColorConfig;
|
|
222
|
+
} & import("../../../index.js").AxisGroups), "scale">> & {
|
|
223
|
+
position?: "left" | "right" | "none";
|
|
224
|
+
width?: number;
|
|
225
|
+
} & import("../../../../hooks/useTicks.js").TickParams & import("../../../index.js").AxisConfigExtension & {
|
|
226
|
+
zoom: import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions | undefined;
|
|
227
|
+
}) | undefined, [axisId: AxisId]>;
|
|
228
|
+
export declare const selectorChartDefaultXAxisId: 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> & {
|
|
229
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
230
|
+
} & {
|
|
231
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
232
|
+
}, AxisId, []>;
|
|
233
|
+
export declare const selectorChartDefaultYAxisId: 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> & {
|
|
234
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
235
|
+
} & {
|
|
236
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
237
|
+
}, AxisId, []>;
|
|
238
|
+
export declare const selectorChartSeriesEmptyFlatbushMap: () => Map<SeriesId, Flatbush>;
|
|
239
|
+
export declare const selectorChartSeriesFlatbushMap: 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<{}> & {
|
|
240
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
241
|
+
} & {
|
|
242
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
243
|
+
} & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState>, Map<SeriesId, Flatbush>, any[]>;
|
|
244
|
+
export {};
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
|
|
2
3
|
import { selectorChartDrawingArea } from "../../corePlugins/useChartDimensions/index.js";
|
|
3
4
|
import { selectorChartSeriesConfig, selectorChartSeriesProcessed } from "../../corePlugins/useChartSeries/index.js";
|
|
4
5
|
import { createSelector } from "../../utils/selectors.js";
|
|
5
6
|
import { computeAxisValue } from "./computeAxisValue.js";
|
|
6
|
-
import {
|
|
7
|
+
import { createContinuousScaleGetAxisFilter, createDiscreteScaleGetAxisFilter, createGetAxisFilters } from "./createAxisFilterMapper.js";
|
|
7
8
|
import { createZoomLookup } from "./createZoomLookup.js";
|
|
9
|
+
import { isBandScaleConfig, isPointScaleConfig } from "../../../../models/axis.js";
|
|
8
10
|
import { selectorChartRawXAxis, selectorChartRawYAxis } from "./useChartCartesianAxisLayout.selectors.js";
|
|
9
11
|
import { selectorPreferStrictDomainInLineCharts } from "../../corePlugins/useChartExperimentalFeature/index.js";
|
|
10
|
-
import { getXAxesScales, getYAxesScales } from "./getAxisScale.js";
|
|
11
12
|
import { getDefaultTickNumber } from "../../../ticks.js";
|
|
13
|
+
import { getNormalizedAxisScale, getRange } from "./getAxisScale.js";
|
|
14
|
+
import { isOrdinalScale } from "../../../scaleGuards.js";
|
|
15
|
+
import { zoomScaleRange } from "./zoom.js";
|
|
16
|
+
import { getAxisExtrema } from "./getAxisExtrema.js";
|
|
17
|
+
import { calculateFinalDomain, calculateInitialDomainAndTickNumber } from "./domain.js";
|
|
18
|
+
import { Flatbush } from "../../../Flatbush.js";
|
|
12
19
|
export const createZoomMap = zoom => {
|
|
13
20
|
const zoomItemMap = new Map();
|
|
14
21
|
zoom.forEach(zoomItem => {
|
|
@@ -24,68 +31,187 @@ const selectorChartZoomState = state => state.zoom;
|
|
|
24
31
|
|
|
25
32
|
export const selectorChartZoomIsInteracting = createSelector([selectorChartZoomState], zoom => zoom?.isInteracting);
|
|
26
33
|
export const selectorChartZoomMap = createSelector([selectorChartZoomState], zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
|
|
34
|
+
export const selectorChartAxisZoomData = createSelector([selectorChartZoomMap, (_, axisId) => axisId], (zoomMap, axisId) => zoomMap?.get(axisId));
|
|
27
35
|
export const selectorChartZoomOptionsLookup = createSelector([selectorChartRawXAxis, selectorChartRawYAxis], (xAxis, yAxis) => _extends({}, createZoomLookup('x')(xAxis), createZoomLookup('y')(yAxis)));
|
|
28
36
|
export const selectorChartAxisZoomOptionsLookup = createSelector([selectorChartZoomOptionsLookup, (_, axisId) => axisId], (axisLookup, axisId) => axisLookup[axisId]);
|
|
29
|
-
const selectorChartXFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && createAxisFilterMapper(zoomMap, zoomOptions, 'x'));
|
|
30
|
-
const selectorChartYFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && createAxisFilterMapper(zoomMap, zoomOptions, 'y'));
|
|
31
37
|
export const selectorDefaultXAxisTickNumber = createSelector([selectorChartDrawingArea], function selectorDefaultXAxisTickNumber(drawingArea) {
|
|
32
38
|
return getDefaultTickNumber(drawingArea.width);
|
|
33
39
|
});
|
|
34
40
|
export const selectorDefaultYAxisTickNumber = createSelector([selectorChartDrawingArea], function selectorDefaultYAxisTickNumber(drawingArea) {
|
|
35
41
|
return getDefaultTickNumber(drawingArea.height);
|
|
36
42
|
});
|
|
37
|
-
export const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
axis
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
export const selectorChartXDomains = createSelector([selectorChartRawXAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorPreferStrictDomainInLineCharts, selectorDefaultXAxisTickNumber], function selectorChartXDomains(axes, formattedSeries, seriesConfig, preferStrictDomainInLineCharts, defaultTickNumber) {
|
|
44
|
+
const axisDirection = 'x';
|
|
45
|
+
const domains = {};
|
|
46
|
+
axes?.forEach((eachAxis, axisIndex) => {
|
|
47
|
+
const axis = eachAxis;
|
|
48
|
+
if (isBandScaleConfig(axis) || isPointScaleConfig(axis)) {
|
|
49
|
+
domains[axis.id] = {
|
|
50
|
+
domain: axis.data
|
|
51
|
+
};
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const axisExtrema = getAxisExtrema(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
|
|
55
|
+
domains[axis.id] = calculateInitialDomainAndTickNumber(axis, 'x', axisIndex, formattedSeries, axisExtrema, defaultTickNumber, preferStrictDomainInLineCharts);
|
|
46
56
|
});
|
|
57
|
+
return domains;
|
|
47
58
|
});
|
|
48
|
-
export const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
axis
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
export const selectorChartYDomains = createSelector([selectorChartRawYAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorPreferStrictDomainInLineCharts, selectorDefaultYAxisTickNumber], function selectorChartYDomains(axes, formattedSeries, seriesConfig, preferStrictDomainInLineCharts, defaultTickNumber) {
|
|
60
|
+
const axisDirection = 'y';
|
|
61
|
+
const domains = {};
|
|
62
|
+
axes?.forEach((eachAxis, axisIndex) => {
|
|
63
|
+
const axis = eachAxis;
|
|
64
|
+
if (isBandScaleConfig(axis) || isPointScaleConfig(axis)) {
|
|
65
|
+
domains[axis.id] = {
|
|
66
|
+
domain: axis.data
|
|
67
|
+
};
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const axisExtrema = getAxisExtrema(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
|
|
71
|
+
domains[axis.id] = calculateInitialDomainAndTickNumber(axis, 'y', axisIndex, formattedSeries, axisExtrema, defaultTickNumber, preferStrictDomainInLineCharts);
|
|
57
72
|
});
|
|
73
|
+
return domains;
|
|
58
74
|
});
|
|
59
|
-
export const selectorChartZoomAxisFilters = createSelector([
|
|
60
|
-
if (
|
|
61
|
-
// Early return if there is no zoom.
|
|
75
|
+
export const selectorChartZoomAxisFilters = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartRawXAxis, selectorChartRawYAxis, selectorChartXDomains, selectorChartYDomains], (zoomMap, zoomOptions, xAxis, yAxis, xDomains, yDomains) => {
|
|
76
|
+
if (!zoomMap || !zoomOptions) {
|
|
62
77
|
return undefined;
|
|
63
78
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
79
|
+
let hasFilter = false;
|
|
80
|
+
const filters = {};
|
|
81
|
+
const axes = [...(xAxis ?? []), ...(yAxis ?? [])];
|
|
82
|
+
for (let i = 0; i < axes.length; i += 1) {
|
|
83
|
+
const axis = axes[i];
|
|
84
|
+
if (!zoomOptions[axis.id] || zoomOptions[axis.id].filterMode !== 'discard') {
|
|
85
|
+
continue;
|
|
68
86
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (filter !== null) {
|
|
74
|
-
acc[axis.id] = filter;
|
|
87
|
+
const zoom = zoomMap.get(axis.id);
|
|
88
|
+
if (zoom === undefined || zoom.start <= 0 && zoom.end >= 100) {
|
|
89
|
+
// No zoom, or zoom with all data visible
|
|
90
|
+
continue;
|
|
75
91
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
const axisDirection = i < (xAxis?.length ?? 0) ? 'x' : 'y';
|
|
93
|
+
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
94
|
+
filters[axis.id] = createDiscreteScaleGetAxisFilter(axis.data, zoom.start, zoom.end, axisDirection);
|
|
95
|
+
} else {
|
|
96
|
+
const {
|
|
97
|
+
domain
|
|
98
|
+
} = axisDirection === 'x' ? xDomains[axis.id] : yDomains[axis.id];
|
|
99
|
+
filters[axis.id] = createContinuousScaleGetAxisFilter(
|
|
100
|
+
// For continuous scales, the domain is always a two-value array.
|
|
101
|
+
domain, zoom.start, zoom.end, axisDirection, axis.data);
|
|
102
|
+
}
|
|
103
|
+
hasFilter = true;
|
|
104
|
+
}
|
|
105
|
+
if (!hasFilter) {
|
|
79
106
|
return undefined;
|
|
80
107
|
}
|
|
81
|
-
return createGetAxisFilters(
|
|
108
|
+
return createGetAxisFilters(filters);
|
|
109
|
+
});
|
|
110
|
+
export const selectorChartFilteredXDomains = createSelector([selectorChartRawXAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts, selectorChartXDomains], (axes, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, domains) => {
|
|
111
|
+
const filteredDomains = {};
|
|
112
|
+
axes?.forEach((axis, axisIndex) => {
|
|
113
|
+
const domain = domains[axis.id].domain;
|
|
114
|
+
if (isBandScaleConfig(axis) || isPointScaleConfig(axis)) {
|
|
115
|
+
filteredDomains[axis.id] = domain;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const zoom = zoomMap?.get(axis.id);
|
|
119
|
+
const zoomOption = zoomOptions?.[axis.id];
|
|
120
|
+
const filter = zoom === undefined && !zoomOption ? getFilters : undefined; // Do not apply filtering if zoom is already defined.
|
|
121
|
+
|
|
122
|
+
if (!filter) {
|
|
123
|
+
filteredDomains[axis.id] = domain;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const rawTickNumber = domains[axis.id].tickNumber;
|
|
127
|
+
const axisExtrema = getAxisExtrema(axis, 'x', seriesConfig, axisIndex, formattedSeries, filter);
|
|
128
|
+
filteredDomains[axis.id] = calculateFinalDomain(axis, 'x', axisIndex, formattedSeries, axisExtrema, rawTickNumber, preferStrictDomainInLineCharts);
|
|
129
|
+
});
|
|
130
|
+
return filteredDomains;
|
|
131
|
+
}, {
|
|
132
|
+
memoizeOptions: {
|
|
133
|
+
resultEqualityCheck: (a, b) => isDeepEqual(a, b)
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
export const selectorChartFilteredYDomains = createSelector([selectorChartRawYAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts, selectorChartYDomains], (axes, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, domains) => {
|
|
137
|
+
const filteredDomains = {};
|
|
138
|
+
axes?.forEach((axis, axisIndex) => {
|
|
139
|
+
const domain = domains[axis.id].domain;
|
|
140
|
+
if (isBandScaleConfig(axis) || isPointScaleConfig(axis)) {
|
|
141
|
+
filteredDomains[axis.id] = domain;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const zoom = zoomMap?.get(axis.id);
|
|
145
|
+
const zoomOption = zoomOptions?.[axis.id];
|
|
146
|
+
const filter = zoom === undefined && !zoomOption ? getFilters : undefined; // Do not apply filtering if zoom is already defined.
|
|
147
|
+
|
|
148
|
+
if (!filter) {
|
|
149
|
+
filteredDomains[axis.id] = domain;
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const rawTickNumber = domains[axis.id].tickNumber;
|
|
153
|
+
const axisExtrema = getAxisExtrema(axis, 'y', seriesConfig, axisIndex, formattedSeries, filter);
|
|
154
|
+
filteredDomains[axis.id] = calculateFinalDomain(axis, 'y', axisIndex, formattedSeries, axisExtrema, rawTickNumber, preferStrictDomainInLineCharts);
|
|
155
|
+
});
|
|
156
|
+
return filteredDomains;
|
|
157
|
+
}, {
|
|
158
|
+
memoizeOptions: {
|
|
159
|
+
resultEqualityCheck: (a, b) => isDeepEqual(a, b)
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
export const selectorChartNormalizedXScales = createSelector([selectorChartRawXAxis, selectorChartFilteredXDomains], function selectorChartNormalizedXScales(axes, filteredDomains) {
|
|
163
|
+
const scales = {};
|
|
164
|
+
axes?.forEach(eachAxis => {
|
|
165
|
+
const axis = eachAxis;
|
|
166
|
+
const domain = filteredDomains[axis.id];
|
|
167
|
+
scales[axis.id] = getNormalizedAxisScale(axis, domain);
|
|
168
|
+
});
|
|
169
|
+
return scales;
|
|
170
|
+
});
|
|
171
|
+
export const selectorChartNormalizedYScales = createSelector([selectorChartRawYAxis, selectorChartFilteredYDomains], function selectorChartNormalizedYScales(axes, filteredDomains) {
|
|
172
|
+
const scales = {};
|
|
173
|
+
axes?.forEach(eachAxis => {
|
|
174
|
+
const axis = eachAxis;
|
|
175
|
+
const domain = filteredDomains[axis.id];
|
|
176
|
+
scales[axis.id] = getNormalizedAxisScale(axis, domain);
|
|
177
|
+
});
|
|
178
|
+
return scales;
|
|
179
|
+
});
|
|
180
|
+
export const selectorChartXScales = createSelector([selectorChartRawXAxis, selectorChartNormalizedXScales, selectorChartDrawingArea, selectorChartZoomMap], function selectorChartXScales(axes, normalizedScales, drawingArea, zoomMap) {
|
|
181
|
+
const scales = {};
|
|
182
|
+
axes?.forEach(eachAxis => {
|
|
183
|
+
const axis = eachAxis;
|
|
184
|
+
const zoom = zoomMap?.get(axis.id);
|
|
185
|
+
const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
|
|
186
|
+
const range = getRange(drawingArea, 'x', axis);
|
|
187
|
+
const scale = normalizedScales[axis.id].copy();
|
|
188
|
+
const zoomedRange = zoomScaleRange(range, zoomRange);
|
|
189
|
+
scale.range(zoomedRange);
|
|
190
|
+
scales[axis.id] = scale;
|
|
191
|
+
});
|
|
192
|
+
return scales;
|
|
193
|
+
});
|
|
194
|
+
export const selectorChartYScales = createSelector([selectorChartRawYAxis, selectorChartNormalizedYScales, selectorChartDrawingArea, selectorChartZoomMap], function selectorChartYScales(axes, normalizedScales, drawingArea, zoomMap) {
|
|
195
|
+
const scales = {};
|
|
196
|
+
axes?.forEach(eachAxis => {
|
|
197
|
+
const axis = eachAxis;
|
|
198
|
+
const zoom = zoomMap?.get(axis.id);
|
|
199
|
+
const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
|
|
200
|
+
const range = getRange(drawingArea, 'y', axis);
|
|
201
|
+
const scale = normalizedScales[axis.id].copy();
|
|
202
|
+
const scaleRange = isOrdinalScale(scale) ? range.reverse() : range;
|
|
203
|
+
const zoomedRange = zoomScaleRange(scaleRange, zoomRange);
|
|
204
|
+
scale.range(zoomedRange);
|
|
205
|
+
scales[axis.id] = scale;
|
|
206
|
+
});
|
|
207
|
+
return scales;
|
|
82
208
|
});
|
|
83
209
|
|
|
84
210
|
/**
|
|
85
211
|
* The only interesting selectors that merge axis data and zoom if provided.
|
|
86
212
|
*/
|
|
87
213
|
|
|
88
|
-
export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap,
|
|
214
|
+
export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartXDomains, selectorChartXScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, domains, scales) => computeAxisValue({
|
|
89
215
|
scales,
|
|
90
216
|
drawingArea,
|
|
91
217
|
formattedSeries,
|
|
@@ -93,11 +219,9 @@ export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selecto
|
|
|
93
219
|
seriesConfig,
|
|
94
220
|
axisDirection: 'x',
|
|
95
221
|
zoomMap,
|
|
96
|
-
|
|
97
|
-
getFilters,
|
|
98
|
-
preferStrictDomainInLineCharts
|
|
222
|
+
domains
|
|
99
223
|
}));
|
|
100
|
-
export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap,
|
|
224
|
+
export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartYDomains, selectorChartYScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, domains, scales) => computeAxisValue({
|
|
101
225
|
scales,
|
|
102
226
|
drawingArea,
|
|
103
227
|
formattedSeries,
|
|
@@ -105,9 +229,7 @@ export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selecto
|
|
|
105
229
|
seriesConfig,
|
|
106
230
|
axisDirection: 'y',
|
|
107
231
|
zoomMap,
|
|
108
|
-
|
|
109
|
-
getFilters,
|
|
110
|
-
preferStrictDomainInLineCharts
|
|
232
|
+
domains
|
|
111
233
|
}));
|
|
112
234
|
export const selectorChartAxis = createSelector([selectorChartXAxis, selectorChartYAxis, (_, axisId) => axisId], (xAxes, yAxes, axisId) => xAxes?.axis[axisId] ?? yAxes?.axis[axisId]);
|
|
113
235
|
export const selectorChartRawAxis = createSelector([selectorChartRawXAxis, selectorChartRawYAxis, (state, axisId) => axisId], (xAxes, yAxes, axisId) => {
|
|
@@ -116,4 +238,34 @@ export const selectorChartRawAxis = createSelector([selectorChartRawXAxis, selec
|
|
|
116
238
|
return undefined;
|
|
117
239
|
}
|
|
118
240
|
return axis;
|
|
241
|
+
});
|
|
242
|
+
export const selectorChartDefaultXAxisId = createSelector([selectorChartRawXAxis], xAxes => xAxes[0].id);
|
|
243
|
+
export const selectorChartDefaultYAxisId = createSelector([selectorChartRawYAxis], yAxes => yAxes[0].id);
|
|
244
|
+
const EMPTY_MAP = new Map();
|
|
245
|
+
export const selectorChartSeriesEmptyFlatbushMap = () => EMPTY_MAP;
|
|
246
|
+
export const selectorChartSeriesFlatbushMap = createSelector([selectorChartSeriesProcessed, selectorChartNormalizedXScales, selectorChartNormalizedYScales, selectorChartDefaultXAxisId, selectorChartDefaultYAxisId], function selectChartSeriesFlatbushMap(allSeries, xAxesScaleMap, yAxesScaleMap, defaultXAxisId, defaultYAxisId) {
|
|
247
|
+
// FIXME: Do we want to support non-scatter series here?
|
|
248
|
+
const validSeries = allSeries.scatter;
|
|
249
|
+
const flatbushMap = new Map();
|
|
250
|
+
if (!validSeries) {
|
|
251
|
+
return flatbushMap;
|
|
252
|
+
}
|
|
253
|
+
validSeries.seriesOrder.forEach(seriesId => {
|
|
254
|
+
const {
|
|
255
|
+
data,
|
|
256
|
+
xAxisId = defaultXAxisId,
|
|
257
|
+
yAxisId = defaultYAxisId
|
|
258
|
+
} = validSeries.series[seriesId];
|
|
259
|
+
const flatbush = new Flatbush(data.length);
|
|
260
|
+
const originalXScale = xAxesScaleMap[xAxisId];
|
|
261
|
+
const originalYScale = yAxesScaleMap[yAxisId];
|
|
262
|
+
for (const datum of data) {
|
|
263
|
+
// Add the points using a [0, 1] range so that we don't need to recreate the Flatbush structure when zooming.
|
|
264
|
+
// This doesn't happen in practice, though, because currently the scales depend on the drawing area.
|
|
265
|
+
flatbush.add(originalXScale(datum.x), originalYScale(datum.y));
|
|
266
|
+
}
|
|
267
|
+
flatbush.finish();
|
|
268
|
+
flatbushMap.set(seriesId, flatbush);
|
|
269
|
+
});
|
|
270
|
+
return flatbushMap;
|
|
119
271
|
});
|
|
@@ -34,7 +34,10 @@ export const selectorChartAxisInteraction = createSelector([selectorChartsIntera
|
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
function valueGetter(value, axes, indexes, ids = axes.axisIds[0]) {
|
|
37
|
-
return Array.isArray(ids) ? ids.map((id, axisIndex) =>
|
|
37
|
+
return Array.isArray(ids) ? ids.map((id, axisIndex) => {
|
|
38
|
+
const axis = axes.axis[id];
|
|
39
|
+
return getAxisValue(axis.scale, axis.data, value, indexes[axisIndex]);
|
|
40
|
+
}) : getAxisValue(axes.axis[ids].scale, axes.axis[ids].data, value, indexes);
|
|
38
41
|
}
|
|
39
42
|
export const selectorChartsInteractionXAxisValue = createSelector([selectorChartsInteractionPointerX, selectorChartXAxis, selectorChartsInteractionXAxisIndex, optionalGetAxisId], (x, xAxes, xIndex, id) => {
|
|
40
43
|
if (x === null || xAxes.axisIds.length === 0) {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChartDrawingArea } from "../../../../hooks/useDrawingArea.js";
|
|
2
|
+
import { ScatterValueType } from "../../../../models/seriesType/scatter.js";
|
|
3
|
+
import { Flatbush } from "../../../Flatbush.js";
|
|
4
|
+
import { D3Scale } from "../../../../models/axis.js";
|
|
5
|
+
export declare function findClosestPoints(flatbush: Flatbush, drawingArea: Pick<ChartDrawingArea, 'top' | 'left' | 'width' | 'height'>, seriesData: readonly ScatterValueType[], xScale: D3Scale, yScale: D3Scale, xZoomStart: number, xZoomEnd: number, yZoomStart: number, yZoomEnd: number, svgPointX: number, svgPointY: number, maxRadius?: number, maxResults?: number): number[];
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { isOrdinalScale } from "../../../scaleGuards.js";
|
|
2
|
+
export function findClosestPoints(flatbush, drawingArea, seriesData, xScale, yScale, xZoomStart, xZoomEnd, yZoomStart, yZoomEnd, svgPointX, svgPointY, maxRadius = Infinity, maxResults = 1) {
|
|
3
|
+
const originalXScale = xScale.copy();
|
|
4
|
+
const originalYScale = yScale.copy();
|
|
5
|
+
originalXScale.range([0, 1]);
|
|
6
|
+
originalYScale.range([0, 1]);
|
|
7
|
+
const excludeIfOutsideDrawingArea = function excludeIfOutsideDrawingArea(index) {
|
|
8
|
+
const x = originalXScale(seriesData[index].x);
|
|
9
|
+
const y = originalYScale(seriesData[index].y);
|
|
10
|
+
return x >= xZoomStart && x <= xZoomEnd && y >= yZoomStart && y <= yZoomEnd;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// We need to convert the distance from the original range [0, 1] to the current drawing area
|
|
14
|
+
// so the comparison is done on pixels instead of normalized values.
|
|
15
|
+
// fx and fy are the factors to convert the distance from [0, 1] to the current drawing area.
|
|
16
|
+
const fx = xScale.range()[1] - xScale.range()[0];
|
|
17
|
+
const fy = yScale.range()[1] - yScale.range()[0];
|
|
18
|
+
const fxSq = fx * fx;
|
|
19
|
+
const fySq = fy * fy;
|
|
20
|
+
function sqDistFn(dx, dy) {
|
|
21
|
+
return fxSq * dx * dx + fySq * dy * dy;
|
|
22
|
+
}
|
|
23
|
+
const pointX = originalXScale(invertScale(xScale, svgPointX, dataIndex => seriesData[dataIndex].x));
|
|
24
|
+
const pointY = originalYScale(invertScale(yScale, svgPointY, dataIndex => seriesData[dataIndex].y));
|
|
25
|
+
return flatbush.neighbors(pointX, pointY, maxResults, maxRadius != null ? maxRadius * maxRadius : Infinity, excludeIfOutsideDrawingArea, sqDistFn);
|
|
26
|
+
}
|
|
27
|
+
function invertScale(scale, value, getDataPoint) {
|
|
28
|
+
if (isOrdinalScale(scale)) {
|
|
29
|
+
const dataIndex = scale.bandwidth() === 0 ? Math.floor((value - Math.min(...scale.range()) + scale.step() / 2) / scale.step()) : Math.floor((value - Math.min(...scale.range())) / scale.step());
|
|
30
|
+
return getDataPoint(dataIndex);
|
|
31
|
+
}
|
|
32
|
+
return scale.invert(value);
|
|
33
|
+
}
|