@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.
Files changed (134) hide show
  1. package/BarChart/BarChart.js +44 -36
  2. package/BarChart/useBarPlotData.js +20 -33
  3. package/CHANGELOG.md +204 -1
  4. package/ChartContainer/ChartContainer.js +68 -56
  5. package/ChartsTooltip/ChartsTooltipContainer.js +2 -0
  6. package/ChartsXAxis/useAxisTicksProps.d.ts +197 -355
  7. package/ChartsYAxis/useAxisTicksProps.d.ts +197 -355
  8. package/Gauge/Gauge.js +2 -9
  9. package/Gauge/GaugeReferenceArc.d.ts +4 -1
  10. package/Gauge/GaugeReferenceArc.js +12 -3
  11. package/Gauge/GaugeValueArc.d.ts +4 -1
  12. package/Gauge/GaugeValueArc.js +16 -8
  13. package/Gauge/GaugeValueText.js +3 -1
  14. package/LineChart/LineChart.js +44 -36
  15. package/PieChart/PieArc.d.ts +18 -4
  16. package/PieChart/PieArc.js +11 -5
  17. package/PieChart/PieArcPlot.js +3 -1
  18. package/ScatterChart/ScatterChart.js +44 -36
  19. package/ScatterChart/seriesConfig/seriesProcessor.js +1 -1
  20. package/SparkLineChart/SparkLineChart.js +44 -36
  21. package/esm/BarChart/BarChart.js +44 -36
  22. package/esm/BarChart/useBarPlotData.js +20 -33
  23. package/esm/ChartContainer/ChartContainer.js +68 -56
  24. package/esm/ChartsTooltip/ChartsTooltipContainer.js +2 -0
  25. package/esm/ChartsXAxis/useAxisTicksProps.d.ts +197 -355
  26. package/esm/ChartsYAxis/useAxisTicksProps.d.ts +197 -355
  27. package/esm/Gauge/Gauge.js +2 -9
  28. package/esm/Gauge/GaugeReferenceArc.d.ts +4 -1
  29. package/esm/Gauge/GaugeReferenceArc.js +11 -2
  30. package/esm/Gauge/GaugeValueArc.d.ts +4 -1
  31. package/esm/Gauge/GaugeValueArc.js +16 -8
  32. package/esm/Gauge/GaugeValueText.js +3 -1
  33. package/esm/LineChart/LineChart.js +44 -36
  34. package/esm/PieChart/PieArc.d.ts +18 -4
  35. package/esm/PieChart/PieArc.js +11 -5
  36. package/esm/PieChart/PieArcPlot.js +3 -1
  37. package/esm/ScatterChart/ScatterChart.js +44 -36
  38. package/esm/ScatterChart/seriesConfig/seriesProcessor.js +1 -1
  39. package/esm/SparkLineChart/SparkLineChart.js +44 -36
  40. package/esm/hooks/animation/useAnimate.js +5 -3
  41. package/esm/hooks/useScale.d.ts +5 -1
  42. package/esm/index.js +1 -1
  43. package/esm/internals/Flatbush.bench.d.ts +1 -0
  44. package/esm/internals/Flatbush.bench.js +42 -0
  45. package/esm/internals/Flatbush.d.ts +63 -0
  46. package/esm/internals/Flatbush.js +468 -0
  47. package/esm/internals/animation/useAnimateInternal.d.ts +1 -1
  48. package/esm/internals/animation/useAnimateInternal.js +1 -1
  49. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +8 -8
  50. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +4 -2
  51. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +9 -11
  52. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -28
  53. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +4 -5
  54. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +3 -24
  55. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/domain.d.ts +20 -0
  56. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/domain.js +77 -0
  57. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +4 -65
  58. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +7 -104
  59. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +6 -2
  60. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -6
  61. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -3
  62. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +31 -39
  63. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +185 -6
  64. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +199 -47
  65. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +4 -1
  66. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +5 -0
  67. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +33 -0
  68. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +40 -81
  69. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +10 -3
  70. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -4
  71. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +3 -2
  72. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.types.d.ts +6 -0
  73. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +5 -1
  74. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +9 -1
  75. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +10 -1
  76. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +2 -1
  77. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -2
  78. package/esm/internals/scaleGuards.d.ts +12 -6
  79. package/esm/internals/symlogScale.js +5 -0
  80. package/esm/locales/enUS.js +4 -4
  81. package/esm/locales/ptBR.js +97 -99
  82. package/esm/models/axis.d.ts +39 -17
  83. package/esm/models/axis.js +3 -0
  84. package/esm/models/seriesType/scatter.d.ts +2 -0
  85. package/esm/themeAugmentation/components.d.ts +3 -0
  86. package/esm/themeAugmentation/overrides.d.ts +2 -0
  87. package/hooks/animation/useAnimate.js +4 -3
  88. package/hooks/useScale.d.ts +5 -1
  89. package/index.js +1 -1
  90. package/internals/Flatbush.bench.d.ts +1 -0
  91. package/internals/Flatbush.bench.js +44 -0
  92. package/internals/Flatbush.d.ts +63 -0
  93. package/internals/Flatbush.js +477 -0
  94. package/internals/animation/useAnimateInternal.d.ts +1 -1
  95. package/internals/animation/useAnimateInternal.js +1 -1
  96. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +7 -7
  97. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +4 -2
  98. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +9 -11
  99. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -28
  100. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +4 -5
  101. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +3 -25
  102. package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.d.ts +20 -0
  103. package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.js +84 -0
  104. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +4 -65
  105. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +8 -108
  106. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +6 -2
  107. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -6
  108. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -3
  109. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +29 -37
  110. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +185 -6
  111. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +200 -47
  112. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +4 -1
  113. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +5 -0
  114. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +39 -0
  115. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +39 -80
  116. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +10 -3
  117. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -4
  118. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +3 -2
  119. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.types.d.ts +6 -0
  120. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +5 -1
  121. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +9 -1
  122. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +11 -2
  123. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +2 -1
  124. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +1 -1
  125. package/internals/scaleGuards.d.ts +12 -6
  126. package/internals/symlogScale.js +5 -0
  127. package/locales/enUS.js +4 -4
  128. package/locales/ptBR.js +97 -99
  129. package/models/axis.d.ts +39 -17
  130. package/models/axis.js +4 -0
  131. package/models/seriesType/scatter.d.ts +2 -0
  132. package/package.json +7 -6
  133. package/themeAugmentation/components.d.ts +3 -0
  134. 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
