@mui/x-charts 8.18.0 → 8.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/BarChart/seriesConfig/bar/seriesProcessor.js +15 -9
  2. package/CHANGELOG.md +113 -0
  3. package/ChartsSurface/ChartsSurface.js +5 -2
  4. package/LineChart/seriesConfig/seriesProcessor.js +15 -10
  5. package/PieChart/PieArcPlot.js +5 -3
  6. package/esm/BarChart/seriesConfig/bar/seriesProcessor.js +15 -9
  7. package/esm/ChartsSurface/ChartsSurface.js +5 -2
  8. package/esm/LineChart/seriesConfig/seriesProcessor.js +15 -10
  9. package/esm/PieChart/PieArcPlot.js +5 -3
  10. package/esm/hooks/useBarSeries.js +3 -5
  11. package/esm/hooks/useLineSeries.js +3 -5
  12. package/esm/hooks/usePieSeries.js +3 -5
  13. package/esm/hooks/useRadarSeries.js +3 -5
  14. package/esm/hooks/useScatterSeries.js +3 -5
  15. package/esm/index.d.ts +2 -1
  16. package/esm/index.js +2 -1
  17. package/esm/internals/domUtils.js +30 -14
  18. package/esm/internals/getScale.d.ts +2 -1
  19. package/esm/internals/index.d.ts +1 -1
  20. package/esm/internals/index.js +1 -1
  21. package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.js +2 -2
  22. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +5 -6
  23. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +2 -2
  24. package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +2 -2
  25. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -1
  26. package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +3 -1
  27. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +1 -1
  28. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +4 -4
  29. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +1 -1
  30. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +15 -15
  31. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +1 -1
  32. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +5 -5
  33. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3 -0
  34. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +11 -11
  35. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +5 -6
  36. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +7 -8
  37. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +2 -2
  38. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +2 -2
  39. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +11 -12
  40. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +8 -8
  41. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +4 -4
  42. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +11 -11
  43. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +6 -6
  44. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +7 -8
  45. package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.js +2 -2
  46. package/esm/internals/plugins/utils/selectors.d.ts +1 -14
  47. package/esm/internals/plugins/utils/selectors.js +1 -5
  48. package/esm/internals/seriesSelectorOfType.d.ts +20 -0
  49. package/esm/internals/seriesSelectorOfType.js +38 -0
  50. package/esm/models/seriesType/config.d.ts +2 -2
  51. package/esm/utils/index.d.ts +4 -0
  52. package/esm/utils/index.js +5 -0
  53. package/esm/utils/niceDomain.d.ts +20 -0
  54. package/esm/utils/niceDomain.js +24 -0
  55. package/hooks/useBarSeries.js +3 -6
  56. package/hooks/useLineSeries.js +3 -6
  57. package/hooks/usePieSeries.js +3 -6
  58. package/hooks/useRadarSeries.js +3 -6
  59. package/hooks/useScatterSeries.js +3 -6
  60. package/index.d.ts +2 -1
  61. package/index.js +13 -1
  62. package/internals/domUtils.js +30 -14
  63. package/internals/getScale.d.ts +2 -1
  64. package/internals/index.d.ts +1 -1
  65. package/internals/index.js +4 -4
  66. package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.js +2 -2
  67. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +4 -5
  68. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +2 -2
  69. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +2 -2
  70. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -1
  71. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +3 -1
  72. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +1 -1
  73. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +4 -4
  74. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +1 -1
  75. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +15 -15
  76. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +1 -1
  77. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +5 -5
  78. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3 -0
  79. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +11 -11
  80. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +4 -5
  81. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +6 -7
  82. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +2 -2
  83. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +2 -2
  84. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -11
  85. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +8 -8
  86. package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +4 -4
  87. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +11 -11
  88. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +6 -6
  89. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +6 -7
  90. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.js +2 -2
  91. package/internals/plugins/utils/selectors.d.ts +1 -14
  92. package/internals/plugins/utils/selectors.js +1 -8
  93. package/internals/seriesSelectorOfType.d.ts +20 -0
  94. package/internals/seriesSelectorOfType.js +46 -0
  95. package/models/seriesType/config.d.ts +2 -2
  96. package/package.json +4 -4
  97. package/utils/index.d.ts +4 -0
  98. package/utils/index.js +16 -0
  99. package/utils/niceDomain.d.ts +20 -0
  100. package/utils/niceDomain.js +29 -0
  101. package/esm/internals/createSeriesSelectorOfType.d.ts +0 -4
  102. package/esm/internals/createSeriesSelectorOfType.js +0 -45
  103. package/internals/createSeriesSelectorOfType.d.ts +0 -4
  104. package/internals/createSeriesSelectorOfType.js +0 -53
@@ -1,6 +1,5 @@
1
1
  import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
2
- import { createSelectorMemoizedWithOptions } from '@mui/x-internals/store';
3
- import { createSelector } from "../../utils/selectors.js";
2
+ import { createSelector, createSelectorMemoizedWithOptions } from '@mui/x-internals/store';
4
3
  import { selectorChartsInteractionPointerX, selectorChartsInteractionPointerY } from "../useChartInteraction/useChartInteraction.selectors.js";
5
4
  import { generateSvg2rotation } from "./coordinateTransformation.js";
