@mui/x-charts-pro 8.2.0 → 8.3.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 (154) hide show
  1. package/BarChartPro/BarChartPro.d.ts +7 -1
  2. package/BarChartPro/BarChartPro.js +60 -4
  3. package/CHANGELOG.md +107 -0
  4. package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  5. package/ChartZoomSlider/ChartZoomSlider.d.ts +5 -0
  6. package/ChartZoomSlider/ChartZoomSlider.js +47 -0
  7. package/ChartZoomSlider/index.d.ts +2 -0
  8. package/ChartZoomSlider/index.js +27 -0
  9. package/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +23 -0
  10. package/ChartZoomSlider/internals/ChartAxisZoomSlider.js +348 -0
  11. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +12 -0
  12. package/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +92 -0
  13. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +17 -0
  14. package/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.js +27 -0
  15. package/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -0
  16. package/ChartsToolbarPro/ChartsToolbarPro.js +31 -0
  17. package/ChartsToolbarPro/index.d.ts +1 -0
  18. package/ChartsToolbarPro/index.js +16 -0
  19. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +13 -0
  20. package/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +36 -0
  21. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +13 -0
  22. package/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +36 -0
  23. package/FunnelChart/FunnelChart.js +2 -7
  24. package/FunnelChart/FunnelPlot.js +24 -3
  25. package/FunnelChart/FunnelSection.d.ts +1 -0
  26. package/FunnelChart/FunnelSection.js +12 -7
  27. package/FunnelChart/curves/borderRadiusPolygon.d.ts +8 -0
  28. package/FunnelChart/curves/borderRadiusPolygon.js +42 -0
  29. package/FunnelChart/curves/bump.d.ts +8 -5
  30. package/FunnelChart/curves/bump.js +21 -22
  31. package/FunnelChart/curves/curve.types.d.ts +33 -3
  32. package/FunnelChart/curves/getFunnelCurve.d.ts +2 -2
  33. package/FunnelChart/curves/getFunnelCurve.js +12 -4
  34. package/FunnelChart/curves/linear.d.ts +17 -9
  35. package/FunnelChart/curves/linear.js +62 -87
  36. package/FunnelChart/curves/pyramid.d.ts +34 -0
  37. package/FunnelChart/curves/pyramid.js +127 -0
  38. package/FunnelChart/curves/step-pyramid.d.ts +31 -0
  39. package/FunnelChart/curves/step-pyramid.js +107 -0
  40. package/FunnelChart/curves/step.d.ts +32 -0
  41. package/FunnelChart/curves/step.js +88 -0
  42. package/FunnelChart/curves/utils.d.ts +4 -0
  43. package/FunnelChart/curves/utils.js +29 -0
  44. package/FunnelChart/funnel.types.d.ts +23 -2
  45. package/FunnelChart/funnelSectionClasses.d.ts +5 -1
  46. package/FunnelChart/funnelSectionClasses.js +5 -2
  47. package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +1 -0
  48. package/FunnelChart/useFunnelChartProps.d.ts +0 -5
  49. package/FunnelChart/useFunnelChartProps.js +0 -11
  50. package/Heatmap/Heatmap.d.ts +3 -3
  51. package/Heatmap/Heatmap.js +2 -20
  52. package/LineChartPro/LineChartPro.d.ts +7 -1
  53. package/LineChartPro/LineChartPro.js +60 -4
  54. package/ScatterChartPro/ScatterChartPro.d.ts +7 -1
  55. package/ScatterChartPro/ScatterChartPro.js +60 -4
  56. package/esm/BarChartPro/BarChartPro.d.ts +7 -1
  57. package/esm/BarChartPro/BarChartPro.js +60 -4
  58. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
  59. package/esm/ChartZoomSlider/ChartZoomSlider.d.ts +5 -0
  60. package/esm/ChartZoomSlider/ChartZoomSlider.js +41 -0
  61. package/esm/ChartZoomSlider/index.d.ts +2 -0
  62. package/esm/ChartZoomSlider/index.js +2 -0
  63. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.d.ts +23 -0
  64. package/esm/ChartZoomSlider/internals/ChartAxisZoomSlider.js +339 -0
  65. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.d.ts +12 -0
  66. package/esm/ChartZoomSlider/internals/ChartAxisZoomSliderHandle.js +85 -0
  67. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.d.ts +17 -0
  68. package/esm/ChartZoomSlider/internals/chartAxisZoomSliderHandleClasses.js +17 -0
  69. package/esm/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -0
  70. package/esm/ChartsToolbarPro/ChartsToolbarPro.js +24 -0
  71. package/esm/ChartsToolbarPro/index.d.ts +1 -0
  72. package/esm/ChartsToolbarPro/index.js +1 -0
  73. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.d.ts +13 -0
  74. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomInButton.js +29 -0
  75. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.d.ts +13 -0
  76. package/esm/ChartsToolbarPro/internal/ChartsToolbarZoomOutButton.js +29 -0
  77. package/esm/FunnelChart/FunnelChart.js +2 -7
  78. package/esm/FunnelChart/FunnelPlot.js +24 -3
  79. package/esm/FunnelChart/FunnelSection.d.ts +1 -0
  80. package/esm/FunnelChart/FunnelSection.js +12 -7
  81. package/esm/FunnelChart/curves/borderRadiusPolygon.d.ts +8 -0
  82. package/esm/FunnelChart/curves/borderRadiusPolygon.js +36 -0
  83. package/esm/FunnelChart/curves/bump.d.ts +8 -5
  84. package/esm/FunnelChart/curves/bump.js +21 -22
  85. package/esm/FunnelChart/curves/curve.types.d.ts +33 -3
  86. package/esm/FunnelChart/curves/getFunnelCurve.d.ts +2 -2
  87. package/esm/FunnelChart/curves/getFunnelCurve.js +12 -4
  88. package/esm/FunnelChart/curves/linear.d.ts +17 -9
  89. package/esm/FunnelChart/curves/linear.js +62 -86
  90. package/esm/FunnelChart/curves/pyramid.d.ts +34 -0
  91. package/esm/FunnelChart/curves/pyramid.js +121 -0
  92. package/esm/FunnelChart/curves/step-pyramid.d.ts +31 -0
  93. package/esm/FunnelChart/curves/step-pyramid.js +101 -0
  94. package/esm/FunnelChart/curves/step.d.ts +32 -0
  95. package/esm/FunnelChart/curves/step.js +82 -0
  96. package/esm/FunnelChart/curves/utils.d.ts +4 -0
  97. package/esm/FunnelChart/curves/utils.js +19 -0
  98. package/esm/FunnelChart/funnel.types.d.ts +23 -2
  99. package/esm/FunnelChart/funnelSectionClasses.d.ts +5 -1
  100. package/esm/FunnelChart/funnelSectionClasses.js +5 -2
  101. package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +1 -0
  102. package/esm/FunnelChart/useFunnelChartProps.d.ts +0 -5
  103. package/esm/FunnelChart/useFunnelChartProps.js +0 -11
  104. package/esm/Heatmap/Heatmap.d.ts +3 -3
  105. package/esm/Heatmap/Heatmap.js +2 -20
  106. package/esm/LineChartPro/LineChartPro.d.ts +7 -1
  107. package/esm/LineChartPro/LineChartPro.js +60 -4
  108. package/esm/ScatterChartPro/ScatterChartPro.d.ts +7 -1
  109. package/esm/ScatterChartPro/ScatterChartPro.js +60 -4
  110. package/esm/index.d.ts +4 -1
  111. package/esm/index.js +5 -2
  112. package/esm/internals/material/icons.d.ts +3 -0
  113. package/esm/internals/material/icons.js +13 -0
  114. package/esm/internals/material/index.d.ts +4 -0
  115. package/esm/internals/material/index.js +12 -0
  116. package/esm/internals/plugins/useChartProZoom/calculateZoom.d.ts +23 -0
  117. package/esm/internals/plugins/useChartProZoom/calculateZoom.js +32 -0
  118. package/esm/internals/plugins/useChartProZoom/useChartProZoom.d.ts +1 -1
  119. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +45 -3
  120. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +63 -11
  121. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +3 -2
  122. package/esm/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +17 -2
  123. package/esm/internals/slots/chartBaseSlotProps.d.ts +10 -0
  124. package/esm/internals/slots/chartBaseSlotProps.js +1 -0
  125. package/esm/internals/slots/chartsBaseSlots.d.ts +6 -0
  126. package/esm/internals/slots/chartsBaseSlots.js +1 -0
  127. package/esm/internals/slots/chartsIconSlots.d.ts +14 -0
  128. package/esm/internals/slots/chartsIconSlots.js +1 -0
  129. package/esm/typeOverloads/modules.d.ts +1 -1
  130. package/index.d.ts +4 -1
  131. package/index.js +90 -1
  132. package/internals/material/icons.d.ts +3 -0
  133. package/internals/material/icons.js +20 -0
  134. package/internals/material/index.d.ts +4 -0
  135. package/internals/material/index.js +19 -0
  136. package/internals/plugins/useChartProZoom/calculateZoom.d.ts +23 -0
  137. package/internals/plugins/useChartProZoom/calculateZoom.js +39 -0
  138. package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +1 -1
  139. package/internals/plugins/useChartProZoom/useChartProZoom.js +44 -2
  140. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +63 -11
  141. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +3 -2
  142. package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +17 -2
  143. package/internals/slots/chartBaseSlotProps.d.ts +10 -0
  144. package/internals/slots/chartBaseSlotProps.js +5 -0
  145. package/internals/slots/chartsBaseSlots.d.ts +6 -0
  146. package/internals/slots/chartsBaseSlots.js +5 -0
  147. package/internals/slots/chartsIconSlots.d.ts +14 -0
  148. package/internals/slots/chartsIconSlots.js +5 -0
  149. package/package.json +7 -7
  150. package/typeOverloads/modules.d.ts +1 -1
  151. package/FunnelChart/curves/funnelStep.d.ts +0 -25
  152. package/FunnelChart/curves/funnelStep.js +0 -87
  153. package/esm/FunnelChart/curves/funnelStep.d.ts +0 -25
  154. package/esm/FunnelChart/curves/funnelStep.js +0 -80
