@mui/x-charts 7.3.0 → 7.3.2

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 (246) hide show
  1. package/BarChart/BarChart.d.ts +5 -3
  2. package/BarChart/BarChart.js +23 -102
  3. package/BarChart/BarElement.d.ts +63 -62
  4. package/BarChart/BarElement.js +1 -2
  5. package/BarChart/BarPlot.js +9 -9
  6. package/CHANGELOG.md +155 -7
  7. package/ChartContainer/ChartContainer.js +3 -1
  8. package/ChartsAxis/ChartsAxis.js +7 -99
  9. package/ChartsAxis/axisClasses.d.ts +1 -1
  10. package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
  11. package/ChartsClipPath/ChartsClipPath.js +1 -1
  12. package/ChartsGrid/ChartsGrid.js +1 -1
  13. package/ChartsLegend/ChartsLegend.js +1 -1
  14. package/ChartsLegend/DefaultChartsLegend.js +1 -1
  15. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  16. package/ChartsOverlay/ChartsLoadingOverlay.d.ts +3 -0
  17. package/ChartsOverlay/ChartsLoadingOverlay.js +43 -0
  18. package/ChartsOverlay/ChartsNoDataOverlay.d.ts +3 -0
  19. package/ChartsOverlay/ChartsNoDataOverlay.js +43 -0
  20. package/ChartsOverlay/ChartsOverlay.d.ts +35 -0
  21. package/ChartsOverlay/ChartsOverlay.js +41 -0
  22. package/ChartsOverlay/index.d.ts +3 -0
  23. package/ChartsOverlay/index.js +26 -0
  24. package/ChartsOverlay/package.json +6 -0
  25. package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  26. package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
  27. package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
  28. package/ChartsReferenceLine/common.d.ts +1 -1
  29. package/ChartsSurface.js +1 -1
  30. package/ChartsText/ChartsText.js +1 -1
  31. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
  32. package/ChartsTooltip/ChartsAxisTooltipContent.js +18 -5
  33. package/ChartsTooltip/ChartsItemTooltipContent.js +20 -4
  34. package/ChartsTooltip/ChartsTooltip.d.ts +2 -2
  35. package/ChartsTooltip/ChartsTooltip.js +3 -3
  36. package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -7
  37. package/ChartsTooltip/ChartsTooltipTable.js +8 -9
  38. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -6
  39. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -4
  40. package/ChartsTooltip/utils.js +1 -1
  41. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -1
  42. package/ChartsXAxis/ChartsXAxis.d.ts +1 -1
  43. package/ChartsXAxis/ChartsXAxis.js +8 -1
  44. package/ChartsYAxis/ChartsYAxis.d.ts +1 -1
  45. package/ChartsYAxis/ChartsYAxis.js +8 -1
  46. package/Gauge/Gauge.js +2 -2
  47. package/Gauge/GaugeContainer.js +2 -2
  48. package/Gauge/GaugeProvider.d.ts +2 -2
  49. package/Gauge/GaugeProvider.js +2 -2
  50. package/Gauge/GaugeReferenceArc.js +1 -1
  51. package/Gauge/GaugeValueArc.js +1 -1
  52. package/Gauge/GaugeValueText.js +1 -1
  53. package/Gauge/gaugeClasses.d.ts +2 -2
  54. package/Gauge/utils.d.ts +1 -1
  55. package/Gauge/utils.js +4 -4
  56. package/LineChart/AnimatedArea.d.ts +63 -62
  57. package/LineChart/AnimatedArea.js +1 -1
  58. package/LineChart/AnimatedLine.d.ts +63 -62
  59. package/LineChart/AnimatedLine.js +1 -1
  60. package/LineChart/AreaElement.d.ts +1 -1
  61. package/LineChart/AreaElement.js +1 -1
  62. package/LineChart/AreaPlot.js +1 -1
  63. package/LineChart/LineChart.d.ts +5 -3
  64. package/LineChart/LineChart.js +20 -99
  65. package/LineChart/LineElement.d.ts +1 -1
  66. package/LineChart/LineElement.js +1 -1
  67. package/LineChart/LineHighlightElement.js +1 -1
  68. package/LineChart/LineHighlightPlot.js +1 -1
  69. package/LineChart/LinePlot.js +1 -1
  70. package/LineChart/MarkElement.d.ts +1 -1
  71. package/LineChart/MarkElement.js +1 -1
  72. package/LineChart/MarkPlot.js +1 -1
  73. package/PieChart/PieArc.d.ts +2 -1
  74. package/PieChart/PieArc.js +1 -1
  75. package/PieChart/PieArcLabel.d.ts +2 -1
  76. package/PieChart/PieArcLabel.js +2 -2
  77. package/PieChart/PieArcLabelPlot.d.ts +1 -1
  78. package/PieChart/PieArcLabelPlot.js +4 -4
  79. package/PieChart/PieArcPlot.d.ts +1 -1
  80. package/PieChart/PieArcPlot.js +4 -4
  81. package/PieChart/PieChart.d.ts +5 -3
  82. package/PieChart/PieChart.js +23 -99
  83. package/PieChart/PiePlot.js +1 -1
  84. package/PieChart/dataTransform/transition.d.ts +1 -0
  85. package/PieChart/dataTransform/useTransformData.js +1 -1
  86. package/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -1
  87. package/ResponsiveChartContainer/useChartContainerDimensions.js +1 -1
  88. package/ScatterChart/Scatter.js +1 -1
  89. package/ScatterChart/ScatterChart.d.ts +6 -3
  90. package/ScatterChart/ScatterChart.js +74 -125
  91. package/ScatterChart/ScatterPlot.js +9 -2
  92. package/ScatterChart/getColor.d.ts +2 -1
  93. package/ScatterChart/getColor.js +18 -1
  94. package/SparkLineChart/SparkLineChart.js +1 -1
  95. package/context/CartesianContextProvider.d.ts +2 -1
  96. package/context/CartesianContextProvider.js +1 -1
  97. package/context/DrawingProvider.js +1 -1
  98. package/context/HighlightProvider.js +1 -1
  99. package/context/InteractionProvider.js +1 -1
  100. package/context/SeriesContextProvider.js +2 -2
  101. package/context/ZAxisContextProvider.d.ts +33 -0
  102. package/context/ZAxisContextProvider.js +98 -0
  103. package/context/index.d.ts +2 -0
  104. package/context/index.js +8 -1
  105. package/esm/BarChart/BarChart.js +23 -103
  106. package/esm/BarChart/BarElement.js +0 -1
  107. package/esm/BarChart/BarPlot.js +8 -8
  108. package/esm/ChartContainer/ChartContainer.js +3 -2
  109. package/esm/ChartsAxis/ChartsAxis.js +7 -100
  110. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
  111. package/esm/ChartsGrid/ChartsGrid.js +1 -2
  112. package/esm/ChartsLegend/DefaultChartsLegend.js +1 -2
  113. package/esm/ChartsOverlay/ChartsLoadingOverlay.js +34 -0
  114. package/esm/ChartsOverlay/ChartsNoDataOverlay.js +34 -0
  115. package/esm/ChartsOverlay/ChartsOverlay.js +31 -0
  116. package/esm/ChartsOverlay/index.js +3 -0
  117. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  118. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
  119. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
  120. package/esm/ChartsSurface.js +1 -2
  121. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +17 -4
  122. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +19 -3
  123. package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
  124. package/esm/ChartsTooltip/ChartsTooltipTable.js +8 -8
  125. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -7
  126. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -5
  127. package/esm/ChartsXAxis/ChartsXAxis.js +8 -2
  128. package/esm/ChartsYAxis/ChartsYAxis.js +8 -2
  129. package/esm/Gauge/Gauge.js +2 -3
  130. package/esm/Gauge/GaugeContainer.js +1 -1
  131. package/esm/Gauge/GaugeProvider.js +1 -1
  132. package/esm/Gauge/utils.js +4 -4
  133. package/esm/LineChart/AnimatedArea.js +1 -2
  134. package/esm/LineChart/AnimatedLine.js +1 -2
  135. package/esm/LineChart/LineChart.js +20 -100
  136. package/esm/PieChart/PieArcLabel.js +1 -1
  137. package/esm/PieChart/PieArcLabelPlot.js +3 -3
  138. package/esm/PieChart/PieArcPlot.js +3 -3
  139. package/esm/PieChart/PieChart.js +23 -100
  140. package/esm/PieChart/PiePlot.js +1 -2
  141. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
  142. package/esm/ScatterChart/ScatterChart.js +74 -126
  143. package/esm/ScatterChart/ScatterPlot.js +8 -1
  144. package/esm/ScatterChart/getColor.js +18 -1
  145. package/esm/SparkLineChart/SparkLineChart.js +1 -2
  146. package/esm/context/SeriesContextProvider.js +1 -1
  147. package/esm/context/ZAxisContextProvider.js +89 -0
  148. package/esm/context/index.js +1 -1
  149. package/esm/hooks/useReducedMotion.js +1 -1
  150. package/esm/hooks/useScale.js +1 -1
  151. package/esm/hooks/useTicks.js +4 -0
  152. package/esm/internals/colorGetter.js +2 -2
  153. package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +6 -7
  154. package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
  155. package/esm/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +4 -5
  156. package/esm/internals/utils.js +1 -1
  157. package/esm/models/z-axis.js +1 -0
  158. package/hooks/useAxisEvents.js +1 -1
  159. package/hooks/useChartDimensions.js +1 -1
  160. package/hooks/useChartId.js +1 -1
  161. package/hooks/useDrawingArea.js +1 -1
  162. package/hooks/useInteractionItemProps.js +1 -1
  163. package/hooks/useMounted.js +1 -1
  164. package/hooks/useReducedMotion.d.ts +1 -1
  165. package/hooks/useReducedMotion.js +1 -1
  166. package/hooks/useScale.d.ts +4 -4
  167. package/hooks/useScale.js +2 -2
  168. package/hooks/useSeries.js +1 -1
  169. package/hooks/useSvgRef.js +1 -1
  170. package/hooks/useTicks.js +5 -1
  171. package/index.js +1 -1
  172. package/internals/colorGetter.d.ts +3 -1
  173. package/internals/colorGetter.js +2 -2
  174. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +6 -6
  175. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.d.ts +1 -1
  176. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +4 -4
  177. package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.d.ts +1 -1
  178. package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +4 -4
  179. package/internals/defaultizeColor.d.ts +1 -0
  180. package/internals/useAnimatedPath.d.ts +1 -0
  181. package/internals/useAnimatedPath.js +1 -1
  182. package/internals/utils.d.ts +1 -1
  183. package/internals/utils.js +1 -1
  184. package/models/axis.d.ts +1 -1
  185. package/models/colorMapping.d.ts +3 -2
  186. package/models/seriesType/bar.d.ts +1 -1
  187. package/models/seriesType/line.d.ts +1 -1
  188. package/models/seriesType/pie.d.ts +9 -4
  189. package/models/seriesType/scatter.d.ts +5 -0
  190. package/models/z-axis.d.ts +14 -0
  191. package/models/z-axis.js +5 -0
  192. package/modern/BarChart/BarChart.js +23 -103
  193. package/modern/BarChart/BarElement.js +0 -1
  194. package/modern/BarChart/BarPlot.js +8 -8
  195. package/modern/ChartContainer/ChartContainer.js +3 -2
  196. package/modern/ChartsAxis/ChartsAxis.js +7 -100
  197. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -2
  198. package/modern/ChartsGrid/ChartsGrid.js +1 -2
  199. package/modern/ChartsLegend/DefaultChartsLegend.js +1 -2
  200. package/modern/ChartsOverlay/ChartsLoadingOverlay.js +34 -0
  201. package/modern/ChartsOverlay/ChartsNoDataOverlay.js +34 -0
  202. package/modern/ChartsOverlay/ChartsOverlay.js +31 -0
  203. package/modern/ChartsOverlay/index.js +3 -0
  204. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  205. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -2
  206. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -2
  207. package/modern/ChartsSurface.js +1 -2
  208. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +17 -4
  209. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +19 -3
  210. package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
  211. package/modern/ChartsTooltip/ChartsTooltipTable.js +8 -8
  212. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +3 -7
  213. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -5
  214. package/modern/ChartsXAxis/ChartsXAxis.js +8 -2
  215. package/modern/ChartsYAxis/ChartsYAxis.js +8 -2
  216. package/modern/Gauge/Gauge.js +2 -3
  217. package/modern/Gauge/GaugeContainer.js +1 -1
  218. package/modern/Gauge/GaugeProvider.js +1 -1
  219. package/modern/Gauge/utils.js +4 -4
  220. package/modern/LineChart/AnimatedArea.js +1 -2
  221. package/modern/LineChart/AnimatedLine.js +1 -2
  222. package/modern/LineChart/LineChart.js +20 -100
  223. package/modern/PieChart/PieArcLabel.js +1 -1
  224. package/modern/PieChart/PieArcLabelPlot.js +3 -3
  225. package/modern/PieChart/PieArcPlot.js +3 -3
  226. package/modern/PieChart/PieChart.js +23 -100
  227. package/modern/PieChart/PiePlot.js +1 -2
  228. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
  229. package/modern/ScatterChart/ScatterChart.js +74 -126
  230. package/modern/ScatterChart/ScatterPlot.js +8 -1
  231. package/modern/ScatterChart/getColor.js +18 -1
  232. package/modern/SparkLineChart/SparkLineChart.js +1 -2
  233. package/modern/context/SeriesContextProvider.js +1 -1
  234. package/modern/context/ZAxisContextProvider.js +89 -0
  235. package/modern/context/index.js +1 -1
  236. package/modern/hooks/useReducedMotion.js +1 -1
  237. package/modern/hooks/useScale.js +1 -1
  238. package/modern/hooks/useTicks.js +4 -0
  239. package/modern/index.js +1 -1
  240. package/modern/internals/colorGetter.js +2 -2
  241. package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +6 -7
  242. package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
  243. package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +4 -5
  244. package/modern/internals/utils.js +1 -1
  245. package/modern/models/z-axis.js +1 -0
  246. package/package.json +3 -5