- 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> & {
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, import("./getAxisScale.js").ScaleDefinition>, []>;
41
- 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> & {
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, import("./getAxisScale.js").ScaleDefinition>, []>;
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, import("../../../index.js").DefaultedXAxis | import("../../../index.js").DefaultedYAxis | undefined, [axisId: AxisId]>;
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 {};
@@ -4,18 +4,25 @@ 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.selectorChartSeriesFlatbushMap = exports.selectorChartSeriesEmptyFlatbushMap = exports.selectorChartRawAxis = exports.selectorChartNormalizedYScales = exports.selectorChartNormalizedXScales = exports.selectorChartFilteredYDomains = exports.selectorChartFilteredXDomains = exports.selectorChartDefaultYAxisId = exports.selectorChartDefaultXAxisId = exports.selectorChartAxisZoomOptionsLookup = exports.selectorChartAxisZoomData = exports.selectorChartAxis = exports.createZoomMap = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
9
10
  var _useChartDimensions = require("../../corePlugins/useChartDimensions");
10
11
  var _useChartSeries = require("../../corePlugins/useChartSeries");
11
12
  var _selectors = require("../../utils/selectors");
12
13
  var _computeAxisValue = require("./computeAxisValue");
13
14
  var _createAxisFilterMapper = require("./createAxisFilterMapper");
14
15
  var _createZoomLookup = require("./createZoomLookup");
16
+ var _axis = require("../../../../models/axis");
15
17
  var _useChartCartesianAxisLayout = require("./useChartCartesianAxisLayout.selectors");
16
18
  var _useChartExperimentalFeature = require("../../corePlugins/useChartExperimentalFeature");
17
- var _getAxisScale = require("./getAxisScale");
18
19
  var _ticks = require("../../../ticks");
20
+ var _getAxisScale = require("./getAxisScale");
21
+ var _scaleGuards = require("../../../scaleGuards");
22
+ var _zoom = require("./zoom");
23
+ var _getAxisExtrema = require("./getAxisExtrema");
24
+ var _domain = require("./domain");
25
+ var _Flatbush = require("../../../Flatbush");
19
26
  const createZoomMap = zoom => {
20
27
  const zoomItemMap = new Map();
21
28
  zoom.forEach(zoomItem => {
@@ -32,68 +39,187 @@ const selectorChartZoomState = state => state.zoom;
32
39
 
33
40
  const selectorChartZoomIsInteracting = exports.selectorChartZoomIsInteracting = (0, _selectors.createSelector)([selectorChartZoomState], zoom => zoom?.isInteracting);
34
41
  const selectorChartZoomMap = exports.selectorChartZoomMap = (0, _selectors.createSelector)([selectorChartZoomState], zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
42
+ const selectorChartAxisZoomData = exports.selectorChartAxisZoomData = (0, _selectors.createSelector)([selectorChartZoomMap, (_, axisId) => axisId], (zoomMap, axisId) => zoomMap?.get(axisId));
35
43
  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
44
  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
45
  const selectorDefaultXAxisTickNumber = exports.selectorDefaultXAxisTickNumber = (0, _selectors.createSelector)([_useChartDimensions.selectorChartDrawingArea], function selectorDefaultXAxisTickNumber(drawingArea) {
40
46
  return (0, _ticks.getDefaultTickNumber)(drawingArea.width);
41
47
  });
42
48
  const selectorDefaultYAxisTickNumber = exports.selectorDefaultYAxisTickNumber = (0, _selectors.createSelector)([_useChartDimensions.selectorChartDrawingArea], function selectorDefaultYAxisTickNumber(drawingArea) {
43
49
  return (0, _ticks.getDefaultTickNumber)(drawingArea.height);
44
50
  });
45
- const selectorChartXScales = exports.selectorChartXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorDefaultXAxisTickNumber], function selectorChartXScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts, defaultTickNumber) {
46
- return (0, _getAxisScale.getXAxesScales)({
47
- drawingArea,
48
- formattedSeries,
49
- axis,
50
- seriesConfig,
51
- zoomMap,
52
- preferStrictDomainInLineCharts,
53
- defaultTickNumber
51
+ const selectorChartXDomains = exports.selectorChartXDomains = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorDefaultXAxisTickNumber], function selectorChartXDomains(axes, formattedSeries, seriesConfig, preferStrictDomainInLineCharts, defaultTickNumber) {
52
+ const axisDirection = 'x';
53
+ const domains = {};
54
+ axes?.forEach((eachAxis, axisIndex) => {
55
+ const axis = eachAxis;
56
+ if ((0, _axis.isBandScaleConfig)(axis) || (0, _axis.isPointScaleConfig)(axis)) {
57
+ domains[axis.id] = {
58
+ domain: axis.data
59
+ };
60
+ return;
61
+ }
62
+ const axisExtrema = (0, _getAxisExtrema.getAxisExtrema)(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
63
+ domains[axis.id] = (0, _domain.calculateInitialDomainAndTickNumber)(axis, 'x', axisIndex, formattedSeries, axisExtrema, defaultTickNumber, preferStrictDomainInLineCharts);
54
64
  });
65
+ return domains;
55
66
  });
56
- const selectorChartYScales = exports.selectorChartYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorDefaultYAxisTickNumber], function selectorChartYScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts, defaultTickNumber) {
57
- return (0, _getAxisScale.getYAxesScales)({
58
- drawingArea,
59
- formattedSeries,
60
- axis,
61
- seriesConfig,
62
- zoomMap,
63
- preferStrictDomainInLineCharts,
64
- defaultTickNumber
67
+ const selectorChartYDomains = exports.selectorChartYDomains = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorDefaultYAxisTickNumber], function selectorChartYDomains(axes, formattedSeries, seriesConfig, preferStrictDomainInLineCharts, defaultTickNumber) {
68
+ const axisDirection = 'y';
69
+ const domains = {};
70
+ axes?.forEach((eachAxis, axisIndex) => {
71
+ const axis = eachAxis;
72
+ if ((0, _axis.isBandScaleConfig)(axis) || (0, _axis.isPointScaleConfig)(axis)) {
73
+ domains[axis.id] = {
74
+ domain: axis.data
75
+ };
76
+ return;
77
+ }
78
+ const axisExtrema = (0, _getAxisExtrema.getAxisExtrema)(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
79
+ domains[axis.id] = (0, _domain.calculateInitialDomainAndTickNumber)(axis, 'y', axisIndex, formattedSeries, axisExtrema, defaultTickNumber, preferStrictDomainInLineCharts);
65
80
  });
81
+ return domains;
66
82
  });
67
- const selectorChartZoomAxisFilters = exports.selectorChartZoomAxisFilters = (0, _selectors.createSelector)([selectorChartXFilter, selectorChartYFilter, _useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartXScales, selectorChartYScales], (xMapper, yMapper, xAxis, yAxis, xScales, yScales) => {
68
- if (xMapper === undefined || yMapper === undefined) {
69
- // Early return if there is no zoom.
83
+ const selectorChartZoomAxisFilters = exports.selectorChartZoomAxisFilters = (0, _selectors.createSelector)([selectorChartZoomMap, selectorChartZoomOptionsLookup, _useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartXDomains, selectorChartYDomains], (zoomMap, zoomOptions, xAxis, yAxis, xDomains, yDomains) => {
84
+ if (!zoomMap || !zoomOptions) {
70
85
  return undefined;
71
86
  }
72
- const xFilters = xAxis?.reduce((acc, axis) => {
73
- const filter = xMapper(axis.id, axis.data, xScales[axis.id].scale);
74
- if (filter !== null) {
75
- acc[axis.id] = filter;
87
+ let hasFilter = false;
88
+ const filters = {};
89
+ const axes = [...(xAxis ?? []), ...(yAxis ?? [])];
90
+ for (let i = 0; i < axes.length; i += 1) {
91
+ const axis = axes[i];
92
+ if (!zoomOptions[axis.id] || zoomOptions[axis.id].filterMode !== 'discard') {
93
+ continue;
76
94
  }
77
- return acc;
78
- }, {});
79
- const yFilters = yAxis?.reduce((acc, axis) => {
80
- const filter = yMapper(axis.id, axis.data, yScales[axis.id].scale);
81
- if (filter !== null) {
82
- acc[axis.id] = filter;
95
+ const zoom = zoomMap.get(axis.id);
96
+ if (zoom === undefined || zoom.start <= 0 && zoom.end >= 100) {
97
+ // No zoom, or zoom with all data visible
98
+ continue;
83
99
  }
84
- return acc;
85
- }, {});
86
- if (Object.keys(xFilters ?? {}).length === 0 && Object.keys(yFilters ?? {}).length === 0) {
100
+ const axisDirection = i < (xAxis?.length ?? 0) ? 'x' : 'y';
101
+ if (axis.scaleType === 'band' || axis.scaleType === 'point') {
102
+ filters[axis.id] = (0, _createAxisFilterMapper.createDiscreteScaleGetAxisFilter)(axis.data, zoom.start, zoom.end, axisDirection);
103
+ } else {
104
+ const {
105
+ domain
106
+ } = axisDirection === 'x' ? xDomains[axis.id] : yDomains[axis.id];
107
+ filters[axis.id] = (0, _createAxisFilterMapper.createContinuousScaleGetAxisFilter)(
108
+ // For continuous scales, the domain is always a two-value array.
109
+ domain, zoom.start, zoom.end, axisDirection, axis.data);
110
+ }
111
+ hasFilter = true;
112
+ }
113
+ if (!hasFilter) {
87
114
  return undefined;
88
115
  }
89
- return (0, _createAxisFilterMapper.createGetAxisFilters)((0, _extends2.default)({}, xFilters, yFilters));
116
+ return (0, _createAxisFilterMapper.createGetAxisFilters)(filters);
117
+ });
118
+ 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) => {
119
+ const filteredDomains = {};
120
+ axes?.forEach((axis, axisIndex) => {
121
+ const domain = domains[axis.id].domain;
122
+ if ((0, _axis.isBandScaleConfig)(axis) || (0, _axis.isPointScaleConfig)(axis)) {
123
+ filteredDomains[axis.id] = domain;
124
+ return;
125
+ }
126
+ const zoom = zoomMap?.get(axis.id);
127
+ const zoomOption = zoomOptions?.[axis.id];
128
+ const filter = zoom === undefined && !zoomOption ? getFilters : undefined; // Do not apply filtering if zoom is already defined.
129
+
130
+ if (!filter) {
131
+ filteredDomains[axis.id] = domain;
132
+ return;
133
+ }
134
+ const rawTickNumber = domains[axis.id].tickNumber;
135
+ const axisExtrema = (0, _getAxisExtrema.getAxisExtrema)(axis, 'x', seriesConfig, axisIndex, formattedSeries, filter);
136
+ filteredDomains[axis.id] = (0, _domain.calculateFinalDomain)(axis, 'x', axisIndex, formattedSeries, axisExtrema, rawTickNumber, preferStrictDomainInLineCharts);
137
+ });
138
+ return filteredDomains;
139
+ }, {
140
+ memoizeOptions: {
141
+ resultEqualityCheck: (a, b) => (0, _isDeepEqual.isDeepEqual)(a, b)
142
+ }
143
+ });
144
+ 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) => {
145
+ const filteredDomains = {};
146
+ axes?.forEach((axis, axisIndex) => {
147
+ const domain = domains[axis.id].domain;
148
+ if ((0, _axis.isBandScaleConfig)(axis) || (0, _axis.isPointScaleConfig)(axis)) {
149
+ filteredDomains[axis.id] = domain;
150
+ return;
151
+ }
152
+ const zoom = zoomMap?.get(axis.id);
153
+ const zoomOption = zoomOptions?.[axis.id];
154
+ const filter = zoom === undefined && !zoomOption ? getFilters : undefined; // Do not apply filtering if zoom is already defined.
155
+
156
+ if (!filter) {
157
+ filteredDomains[axis.id] = domain;
158
+ return;
159
+ }
160
+ const rawTickNumber = domains[axis.id].tickNumber;
161
+ const axisExtrema = (0, _getAxisExtrema.getAxisExtrema)(axis, 'y', seriesConfig, axisIndex, formattedSeries, filter);
162
+ filteredDomains[axis.id] = (0, _domain.calculateFinalDomain)(axis, 'y', axisIndex, formattedSeries, axisExtrema, rawTickNumber, preferStrictDomainInLineCharts);
163
+ });
164
+ return filteredDomains;
165
+ }, {
166
+ memoizeOptions: {
167
+ resultEqualityCheck: (a, b) => (0, _isDeepEqual.isDeepEqual)(a, b)
168
+ }
169
+ });
170
+ const selectorChartNormalizedXScales = exports.selectorChartNormalizedXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, selectorChartFilteredXDomains], function selectorChartNormalizedXScales(axes, filteredDomains) {
171
+ const scales = {};
172
+ axes?.forEach(eachAxis => {
173
+ const axis = eachAxis;
174
+ const domain = filteredDomains[axis.id];
175
+ scales[axis.id] = (0, _getAxisScale.getNormalizedAxisScale)(axis, domain);
176
+ });
177
+ return scales;
178
+ });
179
+ const selectorChartNormalizedYScales = exports.selectorChartNormalizedYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartFilteredYDomains], function selectorChartNormalizedYScales(axes, filteredDomains) {
180
+ const scales = {};
181
+ axes?.forEach(eachAxis => {
182
+ const axis = eachAxis;
183
+ const domain = filteredDomains[axis.id];
184
+ scales[axis.id] = (0, _getAxisScale.getNormalizedAxisScale)(axis, domain);
185
+ });
186
+ return scales;
187
+ });
188
+ const selectorChartXScales = exports.selectorChartXScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, selectorChartNormalizedXScales, _useChartDimensions.selectorChartDrawingArea, selectorChartZoomMap], function selectorChartXScales(axes, normalizedScales, drawingArea, zoomMap) {
189
+ const scales = {};
190
+ axes?.forEach(eachAxis => {
191
+ const axis = eachAxis;
192
+ const zoom = zoomMap?.get(axis.id);
193
+ const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
194
+ const range = (0, _getAxisScale.getRange)(drawingArea, 'x', axis);
195
+ const scale = normalizedScales[axis.id].copy();
196
+ const zoomedRange = (0, _zoom.zoomScaleRange)(range, zoomRange);
197
+ scale.range(zoomedRange);
198
+ scales[axis.id] = scale;
199
+ });
200
+ return scales;
201
+ });
202
+ const selectorChartYScales = exports.selectorChartYScales = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, selectorChartNormalizedYScales, _useChartDimensions.selectorChartDrawingArea, selectorChartZoomMap], function selectorChartYScales(axes, normalizedScales, drawingArea, zoomMap) {
203
+ const scales = {};
204
+ axes?.forEach(eachAxis => {
205
+ const axis = eachAxis;
206
+ const zoom = zoomMap?.get(axis.id);
207
+ const zoomRange = zoom ? [zoom.start, zoom.end] : [0, 100];
208
+ const range = (0, _getAxisScale.getRange)(drawingArea, 'y', axis);
209
+ const scale = normalizedScales[axis.id].copy();
210
+ const scaleRange = (0, _scaleGuards.isOrdinalScale)(scale) ? range.reverse() : range;
211
+ const zoomedRange = (0, _zoom.zoomScaleRange)(scaleRange, zoomRange);
212
+ scale.range(zoomedRange);
213
+ scales[axis.id] = scale;
214
+ });
215
+ return scales;
90
216
  });