@@ -0,0 +1,23 @@
1
+ import { DefaultizedZoomOptions, ZoomData } from '@mui/x-charts/internals';
2
+ /**
3
+ * Calculates the new zoom range based on the current zoom, step, and constraints.
4
+ *
5
+ * A step of 0.1 or -0.1 means that 10% of the current range will be subtracted/added, respectively, and assuming no
6
+ * constraints (e.g., minSpan, maxEnd) are faced.
7
+ *
8
+ * @param zoom Current zoom range with start and end values.
9
+ * @param step Percentage of the current zoom range to adjust (positive to zoom in, negative to zoom out). Ranges from 0 to 1.
10
+ * @param minSpan Minimum allowed span between start and end values.
11
+ * @param maxSpan Maximum allowed span between start and end values.
12
+ * @param minStart Minimum allowed start value.
13
+ * @param maxEnd Maximum allowed end value.
14
+ */
15
+ export declare function calculateZoom<T extends Readonly<Pick<ZoomData, 'start' | 'end'>>>(zoom: T, step: number, {
16
+ minSpan,
17
+ maxSpan,
18
+ minStart,
19
+ maxEnd
20
+ }: Pick<DefaultizedZoomOptions, 'minSpan' | 'maxSpan' | 'minStart' | 'maxEnd'>): T & {
21
+ start: number;
22
+ end: number;
23
+ };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.calculateZoom = calculateZoom;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ /**
10
+ * Calculates the new zoom range based on the current zoom, step, and constraints.
11
+ *
12
+ * A step of 0.1 or -0.1 means that 10% of the current range will be subtracted/added, respectively, and assuming no
13
+ * constraints (e.g., minSpan, maxEnd) are faced.
14
+ *
15
+ * @param zoom Current zoom range with start and end values.
16
+ * @param step Percentage of the current zoom range to adjust (positive to zoom in, negative to zoom out). Ranges from 0 to 1.
17
+ * @param minSpan Minimum allowed span between start and end values.
18
+ * @param maxSpan Maximum allowed span between start and end values.
19
+ * @param minStart Minimum allowed start value.
20
+ * @param maxEnd Maximum allowed end value.
21
+ */
22
+ function calculateZoom(zoom, step, {
23
+ minSpan,
24
+ maxSpan,
25
+ minStart,
26
+ maxEnd
27
+ }) {
28
+ const span = zoom.end - zoom.start;
29
+ let delta = span * step / 2;
30
+ if (delta > 0) {
31
+ delta = Math.min(delta, (span - minSpan) / 2);
32
+ } else {
33
+ delta = Math.max(delta, (span - maxSpan) / 2);
34
+ }
35
+ return (0, _extends2.default)({}, zoom, {
36
+ start: Math.max(minStart, zoom.start + delta),
37
+ end: Math.min(maxEnd, zoom.end - delta)
38
+ });
39
+ }
@@ -1,4 +1,4 @@
1
1
  import { ChartPlugin, AxisId, DefaultizedZoomOptions, ZoomData } from '@mui/x-charts/internals';