@@ -0,0 +1,89 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { getColorScale, getOrdinalColorScale } from '../internals/colorScale';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export const ZAxisContext = /*#__PURE__*/React.createContext({
7
+ zAxis: {},
8
+ zAxisIds: []
9
+ });
10
+ if (process.env.NODE_ENV !== 'production') {
11
+ ZAxisContext.displayName = 'ZAxisContext';
12
+ }
13
+ function ZAxisContextProvider(props) {
14
+ const {
15
+ zAxis: inZAxis,
16
+ dataset,
17
+ children
18
+ } = props;
19
+ const zAxis = React.useMemo(() => inZAxis?.map(axisConfig => {
20
+ const dataKey = axisConfig.dataKey;
21
+ if (dataKey === undefined || axisConfig.data !== undefined) {
22
+ return axisConfig;
23
+ }
24
+ if (dataset === undefined) {
25
+ throw Error('MUI X Charts: z-axis uses `dataKey` but no `dataset` is provided.');
26
+ }
27
+ return _extends({}, axisConfig, {
28
+ data: dataset.map(d => d[dataKey])
29
+ });
30
+ }), [inZAxis, dataset]);
31
+ const value = React.useMemo(() => {
32
+ const allZAxis = zAxis?.map((axis, index) => _extends({
33
+ id: `defaultized-z-axis-${index}`
34
+ }, axis)) ?? [];
35
+ const completedZAxis = {};
36
+ allZAxis.forEach(axis => {
37
+ completedZAxis[axis.id] = _extends({}, axis, {
38
+ colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' && axis.data ? getOrdinalColorScale(_extends({
39
+ values: axis.data
40
+ }, axis.colorMap)) : getColorScale(axis.colorMap))
41
+ });
42
+ });
43
+ return {
44
+ zAxis: completedZAxis,
45
+ zAxisIds: allZAxis.map(({
46
+ id
47
+ }) => id)
48
+ };
49
+ }, [zAxis]);
50
+ return /*#__PURE__*/_jsx(ZAxisContext.Provider, {
51
+ value: value,
52
+ children: children
53
+ });
54
+ }
55
+ process.env.NODE_ENV !== "production" ? ZAxisContextProvider.propTypes = {
56
+ // ----------------------------- Warning --------------------------------
57
+ // | These PropTypes are generated from the TypeScript type definitions |
58
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
59
+ // ----------------------------------------------------------------------
60
+ children: PropTypes.node,
61
+ /**
62
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
63
+ */
64
+ dataset: PropTypes.arrayOf(PropTypes.object),
65
+ /**
66
+ * The configuration of the z-axes.
67
+ */
68
+ zAxis: PropTypes.arrayOf(PropTypes.shape({
69
+ colorMap: PropTypes.oneOfType([PropTypes.shape({
70
+ color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
71
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
72
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
73
+ type: PropTypes.oneOf(['continuous']).isRequired
74
+ }), PropTypes.shape({
75
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
76
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
77
+ type: PropTypes.oneOf(['piecewise']).isRequired
78
+ }), PropTypes.shape({
79
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
80
+ type: PropTypes.oneOf(['ordinal']).isRequired,
81
+ unknownColor: PropTypes.string,
82
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
83
+ })]),
84
+ data: PropTypes.array,
85
+ dataKey: PropTypes.string,
86
+ id: PropTypes.string
87
+ }))
88
+ } : void 0;
89
+ export { ZAxisContextProvider };
@@ -1 +1 @@
1
- export {};
1
+ export { ZAxisContextProvider } from './ZAxisContextProvider';
@@ -5,7 +5,7 @@ import { useIsomorphicLayoutEffect, Globals } from '@react-spring/web';
5
5
  * set skipAnimations to the value of the user's