91
217
 
92
218
  /**
93
219
  * The only interesting selectors that merge axis data and zoom if provided.
94
220
  */
95
221
 
96
- const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartXScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, scales) => (0, _computeAxisValue.computeAxisValue)({
222
+ 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
223
  scales,
98
224
  drawingArea,
99
225
  formattedSeries,
@@ -101,11 +227,9 @@ const selectorChartXAxis = exports.selectorChartXAxis = (0, _selectors.createSel
101
227
  seriesConfig,
102
228
  axisDirection: 'x',
103
229
  zoomMap,
104
- zoomOptions,
105
- getFilters,
106
- preferStrictDomainInLineCharts
230
+ domains
107
231
  }));
108
- const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, _useChartExperimentalFeature.selectorPreferStrictDomainInLineCharts, selectorChartYScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, scales) => (0, _computeAxisValue.computeAxisValue)({
232
+ 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
233
  scales,
110
234
  drawingArea,
111
235
  formattedSeries,
@@ -113,9 +237,7 @@ const selectorChartYAxis = exports.selectorChartYAxis = (0, _selectors.createSel
113
237
  seriesConfig,
114
238
  axisDirection: 'y',
115
239
  zoomMap,
116
- zoomOptions,
117
- getFilters,
118
- preferStrictDomainInLineCharts
240
+ domains
119
241
  }));