2
2
  import { UseChartProZoomSignature } from "./useChartProZoom.types.js";
3
- export declare function initializeZoomData(options: Record<AxisId, DefaultizedZoomOptions>, zoomData?: readonly ZoomData[]): ZoomData[];
3
+ export declare function initializeZoomData(options: Record<AxisId, Pick<DefaultizedZoomOptions, 'axisId' | 'minStart' | 'maxEnd'>>, zoomData?: readonly ZoomData[]): ZoomData[];
4
4
  export declare const useChartProZoom: ChartPlugin<UseChartProZoomSignature>;
@@ -14,6 +14,7 @@ var _internals = require("@mui/x-charts/internals");
14
14
  var _utils = require("@mui/material/utils");
15
15
  var _rafThrottle = require("@mui/x-internals/rafThrottle");
16
16
  var _debounce = _interopRequireDefault(require("@mui/utils/debounce"));
17
+ var _calculateZoom = require("./calculateZoom");
17
18
  var _useChartProZoom = require("./useChartProZoom.utils");
18
19
  // It is helpful to avoid the need to provide the possibly auto-generated id for each axis.
19
20
  function initializeZoomData(options, zoomData) {
@@ -108,6 +109,34 @@ const useChartProZoom = ({
108
109
  });
109
110
  });
110
111
  }, [onZoomChange, store, removeIsInteracting]);