6
6
  * `prefers-reduced-motion` query.
7
7
  *
8
- * The return value, post-effect, is the value of their prefered setting
8
+ * The return value, post-effect, is the value of their preferred setting
9
9
  */
10
10
  export const useReducedMotion = () => {
11
11
  // Taken from: https://github.com/pmndrs/react-spring/blob/02ec877bbfab0df46da0e4a47d5f68d3e731206a/packages/shared/src/hooks/useReducedMotion.ts#L13
@@ -3,7 +3,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
3
3
  import { isBandScale } from '../internals/isBandScale';
4
4
  /**
5
5
  * For a given scale return a function that map value to their position.
6
- * Usefull when dealing with specific scale such as band.
6
+ * Useful when dealing with specific scale such as band.
7
7
  * @param scale The scale to use
8
8
  * @returns (value: any) => number
9
9
  */
@@ -59,6 +59,10 @@ export function useTicks(options) {
59
59
  labelOffset: 0
60
60
  }));
61
61
  }
62
+ if (scale.domain().length === 0 || scale.domain()[0] === scale.domain()[1]) {
63
+ // The axis should not be visible, so ticks should also be hidden.
64
+ return [];
65
+ }
62
66
  const ticks = typeof tickInterval === 'object' ? tickInterval : scale.ticks(tickNumber);