120
242
  const selectorChartAxis = exports.selectorChartAxis = (0, _selectors.createSelector)([selectorChartXAxis, selectorChartYAxis, (_, axisId) => axisId], (xAxes, yAxes, axisId) => xAxes?.axis[axisId] ?? yAxes?.axis[axisId]);
121
243
  const selectorChartRawAxis = exports.selectorChartRawAxis = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartCartesianAxisLayout.selectorChartRawYAxis, (state, axisId) => axisId], (xAxes, yAxes, axisId) => {
@@ -124,4 +246,35 @@ const selectorChartRawAxis = exports.selectorChartRawAxis = (0, _selectors.creat
124
246
  return undefined;
125
247
  }
126
248
  return axis;
249
+ });
250
+ const selectorChartDefaultXAxisId = exports.selectorChartDefaultXAxisId = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawXAxis], xAxes => xAxes[0].id);
251
+ const selectorChartDefaultYAxisId = exports.selectorChartDefaultYAxisId = (0, _selectors.createSelector)([_useChartCartesianAxisLayout.selectorChartRawYAxis], yAxes => yAxes[0].id);
252
+ const EMPTY_MAP = new Map();
253
+ const selectorChartSeriesEmptyFlatbushMap = () => EMPTY_MAP;
254
+ exports.selectorChartSeriesEmptyFlatbushMap = selectorChartSeriesEmptyFlatbushMap;
255
+ const selectorChartSeriesFlatbushMap = exports.selectorChartSeriesFlatbushMap = (0, _selectors.createSelector)([_useChartSeries.selectorChartSeriesProcessed, selectorChartNormalizedXScales, selectorChartNormalizedYScales, selectorChartDefaultXAxisId, selectorChartDefaultYAxisId], function selectChartSeriesFlatbushMap(allSeries, xAxesScaleMap, yAxesScaleMap, defaultXAxisId, defaultYAxisId) {
256
+ // FIXME: Do we want to support non-scatter series here?
257
+ const validSeries = allSeries.scatter;
258
+ const flatbushMap = new Map();
259
+ if (!validSeries) {
260
+ return flatbushMap;
261
+ }
262
+ validSeries.seriesOrder.forEach(seriesId => {
263
+ const {
264
+ data,
265
+ xAxisId = defaultXAxisId,
266
+ yAxisId = defaultYAxisId
267
+ } = validSeries.series[seriesId];
268
+ const flatbush = new _Flatbush.Flatbush(data.length);
269
+ const originalXScale = xAxesScaleMap[xAxisId];
270
+ const originalYScale = yAxesScaleMap[yAxisId];
271
+ for (const datum of data) {
272
+ // Add the points using a [0, 1] range so that we don't need to recreate the Flatbush structure when zooming.
273
+ // This doesn't happen in practice, though, because currently the scales depend on the drawing area.
274
+ flatbush.add(originalXScale(datum.x), originalYScale(datum.y));
275
+ }
276
+ flatbush.finish();
277
+ flatbushMap.set(seriesId, flatbush);
278
+ });
279
+ return flatbushMap;
127
280
  });