112
+ const moveZoomRange = React.useCallback((axisId, by) => {
113
+ setZoomDataCallback(prevZoomData => {
114
+ return prevZoomData.map(zoom => {
115
+ if (zoom.axisId !== axisId) {
116
+ return zoom;
117
+ }
118
+ const options = optionsLookup[axisId];
119
+ if (!options) {
120
+ return zoom;
121
+ }
122
+ let start = zoom.start;
123
+ let end = zoom.end;
124
+ if (by > 0) {
125
+ const span = end - start;
126
+ end = Math.min(end + by, options.maxEnd);
127
+ start = end - span;
128
+ } else {
129
+ const span = end - start;
130
+ start = Math.max(start + by, options.minStart);
131
+ end = start + span;
132
+ }
133
+ return (0, _extends2.default)({}, zoom, {
134
+ start,
135
+ end
136
+ });
137
+ });
138
+ });
139
+ }, [optionsLookup, setZoomDataCallback]);
111
140
  React.useEffect(() => {
112
141
  return () => {
113
142
  removeIsInteracting.clear();
@@ -334,12 +363,25 @@ const useChartProZoom = ({
334
363
  rafThrottledSetZoomData.clear();
335
364
  };
336
365
  }, [svgRef, drawingArea, isZoomEnabled, optionsLookup, instance, setZoomDataCallback]);
366
+ const zoom = React.useCallback(step => {
367
+ setZoomDataCallback(prev => prev.map(zoomData => {
368
+ const zoomOptions = (0, _internals.selectorChartAxisZoomOptionsLookup)(store.getSnapshot(), zoomData.axisId);
369
+ return (0, _calculateZoom.calculateZoom)(zoomData, step, zoomOptions);
370
+ }));
371
+ }, [setZoomDataCallback, store]);
372
+ const zoomIn = React.useCallback(() => zoom(0.1), [zoom]);
373
+ const zoomOut = React.useCallback(() => zoom(-0.1), [zoom]);
337
374
  return {
338
375
  publicAPI: {
339
- setZoomData: setZoomDataCallback
376
+ setZoomData: setZoomDataCallback,
377
+ zoomIn,
378
+ zoomOut
340
379
  },
341
380
  instance: {
342
- setZoomData: setZoomDataCallback
381
+ setZoomData: setZoomDataCallback,
382
+ moveZoomRange,
383
+ zoomIn,
384
+ zoomOut
343
385
  }
344
386
  };
345
387
  };
@@ -1,4 +1,4 @@
1
- import { ChartRootSelector } from '@mui/x-charts/internals';
1
+ import { AxisId, ChartRootSelector } from '@mui/x-charts/internals';
2
2
  import { UseChartProZoomSignature } from "./useChartProZoom.types.js";
3
3
  export declare const selectorChartZoomState: ChartRootSelector<UseChartProZoomSignature>;
4
4
  export declare const selectorChartZoomIsInteracting: ((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & import("./useChartProZoom.types.js").UseChartProZoomState & Partial<{}> & {
@@ -62,11 +62,11 @@ export declare const selectorChartZoomIsEnabled: ((state: import("@mui/x-charts/
62
62
  resultsCount: () => number;
63
63
  resetResultsCount: () => void;
64
64
  } & {
65
- resultFunc: (resultFuncArgs_0: Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>, resultFuncArgs_1: Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) => {
65
+ resultFunc: (resultFuncArgs_0: Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>, resultFuncArgs_1: Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) => {
66
66
  [x: string]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
67
67
  [x: number]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
68
68
  };
69
- memoizedResultFunc: ((resultFuncArgs_0: Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>, resultFuncArgs_1: Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) => {
69
+ memoizedResultFunc: ((resultFuncArgs_0: Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>, resultFuncArgs_1: Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) => {
70
70
  [x: string]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
71
71
  [x: number]: import("@mui/x-charts/internals").DefaultizedZoomOptions;
72
72
  }) & {
@@ -80,18 +80,18 @@ export declare const selectorChartZoomIsEnabled: ((state: import("@mui/x-charts/
80
80
  };
81
81
  dependencies: [((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
82
82
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
83
- }) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
83
+ }) => Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
84
84
  clearCache: () => void;
85
85
  resultsCount: () => number;
86
86
  resetResultsCount: () => void;
87
87
  } & {
88
- resultFunc: (resultFuncArgs_0: import("@mui/x-charts/internals").DefaultedXAxis[] | undefined) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
89
- memoizedResultFunc: ((resultFuncArgs_0: import("@mui/x-charts/internals").DefaultedXAxis[] | undefined) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
88
+ resultFunc: (resultFuncArgs_0: import("@mui/x-charts/internals").DefaultedXAxis[] | undefined) => Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
89
+ memoizedResultFunc: ((resultFuncArgs_0: import("@mui/x-charts/internals").DefaultedXAxis[] | undefined) => Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
90
90
  clearCache: () => void;
91
91
  resultsCount: () => number;
92
92
  resetResultsCount: () => void;
93
93
  };
94
- lastResult: () => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
94
+ lastResult: () => Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
95
95
  dependencies: [((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
96
96
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
97
97
  }) => import("@mui/x-charts/internals").DefaultedXAxis[] | undefined) & {
@@ -133,18 +133,18 @@ export declare const selectorChartZoomIsEnabled: ((state: import("@mui/x-charts/
133
133
  argsMemoize: typeof import("reselect").weakMapMemoize;
134
134
  }, ((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
135
135
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
136
- }) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
136
+ }) => Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
137
137
  clearCache: () => void;
138
138
  resultsCount: () => number;
139
139
  resetResultsCount: () => void;
140
140
  } & {
141
- resultFunc: (resultFuncArgs_0: import("@mui/x-charts/internals").DefaultedYAxis[] | undefined) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
142
- memoizedResultFunc: ((resultFuncArgs_0: import("@mui/x-charts/internals").DefaultedYAxis[] | undefined) => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
141
+ resultFunc: (resultFuncArgs_0: import("@mui/x-charts/internals").DefaultedYAxis[] | undefined) => Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
142
+ memoizedResultFunc: ((resultFuncArgs_0: import("@mui/x-charts/internals").DefaultedYAxis[] | undefined) => Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>) & {
143
143
  clearCache: () => void;
144
144
  resultsCount: () => number;
145
145
  resetResultsCount: () => void;
146
146
  };
147
- lastResult: () => Record<import("@mui/x-charts/internals").AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
147
+ lastResult: () => Record<AxisId, import("@mui/x-charts/internals").DefaultizedZoomOptions>;
148
148
  dependencies: [((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
149
149
  cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
150
150
  }) => import("@mui/x-charts/internals").DefaultedYAxis[] | undefined) & {
@@ -200,4 +200,56 @@ export declare const selectorChartZoomIsEnabled: ((state: import("@mui/x-charts/
200
200
  } & {
201
201
  argsMemoize: typeof import("reselect").weakMapMemoize;
202
202
  memoize: typeof import("reselect").weakMapMemoize;
203
+ };
204
+ export declare const selectorChartAxisZoomData: ((state: any, axisId: AxisId) => import("@mui/x-charts/internals").ZoomData | undefined) & {
205
+ clearCache: () => void;
206
+ resultsCount: () => number;
207
+ resetResultsCount: () => void;
208
+ } & {
209
+ resultFunc: (resultFuncArgs_0: Map<AxisId, import("@mui/x-charts/internals").ZoomData> | undefined, resultFuncArgs_1: AxisId) => import("@mui/x-charts/internals").ZoomData | undefined;
210
+ memoizedResultFunc: ((resultFuncArgs_0: Map<AxisId, import("@mui/x-charts/internals").ZoomData> | undefined, resultFuncArgs_1: AxisId) => import("@mui/x-charts/internals").ZoomData | undefined) & {
211
+ clearCache: () => void;
212
+ resultsCount: () => number;
213
+ resetResultsCount: () => void;
214
+ };
215
+ lastResult: () => import("@mui/x-charts/internals").ZoomData | undefined;
216
+ dependencies: [((state: import("@mui/x-charts/internals/plugins/corePlugins/useChartId/useChartId.types").UseChartIdState & import("@mui/x-charts/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types").UseChartDimensionsState & import("@mui/x-charts/internals/plugins/corePlugins/useChartSeries/useChartSeries.types").UseChartSeriesState<keyof import("@mui/x-charts/internals").ChartsSeriesConfig> & import("@mui/x-charts/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types").UseChartAnimationState & Partial<import("@mui/x-charts/internals").UseChartCartesianAxisState> & {
217
+ cacheKey: import("@mui/x-charts/internals").ChartStateCacheKey;
218
+ }) => Map<AxisId, import("@mui/x-charts/internals").ZoomData> | undefined) & {
219
+ clearCache: () => void;
220
+ resultsCount: () => number;
221
+ resetResultsCount: () => void;
222
+ } & {
223
+ resultFunc: (resultFuncArgs_0: {
224
+ isInteracting: boolean;
225
+ zoomData: readonly import("@mui/x-charts/internals").ZoomData[];
226
+ } | undefined) => Map<AxisId, import("@mui/x-charts/internals").ZoomData> | undefined;
227
+ memoizedResultFunc: ((resultFuncArgs_0: {
228
+ isInteracting: boolean;
229
+ zoomData: readonly import("@mui/x-charts/internals").ZoomData[];
230
+ } | undefined) => Map<AxisId, import("@mui/x-charts/internals").ZoomData> | undefined) & {
231
+ clearCache: () => void;
232
+ resultsCount: () => number;
233
+ resetResultsCount: () => void;
234
+ };
235
+ lastResult: () => Map<AxisId, import("@mui/x-charts/internals").ZoomData> | undefined;
236
+ dependencies: [(state: import("@mui/x-charts/internals").ChartState<[], [import("@mui/x-charts/internals").UseChartCartesianAxisSignature]>) => {
237
+ isInteracting: boolean;
238
+ zoomData: readonly import("@mui/x-charts/internals").ZoomData[];
239
+ } | undefined];
240
+ recomputations: () => number;
241
+ resetRecomputations: () => void;
242
+ dependencyRecomputations: () => number;
243
+ resetDependencyRecomputations: () => void;
244
+ } & {
245
+ memoize: typeof import("reselect").weakMapMemoize;
246
+ argsMemoize: typeof import("reselect").weakMapMemoize;
247
+ }, (state: any, axisId: AxisId) => AxisId];
248
+ recomputations: () => number;
249
+ resetRecomputations: () => void;
250
+ dependencyRecomputations: () => number;
251
+ resetDependencyRecomputations: () => void;
252
+ } & {
253
+ argsMemoize: typeof import("reselect").weakMapMemoize;
254
+ memoize: typeof import("reselect").weakMapMemoize;
203
255
  };
@@ -3,9 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.selectorChartZoomState = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomIsEnabled = void 0;
6
+ exports.selectorChartZoomState = exports.selectorChartZoomIsInteracting = exports.selectorChartZoomIsEnabled = exports.selectorChartAxisZoomData = void 0;
7
7
  var _internals = require("@mui/x-charts/internals");
8
8
  const selectorChartZoomState = state => state.zoom;
9
9
  exports.selectorChartZoomState = selectorChartZoomState;
10
10
  const selectorChartZoomIsInteracting = exports.selectorChartZoomIsInteracting = (0, _internals.createSelector)(selectorChartZoomState, zoom => zoom.isInteracting);
11
- const selectorChartZoomIsEnabled = exports.selectorChartZoomIsEnabled = (0, _internals.createSelector)(_internals.selectorChartZoomOptionsLookup, optionsLookup => Object.keys(optionsLookup).length > 0);
11
+ const selectorChartZoomIsEnabled = exports.selectorChartZoomIsEnabled = (0, _internals.createSelector)(_internals.selectorChartZoomOptionsLookup, optionsLookup => Object.keys(optionsLookup).length > 0);
12
+ const selectorChartAxisZoomData = exports.selectorChartAxisZoomData = (0, _internals.createSelector)([_internals.selectorChartZoomMap, (state, axisId) => axisId], (zoomMap, axisId) => zoomMap?.get(axisId));
@@ -1,4 +1,4 @@
1
- import { UseChartSeriesSignature, ChartPluginSignature, UseChartCartesianAxisSignature, UseChartCartesianAxisDefaultizedParameters, ZoomData } from '@mui/x-charts/internals';
1
+ import { UseChartSeriesSignature, ChartPluginSignature, UseChartCartesianAxisSignature, UseChartCartesianAxisDefaultizedParameters, ZoomData, AxisId } from '@mui/x-charts/internals';
2
2
  export interface UseChartProZoomParameters {
3
3
  /**
4
4
  * The list of zoom data related to each axis.
@@ -42,7 +42,22 @@ export interface UseChartProZoomPublicApi {
42
42
  */
43
43
  setZoomData: (value: ZoomData[] | ((prev: ZoomData[]) => ZoomData[])) => void;
44
44
  }
45
- export interface UseChartProZoomInstance extends UseChartProZoomPublicApi {}
45
+ export interface UseChartProZoomInstance extends UseChartProZoomPublicApi {
46
+ /**
47
+ * Translate the zoom range (i.e., both start and end) for a specific axis.
48
+ * @param {AxisId} axisId The id of the axis to move the zoom range for.
49
+ * @param {number} by The amount to move the zoom range by. Ranges from 0 to 100.
50
+ */
51
+ moveZoomRange: (axisId: AxisId, by: number) => void;
52
+ /**
53
+ * Zoom in the chart.
54
+ */
55
+ zoomIn: () => void;
56
+ /**
57
+ * Zoom out the chart.
58
+ */
59
+ zoomOut: () => void;
60
+ }
46
61
  export type UseChartProZoomSignature = ChartPluginSignature<{
47
62
  params: UseChartProZoomParameters;
48
63
  defaultizedParams: UseChartProZoomDefaultizedParameters;
@@ -0,0 +1,10 @@
1
+ import type * as React from 'react';
2
+ import { ChartBaseCommonProps } from '@mui/x-charts/models';
3
+ export type ChartBaseTooltipProps = ChartBaseCommonProps & {
4
+ children: React.ReactElement<any, any>;
5
+ enterDelay?: number;
6
+ title: React.ReactNode;
7
+ };
8
+ export type ChartBaseIconButtonProps = ChartBaseCommonProps & {
9
+ ref?: React.Ref<HTMLButtonElement>;
10
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,6 @@
1
+ import { ChartsBaseSlots } from '@mui/x-charts/models';
2
+ import * as React from 'react';
3
+ import { ChartBaseTooltipProps } from "./chartBaseSlotProps.js";
4
+ export interface ChartsBaseSlotsPro extends ChartsBaseSlots {
5
+ baseTooltip: React.ComponentType<ChartBaseTooltipProps>;
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,14 @@
1
+ import * as React from 'react';
2
+ import { ChartBaseIconProps, ChartsIconSlots } from '@mui/x-charts/models';
3
+ export interface ChartsIconSlotsPro extends ChartsIconSlots {
4
+ /**
5
+ * Icon displayed on the toolbar's zoom in button.
6
+ * @default ChartsZoomInIcon
7
+ */
8
+ zoomInIcon: React.ComponentType<ChartBaseIconProps>;
9
+ /**
10
+ * Icon displayed on the toolbar's zoom out button.
11
+ * @default ChartsZoomOutIcon
12
+ */
13
+ zoomOutIcon: React.ComponentType<ChartBaseIconProps>;
14
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@mui/x-charts-pro",
3
- "version": "8.2.0",
4
- "description": "The Pro plan edition of the Charts components (MUI X).",
3
+ "version": "8.3.0",
5
4
  "author": "MUI Team",
5
+ "description": "The Pro plan edition of the MUI X Charts components.",
6
6
  "main": "./index.js",
7
7
  "license": "SEE LICENSE IN LICENSE",
8
8
  "bugs": {
@@ -29,14 +29,14 @@
29
29
  "directory": "packages/x-charts-pro"
30
30
  },
31
31
  "dependencies": {
32
- "@babel/runtime": "^7.27.0",
32
+ "@babel/runtime": "^7.27.1",
33
33
  "@mui/utils": "^7.0.2",
34
34
  "clsx": "^2.1.1",
35
35
  "prop-types": "^15.8.1",
36
- "@mui/x-charts": "8.2.0",
37
- "@mui/x-internals": "8.2.0",
38
- "@mui/x-charts-vendor": "8.0.0",
39
- "@mui/x-license": "8.2.0"
36
+ "@mui/x-internals": "8.3.0",
37
+ "@mui/x-license": "8.3.0",
38
+ "@mui/x-charts": "8.3.0",
39
+ "@mui/x-charts-vendor": "8.3.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.9.0",
@@ -1,7 +1,7 @@
1
1
  import { DefaultizedProps, MakeRequired } from '@mui/x-internals/types';
2
2
  import { AxisId, ZoomOptions } from '@mui/x-charts/internals';
3
- import { HeatmapItemIdentifier, HeatmapSeriesType, DefaultizedHeatmapSeriesType, HeatmapValueType } from "../models/seriesType/heatmap.js";
4
3
  import { DefaultizedFunnelSeriesType, FunnelItemIdentifier, FunnelSeriesType, FunnelValueType } from "../FunnelChart/funnel.types.js";
4
+ import { HeatmapItemIdentifier, HeatmapSeriesType, DefaultizedHeatmapSeriesType, HeatmapValueType } from "../models/seriesType/heatmap.js";
5
5
  declare module '@mui/x-charts/internals' {
6
6
  interface ChartsSeriesConfig {
7
7
  heatmap: {
@@ -1,25 +0,0 @@
1
- import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
- /**
3
- * This is a custom "step" curve generator for the funnel chart.
4
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
5
- *
6
- * It takes into account the gap between the points and draws a smooth curve between them.
7
- *
8
- * It is based on the d3-shape step curve generator.
9
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
10
- */
11
- export declare class FunnelStep implements CurveGenerator {
12
- private context;
13
- private line;
14
- private x;
15
- private y;
16
- private currentPoint;
17
- private isHorizontal;
18
- private gap;
19
- constructor(context: CanvasRenderingContext2D, isHorizontal: boolean, gap?: number);
20
- areaStart(): void;
21
- areaEnd(): void;
22
- lineStart(): void;
23
- lineEnd(): void;
24
- point(x: number, y: number): void;
25
- }
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FunnelStep = void 0;
7
- /**
8
- * This is a custom "step" curve generator for the funnel chart.
9
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
10
- *
11
- * It takes into account the gap between the points and draws a smooth curve between them.
12
- *
13
- * It is based on the d3-shape step curve generator.
14
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
15
- */
16
- class FunnelStep {
17
- constructor(context, isHorizontal, gap = 0) {
18
- this.context = void 0;
19
- this.line = NaN;
20
- this.x = NaN;
21
- this.y = NaN;
22
- this.currentPoint = 0;
23
- this.isHorizontal = false;
24
- this.gap = 0;
25
- this.context = context;
26
- this.isHorizontal = isHorizontal;
27
- this.gap = gap / 2;
28
- }
29
- areaStart() {
30
- this.line = 0;
31
- }
32
- areaEnd() {
33
- this.line = NaN;
34
- }
35
- lineStart() {
36
- this.x = NaN;
37
- this.y = NaN;
38
- this.currentPoint = 0;
39
- }
40
- lineEnd() {
41
- if (this.currentPoint === 2) {
42
- this.context.lineTo(this.x, this.y);
43
- }
44
- if (this.line || this.line !== 0 && this.currentPoint === 1) {
45
- this.context.closePath();
46
- }
47
- if (this.line >= 0) {
48
- this.line = 1 - this.line;
49
- }
50
- }
51
- point(x, y) {
52
- x = +x;
53
- y = +y;
54
-
55
- // 0 is the top-left corner.
56
- if (this.isHorizontal) {
57
- if (this.currentPoint === 0) {
58
- this.context.moveTo(x + this.gap, y);
59
- } else if (this.currentPoint === 1 || this.currentPoint === 2) {
60
- this.context.lineTo(x - this.gap, this.y);
61
- this.context.lineTo(x - this.gap, y);
62
- } else {
63
- this.context.lineTo(this.x - this.gap, y);
64
- this.context.lineTo(x + this.gap, y);
65
- }
66
- this.currentPoint += 1;
67
- this.x = x;
68
- this.y = y;
69
- return;
70
- }
71
-
72
- // 0 is the top-right corner.
73
- if (this.currentPoint === 0) {
74
- this.context.moveTo(x, y + this.gap);
75
- } else if (this.currentPoint === 3) {
76
- this.context.lineTo(x, this.y - this.gap);
77
- this.context.lineTo(x, y + this.gap);
78
- } else {
79
- this.context.lineTo(this.x, y - this.gap);
80
- this.context.lineTo(x, y - this.gap);
81
- }
82
- this.currentPoint += 1;
83
- this.x = x;
84
- this.y = y;
85
- }
86
- }
87
- exports.FunnelStep = FunnelStep;
@@ -1,25 +0,0 @@
1
- import { CurveGenerator } from '@mui/x-charts-vendor/d3-shape';
2
- /**
3
- * This is a custom "step" curve generator for the funnel chart.
4
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
5
- *
6
- * It takes into account the gap between the points and draws a smooth curve between them.
7
- *
8
- * It is based on the d3-shape step curve generator.
9
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
10
- */
11
- export declare class FunnelStep implements CurveGenerator {
12
- private context;
13
- private line;
14
- private x;
15
- private y;
16
- private currentPoint;
17
- private isHorizontal;
18
- private gap;
19
- constructor(context: CanvasRenderingContext2D, isHorizontal: boolean, gap?: number);
20
- areaStart(): void;
21
- areaEnd(): void;
22
- lineStart(): void;
23
- lineEnd(): void;
24
- point(x: number, y: number): void;
25
- }
@@ -1,80 +0,0 @@
1
- /**
2
- * This is a custom "step" curve generator for the funnel chart.
3
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
4
- *
5
- * It takes into account the gap between the points and draws a smooth curve between them.
6
- *
7
- * It is based on the d3-shape step curve generator.
8
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
9
- */
10
- export class FunnelStep {
11
- constructor(context, isHorizontal, gap = 0) {
12
- this.context = void 0;
13
- this.line = NaN;
14
- this.x = NaN;
15
- this.y = NaN;
16
- this.currentPoint = 0;
17
- this.isHorizontal = false;
18
- this.gap = 0;
19
- this.context = context;
20
- this.isHorizontal = isHorizontal;
21
- this.gap = gap / 2;
22
- }
23
- areaStart() {
24
- this.line = 0;
25
- }
26
- areaEnd() {
27
- this.line = NaN;
28
- }
29
- lineStart() {
30
- this.x = NaN;
31
- this.y = NaN;
32
- this.currentPoint = 0;
33
- }
34
- lineEnd() {
35
- if (this.currentPoint === 2) {
36
- this.context.lineTo(this.x, this.y);
37
- }
38
- if (this.line || this.line !== 0 && this.currentPoint === 1) {
39
- this.context.closePath();
40
- }
41
- if (this.line >= 0) {
42
- this.line = 1 - this.line;
43
- }
44
- }
45
- point(x, y) {
46
- x = +x;
47
- y = +y;
48
-
49
- // 0 is the top-left corner.
50
- if (this.isHorizontal) {
51
- if (this.currentPoint === 0) {
52
- this.context.moveTo(x + this.gap, y);
53
- } else if (this.currentPoint === 1 || this.currentPoint === 2) {
54
- this.context.lineTo(x - this.gap, this.y);
55
- this.context.lineTo(x - this.gap, y);
56
- } else {
57
- this.context.lineTo(this.x - this.gap, y);
58
- this.context.lineTo(x + this.gap, y);
59
- }
60
- this.currentPoint += 1;
61
- this.x = x;
62
- this.y = y;
63
- return;
64
- }
65
-
66
- // 0 is the top-right corner.
67
- if (this.currentPoint === 0) {
68
- this.context.moveTo(x, y + this.gap);
69
- } else if (this.currentPoint === 3) {
70
- this.context.lineTo(x, this.y - this.gap);
71
- this.context.lineTo(x, y + this.gap);
72
- } else {
73
- this.context.lineTo(this.x, y - this.gap);
74
- this.context.lineTo(x, y - this.gap);
75
- }
76
- this.currentPoint += 1;
77
- this.x = x;
78
- this.y = y;
79
- }
80
- }