6
5
  import { getAxisIndex } from "./getAxisIndex.js";
@@ -19,15 +18,15 @@ function indexGetter(value, axes, ids) {
19
18
  /**
20
19
  * Helper to get the rotation associated to the interaction coordinate.
21
20
  */
22
- const selectorChartsInteractionRotationAngle = createSelector([selectorChartsInteractionPointerX, selectorChartsInteractionPointerY, selectorChartPolarCenter], (x, y, center) => {
21
+ const selectorChartsInteractionRotationAngle = createSelector(selectorChartsInteractionPointerX, selectorChartsInteractionPointerY, selectorChartPolarCenter, (x, y, center) => {
23
22
  if (x === null || y === null) {
24
23
  return null;
25
24
  }
26
25
  return generateSvg2rotation(center)(x, y);
27
26
  });
28
- export const selectorChartsInteractionRotationAxisIndex = createSelector([selectorChartsInteractionRotationAngle, selectorChartRotationAxis, optionalGetAxisId], (rotation, rotationAxis, id = rotationAxis.axisIds[0]) => rotation === null ? null : indexGetter(rotation, rotationAxis, id));
29
- export const selectorChartsInteractionRotationAxisIndexes = createSelector([selectorChartsInteractionRotationAngle, selectorChartRotationAxis, optionalGetAxisIds], (rotation, rotationAxis, ids = rotationAxis.axisIds) => rotation === null ? null : indexGetter(rotation, rotationAxis, ids));
30
- export const selectorChartsInteractionRotationAxisValue = createSelector([selectorChartRotationAxis, selectorChartsInteractionRotationAxisIndex, optionalGetAxisId], (rotationAxis, rotationIndex, id = rotationAxis.axisIds[0]) => {
27
+ export const selectorChartsInteractionRotationAxisIndex = createSelector(selectorChartsInteractionRotationAngle, selectorChartRotationAxis, optionalGetAxisId, (rotation, rotationAxis, id = rotationAxis.axisIds[0]) => rotation === null ? null : indexGetter(rotation, rotationAxis, id));
28
+ export const selectorChartsInteractionRotationAxisIndexes = createSelector(selectorChartsInteractionRotationAngle, selectorChartRotationAxis, optionalGetAxisIds, (rotation, rotationAxis, ids = rotationAxis.axisIds) => rotation === null ? null : indexGetter(rotation, rotationAxis, ids));
29
+ export const selectorChartsInteractionRotationAxisValue = createSelector(selectorChartRotationAxis, selectorChartsInteractionRotationAxisIndex, optionalGetAxisId, (rotationAxis, rotationIndex, id = rotationAxis.axisIds[0]) => {
31
30
  if (rotationIndex === null || rotationIndex === -1 || rotationAxis.axisIds.length === 0) {
32
31
  return null;
33
32
  }
@@ -37,7 +36,7 @@ export const selectorChartsInteractionRotationAxisValue = createSelector([select
37
36
  }
38
37
  return data[rotationIndex];
39
38
  });
40
- export const selectorChartsInteractionRotationAxisValues = createSelector([selectorChartRotationAxis, selectorChartsInteractionRotationAxisIndexes, optionalGetAxisIds], (rotationAxis, rotationIndexes, ids = rotationAxis.axisIds) => {
39
+ export const selectorChartsInteractionRotationAxisValues = createSelector(selectorChartRotationAxis, selectorChartsInteractionRotationAxisIndexes, optionalGetAxisIds, (rotationAxis, rotationIndexes, ids = rotationAxis.axisIds) => {
41
40
  if (rotationIndexes === null) {
42
41
  return null;
43
42
  }
@@ -84,4 +83,4 @@ export const selectorChartsInteractionTooltipRadiusAxes = () => {
84
83
  /**
85
84
  * Return `true` if the axis tooltip has something to display.
86
85
  */
87
- export const selectorChartsInteractionPolarAxisTooltip = createSelector([selectorChartsInteractionTooltipRotationAxes], rotationTooltip => rotationTooltip.length > 0);
86
+ export const selectorChartsInteractionPolarAxisTooltip = createSelector(selectorChartsInteractionTooltipRotationAxes, rotationTooltip => rotationTooltip.length > 0);
@@ -1,3 +1,3 @@
1
- import { createSelector } from "../../utils/selectors.js";
1
+ import { createSelector } from '@mui/x-internals/store';
2
2
  const selectRootState = state => state;
3
- export const selectorChartZAxis = createSelector([selectRootState], state => state.zAxis);
3
+ export const selectorChartZAxis = createSelector(selectRootState, state => state.zAxis);
@@ -2,17 +2,4 @@ import type { Selector } from 'reselect';
2
2
  import { ChartAnyPluginSignature } from "../models/plugin.js";
3
3
  import { ChartState } from "../models/chart.js";
4
4
  export type ChartRootSelector<TSignature extends ChartAnyPluginSignature, T extends keyof TSignature['state'] = keyof TSignature['state']> = Selector<ChartState<[TSignature]>, TSignature['state'][T]>;
5
- export type ChartOptionalRootSelector<TSignature extends ChartAnyPluginSignature> = Selector<ChartState<[], [TSignature]>, TSignature['state'][keyof TSignature['state']] | undefined>;
6
- type StateFromSelectorList<Selectors extends readonly any[]> = Selectors extends [f: infer F, ...other: infer R] ? StateFromSelector<F> extends StateFromSelectorList<R> ? StateFromSelector<F> : StateFromSelectorList<R> : {};
7
- type StateFromSelector<T> = T extends ((first: infer F, ...args: any[]) => any) ? F : never;
8
- type Fn = (...args: any[]) => any;
9
- type ReturnTypes<FunctionsArray extends readonly Fn[]> = { [Index in keyof FunctionsArray]: FunctionsArray[Index] extends FunctionsArray[number] ? ReturnType<FunctionsArray[Index]> : never };
10
- type MergeParams<STypes extends readonly unknown[], CTypes extends readonly unknown[]> = STypes['length'] extends 0 ? CTypes : MergeParams<DropFirst<STypes>, DropFirst<CTypes>>;
11
- type DropFirst<T> = T extends [any, ...infer Xs] ? Xs : [];
12
- type SelectorArgs<Args extends any[], Selectors extends ReadonlyArray<Selector<any>>, Combiner extends (...args: readonly [...ReturnTypes<Selectors>, ...Args]) => any> = Selectors['length'] extends 0 ? MergeParams<ReturnTypes<Selectors>, Parameters<Combiner>> : [StateFromSelectorList<Selectors>, ...MergeParams<ReturnTypes<Selectors>, Parameters<Combiner>>];
13
- type ChartSelector<Args extends any[], Selectors extends ReadonlyArray<Selector<any>>, Combiner extends (...args: readonly [...ReturnTypes<Selectors>, ...Args]) => any> = (...args: SelectorArgs<Args, Selectors, Combiner>) => ReturnType<Combiner>;
14
- /**
15
- * Method wrapping reselect's createChartSelector to provide caching for chart instances.
16
- */
17
- export declare const createSelector: <const Args extends any[], const Selectors extends ReadonlyArray<Selector<any>>, const Combiner extends (...args: readonly [...ReturnTypes<Selectors>, ...Args]) => any>(inputSelectors: [...Selectors], combiner: Combiner) => ChartSelector<Args, Selectors, Combiner>;
18
- export {};
5
+ export type ChartOptionalRootSelector<TSignature extends ChartAnyPluginSignature> = Selector<ChartState<[], [TSignature]>, TSignature['state'][keyof TSignature['state']] | undefined>;
@@ -1,5 +1 @@
1
- import { createSelector as internalCreateSelector } from '@mui/x-internals/store';
2
- /**
3
- * Method wrapping reselect's createChartSelector to provide caching for chart instances.
4
- */
5
- export const createSelector = (inputSelectors, combiner) => internalCreateSelector(...inputSelectors, combiner);
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import { ChartSeriesDefaultized, ChartsSeriesConfig } from "../models/seriesType/config.js";
2
+ import { SeriesId } from "../models/seriesType/common.js";
3
+ import type { ProcessedSeries } from "./plugins/corePlugins/useChartSeries/index.js";
4
+ export declare const selectorAllSeriesOfType: (args_0: import("./plugins/corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("./plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./plugins/corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./plugins/corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./index.js").UseChartInteractionListenerState & Partial<{}> & {
5
+ cacheKey: import("./index.js").ChartStateCacheKey;
6
+ }, seriesType: keyof ChartsSeriesConfig) => import("./index.js").SeriesProcessorResult<"line"> | import("./index.js").SeriesProcessorResult<"bar"> | {
7
+ series: Record<SeriesId, import("../index.js").DefaultizedScatterSeriesType>;
8
+ seriesOrder: SeriesId[];
9
+ } | {
10
+ series: Record<SeriesId, import("../index.js").DefaultizedPieSeriesType>;
11
+ seriesOrder: SeriesId[];
12
+ } | {
13
+ series: Record<SeriesId, import("../index.js").DefaultizedRadarSeriesType>;
14
+ seriesOrder: SeriesId[];
15
+ } | undefined;
16
+ export declare const selectorSeriesOfType: (args_0: import("./plugins/corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("./plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./plugins/corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./plugins/corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./index.js").UseChartInteractionListenerState & Partial<{}> & {
17
+ cacheKey: import("./index.js").ChartStateCacheKey;
18
+ }, seriesType: keyof ChartsSeriesConfig, ids?: SeriesId | SeriesId[] | undefined) => import("../index.js").DefaultizedLineSeriesType | import("../index.js").DefaultizedBarSeriesType | import("../index.js").DefaultizedRadarSeriesType | import("../index.js").DefaultizedScatterSeriesType | import("../index.js").DefaultizedPieSeriesType | (import("../index.js").DefaultizedLineSeriesType | import("../index.js").DefaultizedBarSeriesType | import("../index.js").DefaultizedRadarSeriesType | import("../index.js").DefaultizedScatterSeriesType | import("../index.js").DefaultizedPieSeriesType | undefined)[] | undefined;
19
+ export declare const useAllSeriesOfType: <T extends keyof ChartsSeriesConfig>(seriesType: T) => ProcessedSeries[T];
20
+ export declare const useSeriesOfType: <T extends keyof ChartsSeriesConfig>(seriesType: T, seriesId?: SeriesId | SeriesId[]) => ChartSeriesDefaultized<T> | ChartSeriesDefaultized<T>[] | undefined;
@@ -0,0 +1,38 @@
1
+ import { warnOnce } from '@mui/x-internals/warning';
2
+ import { createSelector, createSelectorMemoized } from '@mui/x-internals/store';
3
+ import { selectorChartSeriesProcessed } from "./plugins/corePlugins/useChartSeries/useChartSeries.selectors.js";
4
+ import { useStore } from "./store/useStore.js";
5
+ import { useSelector } from "./store/useSelector.js";
6
+ export const selectorAllSeriesOfType = createSelector(selectorChartSeriesProcessed, (processedSeries, seriesType) => processedSeries[seriesType]);
7
+ export const selectorSeriesOfType = createSelectorMemoized(selectorChartSeriesProcessed, (processedSeries, seriesType, ids) => {
8
+ if (!ids || Array.isArray(ids) && ids.length === 0) {
9
+ return processedSeries[seriesType]?.seriesOrder?.map(seriesId => processedSeries[seriesType]?.series[seriesId]) ?? [];
10
+ }
11
+ if (!Array.isArray(ids)) {
12
+ return processedSeries[seriesType]?.series?.[ids];
13
+ }
14
+ const result = [];
15
+ const failedIds = [];
16
+ for (const id of ids) {
17
+ const series = processedSeries[seriesType]?.series?.[id];
18
+ if (series) {
19
+ result.push(series);
20
+ } else {
21
+ failedIds.push(id);
22
+ }
23
+ }
24
+ if (process.env.NODE_ENV !== 'production' && failedIds.length > 0) {
25
+ const formattedIds = failedIds.map(v => JSON.stringify(v)).join(', ');
26
+ const fnName = `use${seriesType.charAt(0).toUpperCase()}${seriesType.slice(1)}Series`;
27
+ warnOnce([`MUI X Charts: The following ids provided to "${fnName}" could not be found: ${formattedIds}.`, `Make sure that they exist and their series are using the "${seriesType}" series type.`]);
28
+ }
29
+ return result;
30
+ });
31
+ export const useAllSeriesOfType = seriesType => {
32
+ const store = useStore();
33
+ return useSelector(store, selectorAllSeriesOfType, seriesType);
34
+ };
35
+ export const useSeriesOfType = (seriesType, seriesId) => {
36
+ const store = useStore();
37
+ return useSelector(store, selectorSeriesOfType, seriesType, seriesId);
38
+ };
@@ -83,6 +83,6 @@ export type ChartSeriesDefaultized<T extends ChartSeriesType> = ChartsSeriesConf
83
83
  export type ChartItemIdentifier<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
84
84
  export type ChartItemIdentifierWithData<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifierWithData'];
85
85
  export type DatasetElementType<T> = {
86
- [key: string]: Readonly<T>;
86
+ [key: string]: T;
87
87
  };
88
- export type DatasetType<T = number | string | Date | null | undefined> = DatasetElementType<T>[];
88
+ export type DatasetType<T = unknown> = DatasetElementType<T>[];
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Exported utility functions for the x-charts library.
3
+ */
4
+ export * from "./niceDomain.js";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Exported utility functions for the x-charts library.
3
+ */
4
+
5
+ export * from "./niceDomain.js";
@@ -0,0 +1,20 @@
1
+ import { NumberValue } from '@mui/x-charts-vendor/d3-scale';
2
+ import { ContinuousScaleName } from "../models/index.js";
3
+ /**
4
+ * Returns a nice domain for the given scale type and domain.
5
+ * Does not modify the original domain.
6
+ *
7
+ * Providing a count improves the nice domain calculation by trying to align tick values to round
8
+ * numbers or dates.
9
+ *
10
+ * For example, if you have a domain of [29, 72] and there are 5 ticks, the nice domain will be
11
+ * [20, 80] so that the ticks can be at [20, 35, 50, 65, 80].
12
+ * However, if there are 11 ticks, the nice domain will be [25, 75] so that the ticks can be at
13
+ * [25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75].
14
+ *
15
+ * @param scaleType The type of the scale (e.g., 'linear', 'log', 'time', etc.).
16
+ * @param domain The domain to be made nicer.
17
+ * @param count An optional number of ticks to improve the nice domain calculation. Defaults to 5.
18
+ */
19
+ export declare function niceDomain<Domain extends NumberValue>(scaleType: Exclude<ContinuousScaleName, 'time' | 'utc'>, domain: Iterable<Domain>, count?: number): Domain[];
20
+ export declare function niceDomain<Domain extends NumberValue>(scaleType: 'time' | 'utc', domain: Iterable<Domain>, count?: number): Date[];
@@ -0,0 +1,24 @@
1
+ import { getScale } from "../internals/getScale.js";
2
+
3
+ /**
4
+ * Returns a nice domain for the given scale type and domain.
5
+ * Does not modify the original domain.
6
+ *
7
+ * Providing a count improves the nice domain calculation by trying to align tick values to round
8
+ * numbers or dates.
9
+ *
10
+ * For example, if you have a domain of [29, 72] and there are 5 ticks, the nice domain will be
11
+ * [20, 80] so that the ticks can be at [20, 35, 50, 65, 80].
12
+ * However, if there are 11 ticks, the nice domain will be [25, 75] so that the ticks can be at
13
+ * [25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75].
14
+ *
15
+ * @param scaleType The type of the scale (e.g., 'linear', 'log', 'time', etc.).
16
+ * @param domain The domain to be made nicer.
17
+ * @param count An optional number of ticks to improve the nice domain calculation. Defaults to 5.
18
+ */
19
+
20
+ export function niceDomain(scaleType, domain, count = 5) {
21
+ const scale = getScale(scaleType, domain, [0, 1]);
22
+ scale.nice(count);
23
+ return scale.domain();
24
+ }
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.useBarSeries = useBarSeries;
8
8
  exports.useBarSeriesContext = useBarSeriesContext;
9
- var _createSeriesSelectorOfType = require("../internals/createSeriesSelectorOfType");
10
- const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('bar');
11
- const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('bar');
12
-
9
+ var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
13
10
  /**
14
11
  * Get access to the internal state of bar series.
15
12
  *
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
33
30
  */
34
31
 
35
32
  function useBarSeries(seriesIds) {
36
- return useSelectorSeries(seriesIds);
33
+ return (0, _seriesSelectorOfType.useSeriesOfType)('bar', seriesIds);
37
34
  }
38
35
 
39
36
  /**
@@ -45,5 +42,5 @@ function useBarSeries(seriesIds) {
45
42
  * @returns the bar series
46
43
  */
47
44
  function useBarSeriesContext() {
48
- return useSelectorSeriesContext();
45
+ return (0, _seriesSelectorOfType.useAllSeriesOfType)('bar');
49
46
  }
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.useLineSeries = useLineSeries;
8
8
  exports.useLineSeriesContext = useLineSeriesContext;
9
- var _createSeriesSelectorOfType = require("../internals/createSeriesSelectorOfType");
10
- const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('line');
11
- const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('line');
12
-
9
+ var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
13
10
  /**
14
11
  * Get access to the internal state of line series.
15
12
  *
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
33
30
  */
34
31
 
35
32
  function useLineSeries(seriesIds) {
36
- return useSelectorSeries(seriesIds);
33
+ return (0, _seriesSelectorOfType.useSeriesOfType)('line', seriesIds);
37
34
  }
38
35
 
39
36
  /**
@@ -45,5 +42,5 @@ function useLineSeries(seriesIds) {
45
42
  * @returns the line series
46
43
  */
47
44
  function useLineSeriesContext() {
48
- return useSelectorSeriesContext();
45
+ return (0, _seriesSelectorOfType.useAllSeriesOfType)('line');
49
46
  }
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.usePieSeries = usePieSeries;
8
8
  exports.usePieSeriesContext = usePieSeriesContext;
9
- var _createSeriesSelectorOfType = require("../internals/createSeriesSelectorOfType");
10
- const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('pie');
11
- const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('pie');
12
-
9
+ var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
13
10
  /**
14
11
  * Get access to the internal state of pie series.
15
12
  *
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
33
30
  */
34
31
 
35
32
  function usePieSeries(seriesIds) {
36
- return useSelectorSeries(seriesIds);
33
+ return (0, _seriesSelectorOfType.useSeriesOfType)('pie', seriesIds);
37
34
  }
38
35
 
39
36
  /**
@@ -44,5 +41,5 @@ function usePieSeries(seriesIds) {
44
41
  * @returns the pie series
45
42
  */
46
43
  function usePieSeriesContext() {
47
- return useSelectorSeriesContext();
44
+ return (0, _seriesSelectorOfType.useAllSeriesOfType)('pie');
48
45
  }
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.useRadarSeries = useRadarSeries;
8
8
  exports.useRadarSeriesContext = useRadarSeriesContext;
9
- var _createSeriesSelectorOfType = require("../internals/createSeriesSelectorOfType");
10
- const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('radar');
11
- const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('radar');
12
-
9
+ var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
13
10
  /**
14
11
  * Get access to the internal state of radar series.
15
12
  *
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
33
30
  */
34
31
 
35
32
  function useRadarSeries(seriesIds) {
36
- return useSelectorSeries(seriesIds);
33
+ return (0, _seriesSelectorOfType.useSeriesOfType)('radar', seriesIds);
37
34
  }
38
35
 
39
36
  /**
@@ -44,5 +41,5 @@ function useRadarSeries(seriesIds) {
44
41
  * @returns the radar series
45
42
  */
46
43
  function useRadarSeriesContext() {
47
- return useSelectorSeriesContext();
44
+ return (0, _seriesSelectorOfType.useAllSeriesOfType)('radar');
48
45
  }
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.useScatterSeries = useScatterSeries;
8
8
  exports.useScatterSeriesContext = useScatterSeriesContext;
9
- var _createSeriesSelectorOfType = require("../internals/createSeriesSelectorOfType");
10
- const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('scatter');
11
- const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('scatter');
12
-
9
+ var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
13
10
  /**
14
11
  * Get access to the internal state of scatter series.
15
12
  *
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
33
30
  */
34
31
 
35
32
  function useScatterSeries(seriesIds) {
36
- return useSelectorSeries(seriesIds);
33
+ return (0, _seriesSelectorOfType.useSeriesOfType)('scatter', seriesIds);
37
34
  }
38
35
 
39
36
  /**
@@ -44,5 +41,5 @@ function useScatterSeries(seriesIds) {
44
41
  * @returns the scatter series
45
42
  */
46
43
  function useScatterSeriesContext() {
47
- return useSelectorSeriesContext();
44
+ return (0, _seriesSelectorOfType.useAllSeriesOfType)('scatter');
48
45
  }
package/index.d.ts CHANGED
@@ -29,4 +29,5 @@ export type { ChartContainerProps } from "./ChartContainer/index.js";
29
29
  export * from "./ChartDataProvider/index.js";
30
30
  export * from "./Toolbar/index.js";
31
31
  export * from "./ChartsWrapper/index.js";
32
- export * from "./ChartsBrushOverlay/index.js";
32
+ export * from "./ChartsBrushOverlay/index.js";
33
+ export * from "./utils/index.js";
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.18.0
2
+ * @mui/x-charts v8.19.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -379,4 +379,16 @@ Object.keys(_ChartsBrushOverlay).forEach(function (key) {
379
379
  return _ChartsBrushOverlay[key];
380
380
  }
381
381
  });
382
+ });
383
+ var _utils = require("./utils");
384
+ Object.keys(_utils).forEach(function (key) {
385
+ if (key === "default" || key === "__esModule") return;
386
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
387
+ if (key in exports && exports[key] === _utils[key]) return;
388
+ Object.defineProperty(exports, key, {
389
+ enumerable: true,
390
+ get: function () {
391
+ return _utils[key];
392
+ }
393
+ });
382
394
  });
@@ -96,11 +96,7 @@ const getStringSize = (text, style = {}) => {
96
96
  });
97
97
  measurementElem.textContent = str;
98
98
  measurementSpanContainer.replaceChildren(measurementElem);
99
- const rect = measurementElem.getBoundingClientRect();
100
- const result = {
101
- width: rect.width,
102
- height: rect.height
103
- };
99
+ const result = measureSVGTextElement(measurementElem);
104
100
  stringCache.set(cacheKey, result);
105
101
  if (stringCache.size + 1 > MAX_CACHE_NUM) {
106
102
  stringCache.clear();
@@ -145,21 +141,17 @@ function batchMeasureStrings(texts, style = {}) {
145
141
  measurementContainer.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, measurementSpanStyle[styleKey]);
146
142
  return styleKey;
147
143
  });
148
- const measurementElems = [];
144
+ const measurementElements = [];
149
145
  for (const string of textToMeasure) {
150
146
  const measurementElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
151
147
  measurementElem.textContent = `${string}`;
152
- measurementElems.push(measurementElem);
148
+ measurementElements.push(measurementElem);
153
149
  }
154
- measurementContainer.replaceChildren(...measurementElems);
150
+ measurementContainer.replaceChildren(...measurementElements);
155
151
  for (let i = 0; i < textToMeasure.length; i += 1) {
156
152
  const text = textToMeasure[i];
157
- const measurementSpan = measurementContainer.children[i];
158
- const rect = measurementSpan.getBoundingClientRect();
159
- const result = {
160
- width: rect.width,
161
- height: rect.height
162
- };
153
+ const measurementElem = measurementContainer.children[i];
154
+ const result = measureSVGTextElement(measurementElem);
163
155
  const cacheKey = `${text}-${styleString}`;
164
156
  stringCache.set(cacheKey, result);
165
157
  sizeMap.set(text, result);
@@ -173,6 +165,30 @@ function batchMeasureStrings(texts, style = {}) {
173
165
  }
174
166
  return sizeMap;
175
167
  }
168
+
169
+ /**
170
+ * Measures an SVG text element using getBBox() with fallback to getBoundingClientRect()
171
+ * @param element SVG text element to measure
172
+ * @returns width and height of the text element
173
+ */
174
+ function measureSVGTextElement(element) {
175
+ // getBBox() is more reliable across browsers for SVG elements
176
+ try {
177
+ const result = element.getBBox();
178
+ return {
179
+ width: result.width,
180
+ height: result.height
181
+ };
182
+ } catch {
183
+ // Fallback to getBoundingClientRect if getBBox fails
184
+ // This can happen in tests
185
+ const result = element.getBoundingClientRect();
186
+ return {
187
+ width: result.width,
188
+ height: result.height
189
+ };
190
+ }
191
+ }
176
192
  let measurementContainer = null;
177
193
 
178
194
  /**
@@ -1,2 +1,3 @@
1
+ import { NumberValue } from '@mui/x-charts-vendor/d3-scale';
1
2
  import { ContinuousScaleName, D3ContinuousScale } from "../models/axis.js";
2
- export declare function getScale(scaleType: ContinuousScaleName, domain: readonly any[], range: readonly any[]): D3ContinuousScale;
3
+ export declare function getScale<Domain extends NumberValue = any, Range = any>(scaleType: ContinuousScaleName, domain: Iterable<Domain>, range: readonly Range[]): D3ContinuousScale<Range, Range>;
@@ -15,7 +15,7 @@ export { useBarPlotData } from "../BarChart/useBarPlotData.js";
15
15
  export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
16
16
  export * from "../ChartContainer/useChartContainerProps.js";
17
17
  export * from "../ChartDataProvider/useChartDataProviderProps.js";
18
- export * from "./createSeriesSelectorOfType.js";
18
+ export * from "./seriesSelectorOfType.js";
19
19
  export * from "./plugins/corePlugins/useChartId/index.js";
20
20
  export * from "./plugins/corePlugins/useChartSeries/index.js";
21
21
  export * from "./plugins/corePlugins/useChartDimensions/index.js";
@@ -182,15 +182,15 @@ Object.keys(_useChartDataProviderProps).forEach(function (key) {
182
182
  }
183
183
  });
184
184
  });
185
- var _createSeriesSelectorOfType = require("./createSeriesSelectorOfType");
186
- Object.keys(_createSeriesSelectorOfType).forEach(function (key) {
185
+ var _seriesSelectorOfType = require("./seriesSelectorOfType");
186
+ Object.keys(_seriesSelectorOfType).forEach(function (key) {
187
187
  if (key === "default" || key === "__esModule") return;
188
188
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
189
- if (key in exports && exports[key] === _createSeriesSelectorOfType[key]) return;
189
+ if (key in exports && exports[key] === _seriesSelectorOfType[key]) return;
190
190
  Object.defineProperty(exports, key, {
191
191
  enumerable: true,
192
192
  get: function () {
193
- return _createSeriesSelectorOfType[key];
193
+ return _seriesSelectorOfType[key];
194
194
  }
195
195
  });
196
196
  });
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.selectorChartSkipAnimation = void 0;
7
- var _selectors = require("../../utils/selectors");
7
+ var _store = require("@mui/x-internals/store");
8
8
  const selectorChartAnimationState = state => state.animation;
9
- const selectorChartSkipAnimation = exports.selectorChartSkipAnimation = (0, _selectors.createSelector)([selectorChartAnimationState], state => state.skip || state.skipAnimationRequests > 0);
9
+ const selectorChartSkipAnimation = exports.selectorChartSkipAnimation = (0, _store.createSelector)(selectorChartAnimationState, state => state.skip || state.skipAnimationRequests > 0);
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.selectorChartSvgWidth = exports.selectorChartSvgHeight = exports.selectorChartPropsWidth = exports.selectorChartPropsHeight = exports.selectorChartMargin = exports.selectorChartDrawingArea = exports.selectorChartDimensionsState = void 0;
7
7
  var _store = require("@mui/x-internals/store");
8
- var _selectors = require("../../utils/selectors");
9
8
  var _useChartAxisSize = require("../../featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors");
10
9
  const selectorChartDimensionsState = state => state.dimensions;
11
10
  exports.selectorChartDimensionsState = selectorChartDimensionsState;
@@ -34,7 +33,7 @@ const selectorChartDrawingArea = exports.selectorChartDrawingArea = (0, _store.c
34
33
  bottom: marginBottom + axisSizeBottom
35
34
  };
36
35
  });
37
- const selectorChartSvgWidth = exports.selectorChartSvgWidth = (0, _selectors.createSelector)([selectorChartDimensionsState], dimensionsState => dimensionsState.width);
38
- const selectorChartSvgHeight = exports.selectorChartSvgHeight = (0, _selectors.createSelector)([selectorChartDimensionsState], dimensionsState => dimensionsState.height);
39
- const selectorChartPropsWidth = exports.selectorChartPropsWidth = (0, _selectors.createSelector)([selectorChartDimensionsState], dimensionsState => dimensionsState.propsWidth);
40
- const selectorChartPropsHeight = exports.selectorChartPropsHeight = (0, _selectors.createSelector)([selectorChartDimensionsState], dimensionsState => dimensionsState.propsHeight);
36
+ const selectorChartSvgWidth = exports.selectorChartSvgWidth = (0, _store.createSelector)(selectorChartDimensionsState, dimensionsState => dimensionsState.width);
37
+ const selectorChartSvgHeight = exports.selectorChartSvgHeight = (0, _store.createSelector)(selectorChartDimensionsState, dimensionsState => dimensionsState.height);
38
+ const selectorChartPropsWidth = exports.selectorChartPropsWidth = (0, _store.createSelector)(selectorChartDimensionsState, dimensionsState => dimensionsState.propsWidth);
39
+ const selectorChartPropsHeight = exports.selectorChartPropsHeight = (0, _store.createSelector)(selectorChartDimensionsState, dimensionsState => dimensionsState.propsHeight);
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.selectorPreferStrictDomainInLineCharts = exports.selectorChartExperimentalFeaturesState = void 0;
7
- var _selectors = require("../../utils/selectors");
7
+ var _store = require("@mui/x-internals/store");
8
8
  const selectorChartExperimentalFeaturesState = state => state.experimentalFeatures;
9
9
  exports.selectorChartExperimentalFeaturesState = selectorChartExperimentalFeaturesState;
10
- const selectorPreferStrictDomainInLineCharts = exports.selectorPreferStrictDomainInLineCharts = (0, _selectors.createSelector)([selectorChartExperimentalFeaturesState], features => Boolean(features?.preferStrictDomainInLineCharts));
10
+ const selectorPreferStrictDomainInLineCharts = exports.selectorPreferStrictDomainInLineCharts = (0, _store.createSelector)(selectorChartExperimentalFeaturesState, features => Boolean(features?.preferStrictDomainInLineCharts));
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.selectorChartId = void 0;
7
- var _selectors = require("../../utils/selectors");
7
+ var _store = require("@mui/x-internals/store");
8
8
  const selectorChartIdState = state => state.id;
9
9
 
10
10
  /**
@@ -12,4 +12,4 @@ const selectorChartIdState = state => state.id;
12
12
  * @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
13
13
  * @returns {string} The id attribute of the chart.
14
14
  */
15
- const selectorChartId = exports.selectorChartId = (0, _selectors.createSelector)([selectorChartIdState], idState => idState.chartId);
15
+ const selectorChartId = exports.selectorChartId = (0, _store.createSelector)(selectorChartIdState, idState => idState.chartId);
@@ -50,6 +50,9 @@ const useChartInteractionListener = ({
50
50
  name: 'zoomTurnWheel',
51
51
  sensitivity: 0.01,
52
52
  initialDelta: 1
53
+ }), new _core.TurnWheelGesture({
54
+ name: 'panTurnWheel',
55
+ sensitivity: 0.5
53
56
  }), new _core.TapAndDragGesture({
54
57
  name: 'zoomTapAndDrag',
55
58
  dragThreshold: 10
@@ -69,7 +72,7 @@ const useChartInteractionListener = ({
69
72
  if (!svg || !gestureManager) {
70
73
  return undefined;
71
74
  }
72
- gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag', 'zoomPressAndDrag', 'zoomDoubleTapReset', 'brush'], svg);
75
+ gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'panTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag', 'zoomPressAndDrag', 'zoomDoubleTapReset', 'brush'], svg);
73
76
  return () => {
74
77
  // Cleanup gesture manager
75
78
  gestureManager.unregisterAllGestures(svg);
@@ -1,6 +1,6 @@
1
1
  import { MoveEvent, PanEvent, PanGestureOptions, PinchEvent, PinchGestureOptions, PressEvent, TapEvent, TurnWheelEvent, type PressAndDragEvent, type PressAndDragGestureOptions, type TapAndDragEvent, type TapAndDragGestureOptions, type TapGestureOptions, type TurnWheelGestureOptions } from '@mui/x-internal-gestures/core';
2
2
  import { ChartPluginSignature } from "../../models/index.js";
3
- export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'zoomTurnWheel' | 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd' | 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd' | 'move' | 'moveStart' | 'moveEnd' | 'tap' | 'quickPress' | 'quickPressEnd' | 'zoomDoubleTapReset' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd';
3
+ export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'zoomTurnWheel' | 'panTurnWheel' | 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd' | 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd' | 'move' | 'moveStart' | 'moveEnd' | 'tap' | 'quickPress' | 'quickPressEnd' | 'zoomDoubleTapReset' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd';
4
4
  export type InteractionListenerResult = {
5
5
  cleanup: () => void;
6
6
  };
@@ -8,6 +8,7 @@ export type AddInteractionListener = {
8
8
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd', callback: (event: PanEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
9
9
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd', callback: (event: PinchEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
10
10
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomTurnWheel', callback: (event: TurnWheelEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
11
+ <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'panTurnWheel', callback: (event: TurnWheelEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
11
12
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'move' | 'moveStart' | 'moveEnd', callback: (event: MoveEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
12
13
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'tap' | 'zoomDoubleTapReset', callback: (event: TapEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
13
14
  <CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'quickPress' | 'quickPressEnd', callback: (event: PressEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
@@ -18,6 +19,7 @@ export type UpdateZoomInteractionListeners = {
18
19
  (interaction: 'zoomPan', options?: Omit<PanGestureOptions<'zoomPan'>, 'name'>): void;
19
20
  (interaction: 'zoomPinch', options?: Omit<PinchGestureOptions<'zoomPinch'>, 'name'>): void;
20
21
  (interaction: 'zoomTurnWheel', options?: Omit<TurnWheelGestureOptions<'zoomTurnWheel'>, 'name'>): void;
22
+ (interaction: 'panTurnWheel', options?: Omit<TurnWheelGestureOptions<'panTurnWheel'>, 'name'>): void;
21
23
  (interaction: 'zoomTapAndDrag', options?: Omit<TapAndDragGestureOptions<'zoomTapAndDrag'>, 'name'>): void;
22
24
  (interaction: 'zoomPressAndDrag', options?: Omit<PressAndDragGestureOptions<'zoomPressAndDrag'>, 'name'>): void;
23
25
  (interaction: 'zoomDoubleTapReset', options?: Omit<TapGestureOptions<'zoomDoubleTapReset'>, 'name'>): void;
@@ -14,4 +14,4 @@ export declare const selectorChartSeriesConfig: (args_0: import("../useChartId/u
14
14
  */
15
15
  export declare const selectorChartDataset: (args_0: import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
16
16
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
17
- }) => readonly import("../../../index.js").DatasetElementType<string | number | Date | null | undefined>[] | undefined;
17
+ }) => readonly import("../../../index.js").DatasetElementType<unknown>[] | undefined;