@@ -41,7 +41,10 @@ const selectorChartAxisInteraction = exports.selectorChartAxisInteraction = (0,
41
41
  */
42
42
 
43
43
  function valueGetter(value, axes, indexes, ids = axes.axisIds[0]) {
44
- return Array.isArray(ids) ? ids.map((id, axisIndex) => (0, _getAxisValue.getAxisValue)(axes.axis[id], value, indexes[axisIndex])) : (0, _getAxisValue.getAxisValue)(axes.axis[ids], value, indexes);
44
+ return Array.isArray(ids) ? ids.map((id, axisIndex) => {
45
+ const axis = axes.axis[id];
46
+ return (0, _getAxisValue.getAxisValue)(axis.scale, axis.data, value, indexes[axisIndex]);
47
+ }) : (0, _getAxisValue.getAxisValue)(axes.axis[ids].scale, axes.axis[ids].data, value, indexes);
45
48
  }
46
49
  const selectorChartsInteractionXAxisValue = exports.selectorChartsInteractionXAxisValue = (0, _selectors.createSelector)([_useChartInteraction.selectorChartsInteractionPointerX, _useChartCartesianAxisRendering.selectorChartXAxis, selectorChartsInteractionXAxisIndex, optionalGetAxisId], (x, xAxes, xIndex, id) => {
47
50
  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[];