63
67
  return ticks.map(value => ({
64
68
  value,
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.3.0
2
+ * @mui/x-charts v7.3.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -2,7 +2,7 @@ import getBarColor from '../BarChart/getColor';
2
2
  import getLineColor from '../LineChart/getColor';
3
3
  import getScatterColor from '../ScatterChart/getColor';
4
4
  import getPieColor from '../PieChart/getColor';
5
- function getColor(series, xAxis, yAxis) {
5
+ function getColor(series, xAxis, yAxis, zAxis) {
6
6
  if (xAxis !== undefined && yAxis !== undefined) {
7
7
  if (series.type === 'bar') {
8
8
  return getBarColor(series, xAxis, yAxis);
@@ -11,7 +11,7 @@ function getColor(series, xAxis, yAxis) {
11
11
  return getLineColor(series, xAxis, yAxis);
12
12
  }
13
13
  if (series.type === 'scatter') {
14
- return getScatterColor(series, xAxis, yAxis);
14
+ return getScatterColor(series, xAxis, yAxis, zAxis);
15
15
  }
16
16
  }
17
17
  if (series.type === 'pie') {
@@ -4,13 +4,12 @@ import { DrawingContext } from '../../../context/DrawingProvider';
4
4
  import { useDrawingArea } from '../../../hooks';
5
5
  import ChartsPiecewiseGradient from './ChartsPiecewiseGradient';
6
6
  import ChartsContinuousGradient from './ChartsContinuousGradient';
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- import { jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
8
  export function useChartGradient() {
10
9
  const {
11
10
  chartId
12
11
  } = React.useContext(DrawingContext);
13
- return React.useCallback((axisId, direction) => `${chartId}-graient-${direction}-${axisId}`, [chartId]);
12
+ return React.useCallback((axisId, direction) => `${chartId}-gradient-${direction}-${axisId}`, [chartId]);
14
13
  }
15
14
  export function ChartsAxesGradients() {
16
15
  const {
@@ -41,7 +40,7 @@ export function ChartsAxesGradients() {
41
40
  } = yAxis[axisId];
42
41
  if (colorMap?.type === 'piecewise') {
43
42
  return /*#__PURE__*/_jsx(ChartsPiecewiseGradient, {
44
- isReveresed: !reverse,
43
+ isReversed: !reverse,
45
44
  scale: scale,
46
45
  colorMap: colorMap,
47
46
  size: svgHeight,
@@ -51,7 +50,7 @@ export function ChartsAxesGradients() {
51
50
  }
52
51
  if (colorMap?.type === 'continuous') {
53
52
  return /*#__PURE__*/_jsx(ChartsContinuousGradient, {
54
- isReveresed: !reverse,
53
+ isReversed: !reverse,
55
54
  scale: scale,
56
55
  colorScale: colorScale,
57
56
  colorMap: colorMap,
@@ -71,7 +70,7 @@ export function ChartsAxesGradients() {
71
70
  } = xAxis[axisId];
72
71
  if (colorMap?.type === 'piecewise') {
73
72
  return /*#__PURE__*/_jsx(ChartsPiecewiseGradient, {
74
- isReveresed: reverse,
73
+ isReversed: reverse,
75
74
  scale: scale,
76
75
  colorMap: colorMap,
77
76
  size: svgWidth,
@@ -81,7 +80,7 @@ export function ChartsAxesGradients() {
81
80
  }
82
81
  if (colorMap?.type === 'continuous') {
83
82
  return /*#__PURE__*/_jsx(ChartsContinuousGradient, {
84
- isReveresed: reverse,
83
+ isReversed: reverse,
85
84
  scale: scale,
86
85
  colorScale: colorScale,
87
86
  colorMap: colorMap,
@@ -4,7 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  const PX_PRECISION = 10;
5
5
  export default function ChartsContinuousGradient(props) {
6
6
  const {
7
- isReveresed,
7
+ isReversed,
8
8
  gradientId,
9
9
  size,
10
10
  direction,
@@ -26,7 +26,7 @@ export default function ChartsContinuousGradient(props) {
26
26
  x2: "0",
27
27
  y1: "0",
28
28
  y2: "0",
29
- [`${direction}${isReveresed ? 1 : 2}`]: `${size}px`,
29
+ [`${direction}${isReversed ? 1 : 2}`]: `${size}px`,
30
30
  gradientUnits: "userSpaceOnUse" // Use the SVG coordinate instead of the component ones.
31
31
  ,
32
32
  children: Array.from({
@@ -40,7 +40,7 @@ export default function ChartsContinuousGradient(props) {
40
40
  if (x === undefined) {
41
41
  return null;
42
42
  }
43
- const offset = isReveresed ? 1 - x / size : x / size;
43
+ const offset = isReversed ? 1 - x / size : x / size;
44
44
  const color = colorScale(value);
45
45
  if (color === null) {
46
46
  return null;
@@ -1,9 +1,8 @@
1
1
  import * as React from 'react';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
3
  export default function ChartsPiecewiseGradient(props) {
5
4
  const {
6
- isReveresed,
5
+ isReversed,
7
6
  gradientId,
8
7
  size,
9
8
  direction,
@@ -16,7 +15,7 @@ export default function ChartsPiecewiseGradient(props) {
16
15
  x2: "0",
17
16
  y1: "0",
18
17
  y2: "0",
19
- [`${direction}${isReveresed ? 1 : 2}`]: `${size}px`,
18
+ [`${direction}${isReversed ? 1 : 2}`]: `${size}px`,
20
19
  gradientUnits: "userSpaceOnUse" // Use the SVG coordinate instead of the component ones.
21
20
  ,
22
21
  children: colorMap.thresholds.map((threshold, index) => {
@@ -24,7 +23,7 @@ export default function ChartsPiecewiseGradient(props) {
24
23
  if (x === undefined) {
25
24
  return null;
26
25
  }
27
- const offset = isReveresed ? 1 - x / size : x / size;
26
+ const offset = isReversed ? 1 - x / size : x / size;
28
27
  return /*#__PURE__*/_jsxs(React.Fragment, {
29
28
  children: [/*#__PURE__*/_jsx("stop", {
30
29
  offset: offset,
@@ -4,7 +4,7 @@ export function getSymbol(shape) {
4
4
  return symbolNames.indexOf(shape) || 0;
5
5
  }
6
6
  /**
7
- * Transform mouse event position to corrdinates inside the SVG.
7
+ * Transform mouse event position to coordinates inside the SVG.
8
8
  * @param svg The SVG element
9
9
  * @param event The mouseEvent to transform
10
10
  */
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "7.3.0",
3
+ "version": "7.3.2",
4
4
  "description": "The community edition of the Charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -11,7 +11,8 @@
11
11
  "homepage": "https://mui.com/x/react-charts/",
12
12
  "sideEffects": false,
13
13
  "publishConfig": {
14
- "access": "public"
14
+ "access": "public",
15
+ "directory": "build"
15
16
  },
16
17
  "keywords": [
17
18
  "react",
@@ -69,9 +70,6 @@
69
70
  "default": "./esm/*/index.js"
70
71
  }
71
72
  },
72
- "setupFiles": [
73
- "<rootDir>/src/setupTests.js"
74
- ],
75
73
  "engines": {
76
74
  "node": ">=14.0.0"
77
75
  },