@mui/x-charts 7.0.0-beta.2 → 7.0.0-beta.4

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 (265) hide show
  1. package/BarChart/BarChart.d.ts +21 -5
  2. package/BarChart/BarChart.js +27 -7
  3. package/CHANGELOG.md +298 -23
  4. package/ChartsGrid/ChartsGrid.d.ts +30 -0
  5. package/ChartsGrid/ChartsGrid.js +128 -0
  6. package/ChartsGrid/chartsGridClasses.d.ts +13 -0
  7. package/ChartsGrid/chartsGridClasses.js +14 -0
  8. package/ChartsGrid/index.d.ts +2 -0
  9. package/ChartsGrid/index.js +27 -0
  10. package/ChartsGrid/package.json +6 -0
  11. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  12. package/ChartsSurface.js +6 -4
  13. package/ChartsTooltip/utils.js +1 -1
  14. package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
  15. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
  16. package/ChartsXAxis/ChartsXAxis.js +3 -3
  17. package/ChartsYAxis/ChartsYAxis.js +3 -3
  18. package/Gauge/Gauge.d.ts +13 -0
  19. package/Gauge/Gauge.js +154 -0
  20. package/Gauge/GaugeContainer.d.ts +17 -0
  21. package/Gauge/GaugeContainer.js +214 -0
  22. package/Gauge/GaugeProvider.d.ts +117 -0
  23. package/Gauge/GaugeProvider.js +99 -0
  24. package/Gauge/GaugeReferenceArc.d.ts +2 -0
  25. package/Gauge/GaugeReferenceArc.js +44 -0
  26. package/Gauge/GaugeValueArc.d.ts +2 -0
  27. package/Gauge/GaugeValueArc.js +51 -0
  28. package/Gauge/GaugeValueText.d.ts +15 -0
  29. package/Gauge/GaugeValueText.js +77 -0
  30. package/Gauge/gaugeClasses.d.ts +14 -0
  31. package/Gauge/gaugeClasses.js +15 -0
  32. package/Gauge/index.d.ts +7 -0
  33. package/Gauge/index.js +87 -0
  34. package/Gauge/package.json +6 -0
  35. package/Gauge/utils.d.ts +19 -0
  36. package/Gauge/utils.js +75 -0
  37. package/LineChart/LineChart.d.ts +24 -5
  38. package/LineChart/LineChart.js +31 -7
  39. package/PieChart/PieArc.d.ts +4 -4
  40. package/PieChart/PieArc.js +9 -9
  41. package/PieChart/PieArcLabelPlot.js +13 -13
  42. package/PieChart/PieChart.d.ts +22 -0
  43. package/PieChart/PieChart.js +22 -2
  44. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
  45. package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  46. package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
  47. package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
  48. package/ScatterChart/ScatterChart.d.ts +18 -0
  49. package/ScatterChart/ScatterChart.js +25 -3
  50. package/SparkLineChart/SparkLineChart.js +0 -2
  51. package/context/CartesianContextProvider.d.ts +0 -8
  52. package/context/CartesianContextProvider.js +4 -89
  53. package/context/DrawingProvider.d.ts +2 -11
  54. package/context/DrawingProvider.js +10 -35
  55. package/context/HighlightProvider.js +3 -0
  56. package/context/InteractionProvider.js +3 -0
  57. package/context/SeriesContextProvider.js +3 -0
  58. package/context/index.d.ts +0 -2
  59. package/context/index.js +1 -15
  60. package/esm/BarChart/BarChart.js +27 -7
  61. package/esm/ChartsGrid/ChartsGrid.js +121 -0
  62. package/esm/ChartsGrid/chartsGridClasses.js +6 -0
  63. package/esm/ChartsGrid/index.js +2 -0
  64. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  65. package/esm/ChartsSurface.js +6 -4
  66. package/esm/ChartsTooltip/utils.js +2 -2
  67. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  68. package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
  69. package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
  70. package/esm/Gauge/Gauge.js +147 -0
  71. package/esm/Gauge/GaugeContainer.js +209 -0
  72. package/esm/Gauge/GaugeProvider.js +88 -0
  73. package/esm/Gauge/GaugeReferenceArc.js +35 -0
  74. package/esm/Gauge/GaugeValueArc.js +42 -0
  75. package/esm/Gauge/GaugeValueText.js +69 -0
  76. package/esm/Gauge/gaugeClasses.js +7 -0
  77. package/esm/Gauge/index.js +7 -0
  78. package/esm/Gauge/utils.js +68 -0
  79. package/esm/LineChart/LineChart.js +31 -7
  80. package/esm/PieChart/PieArc.js +9 -9
  81. package/esm/PieChart/PieArcLabelPlot.js +13 -13
  82. package/esm/PieChart/PieChart.js +22 -2
  83. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  84. package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  85. package/esm/ScatterChart/ScatterChart.js +25 -3
  86. package/esm/SparkLineChart/SparkLineChart.js +0 -2
  87. package/esm/context/CartesianContextProvider.js +3 -88
  88. package/esm/context/DrawingProvider.js +10 -36
  89. package/esm/context/HighlightProvider.js +3 -0
  90. package/esm/context/InteractionProvider.js +3 -0
  91. package/esm/context/SeriesContextProvider.js +3 -0
  92. package/esm/context/index.js +1 -2
  93. package/esm/hooks/useAxisEvents.js +2 -2
  94. package/esm/hooks/useTicks.js +2 -3
  95. package/esm/index.js +2 -0
  96. package/hooks/useAxisEvents.js +1 -1
  97. package/hooks/useTicks.d.ts +2 -3
  98. package/hooks/useTicks.js +2 -3
  99. package/index.d.ts +2 -0
  100. package/index.js +23 -1
  101. package/modern/BarChart/BarChart.js +27 -7
  102. package/modern/ChartsGrid/ChartsGrid.js +121 -0
  103. package/modern/ChartsGrid/chartsGridClasses.js +6 -0
  104. package/modern/ChartsGrid/index.js +2 -0
  105. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  106. package/modern/ChartsSurface.js +6 -4
  107. package/modern/ChartsTooltip/utils.js +2 -2
  108. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  109. package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
  110. package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
  111. package/modern/Gauge/Gauge.js +147 -0
  112. package/modern/Gauge/GaugeContainer.js +206 -0
  113. package/modern/Gauge/GaugeProvider.js +88 -0
  114. package/modern/Gauge/GaugeReferenceArc.js +35 -0
  115. package/modern/Gauge/GaugeValueArc.js +42 -0
  116. package/modern/Gauge/GaugeValueText.js +69 -0
  117. package/modern/Gauge/gaugeClasses.js +7 -0
  118. package/modern/Gauge/index.js +7 -0
  119. package/modern/Gauge/utils.js +68 -0
  120. package/modern/LineChart/LineChart.js +31 -7
  121. package/modern/PieChart/PieArc.js +9 -9
  122. package/modern/PieChart/PieArcLabelPlot.js +13 -13
  123. package/modern/PieChart/PieChart.js +22 -2
  124. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  125. package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  126. package/modern/ScatterChart/ScatterChart.js +25 -3
  127. package/modern/SparkLineChart/SparkLineChart.js +0 -2
  128. package/modern/context/CartesianContextProvider.js +3 -88
  129. package/modern/context/DrawingProvider.js +10 -36
  130. package/modern/context/HighlightProvider.js +3 -0
  131. package/modern/context/InteractionProvider.js +3 -0
  132. package/modern/context/SeriesContextProvider.js +3 -0
  133. package/modern/context/index.js +1 -2
  134. package/modern/hooks/useAxisEvents.js +2 -2
  135. package/modern/hooks/useTicks.js +2 -3
  136. package/modern/index.js +3 -1
  137. package/package.json +4 -4
  138. package/legacy/BarChart/BarChart.js +0 -418
  139. package/legacy/BarChart/BarElement.js +0 -119
  140. package/legacy/BarChart/BarPlot.js +0 -232
  141. package/legacy/BarChart/extremums.js +0 -45
  142. package/legacy/BarChart/formatter.js +0 -78
  143. package/legacy/BarChart/index.js +0 -3
  144. package/legacy/BarChart/legend.js +0 -15
  145. package/legacy/ChartContainer/ChartContainer.js +0 -189
  146. package/legacy/ChartContainer/index.js +0 -1
  147. package/legacy/ChartsAxis/ChartsAxis.js +0 -215
  148. package/legacy/ChartsAxis/axisClasses.js +0 -5
  149. package/legacy/ChartsAxis/index.js +0 -2
  150. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
  151. package/legacy/ChartsAxisHighlight/index.js +0 -1
  152. package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
  153. package/legacy/ChartsClipPath/index.js +0 -1
  154. package/legacy/ChartsLegend/ChartsLegend.js +0 -100
  155. package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
  156. package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
  157. package/legacy/ChartsLegend/index.js +0 -4
  158. package/legacy/ChartsLegend/utils.js +0 -15
  159. package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
  160. package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
  161. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
  162. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
  163. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
  164. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
  165. package/legacy/ChartsReferenceLine/common.js +0 -19
  166. package/legacy/ChartsReferenceLine/index.js +0 -2
  167. package/legacy/ChartsSurface.js +0 -76
  168. package/legacy/ChartsText/ChartsText.js +0 -95
  169. package/legacy/ChartsText/index.js +0 -1
  170. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
  171. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
  172. package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
  173. package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
  174. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
  175. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
  176. package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
  177. package/legacy/ChartsTooltip/index.js +0 -6
  178. package/legacy/ChartsTooltip/utils.js +0 -103
  179. package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
  180. package/legacy/ChartsVoronoiHandler/index.js +0 -1
  181. package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
  182. package/legacy/ChartsXAxis/index.js +0 -1
  183. package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
  184. package/legacy/ChartsYAxis/index.js +0 -1
  185. package/legacy/LineChart/AnimatedArea.js +0 -102
  186. package/legacy/LineChart/AnimatedLine.js +0 -104
  187. package/legacy/LineChart/AreaElement.js +0 -112
  188. package/legacy/LineChart/AreaPlot.js +0 -149
  189. package/legacy/LineChart/LineChart.js +0 -426
  190. package/legacy/LineChart/LineElement.js +0 -112
  191. package/legacy/LineChart/LineHighlightElement.js +0 -79
  192. package/legacy/LineChart/LineHighlightPlot.js +0 -97
  193. package/legacy/LineChart/LinePlot.js +0 -144
  194. package/legacy/LineChart/MarkElement.js +0 -153
  195. package/legacy/LineChart/MarkPlot.js +0 -178
  196. package/legacy/LineChart/extremums.js +0 -54
  197. package/legacy/LineChart/formatter.js +0 -82
  198. package/legacy/LineChart/index.js +0 -11
  199. package/legacy/LineChart/legend.js +0 -15
  200. package/legacy/PieChart/PieArc.js +0 -103
  201. package/legacy/PieChart/PieArcLabel.js +0 -112
  202. package/legacy/PieChart/PieArcLabelPlot.js +0 -193
  203. package/legacy/PieChart/PieArcPlot.js +0 -180
  204. package/legacy/PieChart/PieChart.js +0 -382
  205. package/legacy/PieChart/PiePlot.js +0 -137
  206. package/legacy/PieChart/dataTransform/transition.js +0 -149
  207. package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
  208. package/legacy/PieChart/formatter.js +0 -55
  209. package/legacy/PieChart/index.js +0 -6
  210. package/legacy/PieChart/legend.js +0 -16
  211. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -255
  212. package/legacy/ResponsiveChartContainer/index.js +0 -1
  213. package/legacy/ScatterChart/Scatter.js +0 -110
  214. package/legacy/ScatterChart/ScatterChart.js +0 -370
  215. package/legacy/ScatterChart/ScatterPlot.js +0 -80
  216. package/legacy/ScatterChart/extremums.js +0 -39
  217. package/legacy/ScatterChart/formatter.js +0 -12
  218. package/legacy/ScatterChart/index.js +0 -3
  219. package/legacy/ScatterChart/legend.js +0 -15
  220. package/legacy/SparkLineChart/SparkLineChart.js +0 -266
  221. package/legacy/SparkLineChart/index.js +0 -1
  222. package/legacy/colorPalettes/colorPalettes.js +0 -15
  223. package/legacy/colorPalettes/index.js +0 -1
  224. package/legacy/constants.js +0 -8
  225. package/legacy/context/CartesianContextProvider.js +0 -327
  226. package/legacy/context/DrawingProvider.js +0 -74
  227. package/legacy/context/HighlightProvider.js +0 -56
  228. package/legacy/context/InteractionProvider.js +0 -81
  229. package/legacy/context/SeriesContextProvider.js +0 -74
  230. package/legacy/context/index.js +0 -2
  231. package/legacy/hooks/index.js +0 -2
  232. package/legacy/hooks/useAxisEvents.js +0 -120
  233. package/legacy/hooks/useChartDimensions.js +0 -18
  234. package/legacy/hooks/useDrawingArea.js +0 -21
  235. package/legacy/hooks/useInteractionItemProps.js +0 -71
  236. package/legacy/hooks/useMounted.js +0 -21
  237. package/legacy/hooks/useReducedMotion.js +0 -27
  238. package/legacy/hooks/useScale.js +0 -33
  239. package/legacy/hooks/useTicks.js +0 -66
  240. package/legacy/index.js +0 -31
  241. package/legacy/internals/components/AxisSharedComponents.js +0 -25
  242. package/legacy/internals/defaultizeColor.js +0 -17
  243. package/legacy/internals/defaultizeValueFormatter.js +0 -12
  244. package/legacy/internals/domUtils.js +0 -121
  245. package/legacy/internals/geometry.js +0 -37
  246. package/legacy/internals/getCurve.js +0 -39
  247. package/legacy/internals/getScale.js +0 -17
  248. package/legacy/internals/getWordsByLines.js +0 -15
  249. package/legacy/internals/isBandScale.js +0 -3
  250. package/legacy/internals/stackSeries.js +0 -92
  251. package/legacy/internals/useAnimatedPath.js +0 -32
  252. package/legacy/internals/utils.js +0 -52
  253. package/legacy/models/axis.js +0 -6
  254. package/legacy/models/helpers.js +0 -1
  255. package/legacy/models/index.js +0 -4
  256. package/legacy/models/layout.js +0 -1
  257. package/legacy/models/seriesType/bar.js +0 -1
  258. package/legacy/models/seriesType/common.js +0 -1
  259. package/legacy/models/seriesType/config.js +0 -1
  260. package/legacy/models/seriesType/index.js +0 -5
  261. package/legacy/models/seriesType/line.js +0 -1
  262. package/legacy/models/seriesType/pie.js +0 -1
  263. package/legacy/models/seriesType/scatter.js +0 -1
  264. package/legacy/models/stacking.js +0 -1
  265. package/legacy/themeAugmentation/index.js +0 -3
@@ -7,7 +7,7 @@ export interface TickParams {
7
7
  */
8
8
  tickMaxStep?: number;
9
9
  /**
10
- * Maximal step between two ticks.
10
+ * Minimal step between two ticks.
11
11
  * When using time data, the value is assumed to be in ms.
12
12
  * Not supported by categorical axis (band, points).
13
13
  */
@@ -39,8 +39,7 @@ export type TickItemType = {
39
39
  offset: number;
40
40
  labelOffset: number;
41
41
  };
42
- declare function useTicks(options: {
42
+ export declare function useTicks(options: {
43
43
  scale: D3Scale;
44
44
  valueFormatter?: (value: any) => string;
45
45
  } & Pick<TickParams, 'tickNumber' | 'tickInterval'>): TickItemType[];
46
- export default useTicks;
package/hooks/useTicks.js CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
7
6
  exports.getTickNumber = getTickNumber;
7
+ exports.useTicks = useTicks;
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
  var _isBandScale = require("../internals/isBandScale");
10
10
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
@@ -64,5 +64,4 @@ function useTicks(options) {
64
64
  labelOffset: 0
65
65
  }));
66
66
  }, [tickNumber, scale, valueFormatter, tickInterval]);
67
- }
68
- var _default = exports.default = useTicks;
67
+ }
package/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export * from './ChartsReferenceLine';
8
8
  export * from './ChartsAxis';
9
9
  export * from './ChartsXAxis';
10
10
  export * from './ChartsYAxis';
11
+ export * from './ChartsGrid';
11
12
  export * from './ChartsText';
12
13
  export * from './ChartsTooltip';
13
14
  export * from './ChartsLegend';
@@ -19,6 +20,7 @@ export * from './LineChart';
19
20
  export * from './PieChart';
20
21
  export * from './ScatterChart';
21
22
  export * from './SparkLineChart';
23
+ export * from './Gauge';
22
24
  export * from './ChartContainer';
23
25
  export * from './ChartsSurface';
24
26
  export * from './ResponsiveChartContainer';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.0.0-beta.2
2
+ * @mui/x-charts v7.0.0-beta.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -120,6 +120,17 @@ Object.keys(_ChartsYAxis).forEach(function (key) {
120
120
  }
121
121
  });
122
122
  });
123
+ var _ChartsGrid = require("./ChartsGrid");
124
+ Object.keys(_ChartsGrid).forEach(function (key) {
125
+ if (key === "default" || key === "__esModule") return;
126
+ if (key in exports && exports[key] === _ChartsGrid[key]) return;
127
+ Object.defineProperty(exports, key, {
128
+ enumerable: true,
129
+ get: function () {
130
+ return _ChartsGrid[key];
131
+ }
132
+ });
133
+ });
123
134
  var _ChartsText = require("./ChartsText");
124
135
  Object.keys(_ChartsText).forEach(function (key) {
125
136
  if (key === "default" || key === "__esModule") return;
@@ -241,6 +252,17 @@ Object.keys(_SparkLineChart).forEach(function (key) {
241
252
  }
242
253
  });
243
254
  });
255
+ var _Gauge = require("./Gauge");
256
+ Object.keys(_Gauge).forEach(function (key) {
257
+ if (key === "default" || key === "__esModule") return;
258
+ if (key in exports && exports[key] === _Gauge[key]) return;
259
+ Object.defineProperty(exports, key, {
260
+ enumerable: true,
261
+ get: function () {
262
+ return _Gauge[key];
263
+ }
264
+ });
265
+ });
244
266
  var _ChartContainer = require("./ChartContainer");
245
267
  Object.keys(_ChartContainer).forEach(function (key) {
246
268
  if (key === "default" || key === "__esModule") return;
@@ -10,6 +10,7 @@ import { ChartsTooltip } from '../ChartsTooltip';
10
10
  import { ChartsLegend } from '../ChartsLegend';
11
11
  import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
12
12
  import { ChartsClipPath } from '../ChartsClipPath';
13
+ import { ChartsGrid } from '../ChartsGrid';
13
14
  import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -39,6 +40,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
39
40
  tooltip,
40
41
  axisHighlight,
41
42
  legend,
43
+ grid,
42
44
  topAxis,
43
45
  leftAxis,
44
46
  rightAxis,
@@ -86,6 +88,9 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
86
88
  disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
87
89
  children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
88
90
  onAxisClick: onAxisClick
91
+ }), grid && /*#__PURE__*/_jsx(ChartsGrid, {
92
+ vertical: grid.vertical,
93
+ horizontal: grid.horizontal
89
94
  }), /*#__PURE__*/_jsx("g", {
90
95
  clipPath: `url(#${clipPathId})`,
91
96
  children: /*#__PURE__*/_jsx(BarPlot, {
@@ -118,11 +123,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
118
123
  // | To update them edit the TypeScript types and run "yarn proptypes" |
119
124
  // ----------------------------------------------------------------------
120
125
  /**
121
- * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
122
- * The two properties accept the following values:
123
- * - 'none': display nothing.
124
- * - 'line': display a line at the current mouse position.
125
- * - 'band': display a band at the current mouse position. Only available with band scale.
126
+ * The configuration of axes highlight.
127
+ * Default is set to 'band' in the bar direction.
128
+ * Depends on `layout` prop.
129
+ * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
126
130
  */
127
131
  axisHighlight: PropTypes.shape({
128
132
  x: PropTypes.oneOf(['band', 'line', 'none']),
@@ -173,11 +177,21 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
173
177
  * @default false
174
178
  */
175
179
  disableAxisListener: PropTypes.bool,
180
+ /**
181
+ * Option to display a cartesian grid in the background.
182
+ */
183
+ grid: PropTypes.shape({
184
+ horizontal: PropTypes.bool,
185
+ vertical: PropTypes.bool
186
+ }),
176
187
  /**
177
188
  * The height of the chart in px. If not defined, it takes the height of the parent element.
178
- * @default undefined
179
189
  */
180
190
  height: PropTypes.number,
191
+ /**
192
+ * The direction of the bar elements.
193
+ * @default 'vertical'
194
+ */
181
195
  layout: PropTypes.oneOf(['horizontal', 'vertical']),
182
196
  /**
183
197
  * Indicate which axis to display the left of the charts.
@@ -272,6 +286,9 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
272
286
  tickNumber: PropTypes.number,
273
287
  tickSize: PropTypes.number
274
288
  }), PropTypes.string]),
289
+ /**
290
+ * The series to display in the bar chart.
291
+ */
275
292
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
276
293
  /**
277
294
  * If `true`, animations are skipped.
@@ -290,6 +307,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
290
307
  slots: PropTypes.object,
291
308
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
292
309
  title: PropTypes.string,
310
+ /**
311
+ * The configuration of the tooltip.
312
+ * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
313
+ */
293
314
  tooltip: PropTypes.shape({
294
315
  axisContent: PropTypes.elementType,
295
316
  classes: PropTypes.object,
@@ -333,7 +354,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
333
354
  }),
334
355
  /**
335
356
  * The width of the chart in px. If not defined, it takes the width of the parent element.
336
- * @default undefined
337
357
  */
338
358
  width: PropTypes.number,
339
359
  /**
@@ -0,0 +1,121 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["vertical", "horizontal"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import composeClasses from '@mui/utils/composeClasses';
7
+ import { styled } from '@mui/material/styles';
8
+ import { CartesianContext } from '../context/CartesianContextProvider';
9
+ import { useTicks } from '../hooks/useTicks';
10
+ import { getChartsGridUtilityClass, chartsGridClasses } from './chartsGridClasses';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ const GridRoot = styled('g', {
14
+ name: 'MuiChartsGrid',
15
+ slot: 'Root',
16
+ overridesResolver: (props, styles) => styles.root
17
+ })(({
18
+ theme
19
+ }) => ({
20
+ [`& .${chartsGridClasses.line}`]: {
21
+ stroke: (theme.vars || theme).palette.divider,
22
+ shapeRendering: 'crispEdges',
23
+ strokeWidth: 1
24
+ }
25
+ }));
26
+ const useUtilityClasses = ({
27
+ classes
28
+ }) => {
29
+ const slots = {
30
+ root: ['root'],
31
+ verticalLine: ['line', 'verticalLine'],
32
+ horizontalLine: ['line', 'horizontalLine']
33
+ };
34
+ return composeClasses(slots, getChartsGridUtilityClass, classes);
35
+ };
36
+ /**
37
+ * Demos:
38
+ *
39
+ * - [Axis](https://mui.com/x/react-charts/axis/)
40
+ *
41
+ * API:
42
+ *
43
+ * - [ChartsGrid API](https://mui.com/x/api/charts/charts-axis/)
44
+ */
45
+ function ChartsGrid(props) {
46
+ const {
47
+ vertical,
48
+ horizontal
49
+ } = props,
50
+ other = _objectWithoutPropertiesLoose(props, _excluded);
51
+ const {
52
+ xAxis,
53
+ xAxisIds,
54
+ yAxis,
55
+ yAxisIds
56
+ } = React.useContext(CartesianContext);
57
+ const classes = useUtilityClasses(props);
58
+ const horizontalAxisId = yAxisIds[0];
59
+ const verticalAxisId = xAxisIds[0];
60
+ const {
61
+ scale: xScale,
62
+ tickNumber: xTickNumber,
63
+ tickInterval: xTickInterval
64
+ } = xAxis[verticalAxisId];
65
+ const {
66
+ scale: yScale,
67
+ tickNumber: yTickNumber,
68
+ tickInterval: yTickInterval
69
+ } = yAxis[horizontalAxisId];
70
+ const xTicks = useTicks({
71
+ scale: xScale,
72
+ tickNumber: xTickNumber,
73
+ tickInterval: xTickInterval
74
+ });
75
+ const yTicks = useTicks({
76
+ scale: yScale,
77
+ tickNumber: yTickNumber,
78
+ tickInterval: yTickInterval
79
+ });
80
+ return /*#__PURE__*/_jsxs(GridRoot, _extends({}, other, {
81
+ className: classes.root,
82
+ children: [vertical && xTicks.map(({
83
+ formattedValue,
84
+ offset
85
+ }) => /*#__PURE__*/_jsx("line", {
86
+ y1: yScale.range()[0],
87
+ y2: yScale.range()[1],
88
+ x1: offset,
89
+ x2: offset,
90
+ className: classes.verticalLine
91
+ }, formattedValue)), horizontal && yTicks.map(({
92
+ formattedValue,
93
+ offset
94
+ }) => /*#__PURE__*/_jsx("line", {
95
+ y1: offset,
96
+ y2: offset,
97
+ x1: xScale.range()[0],
98
+ x2: xScale.range()[1],
99
+ className: classes.horizontalLine
100
+ }, formattedValue))]
101
+ }));
102
+ }
103
+ process.env.NODE_ENV !== "production" ? ChartsGrid.propTypes = {
104
+ // ----------------------------- Warning --------------------------------
105
+ // | These PropTypes are generated from the TypeScript type definitions |
106
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
107
+ // ----------------------------------------------------------------------
108
+ /**
109
+ * Override or extend the styles applied to the component.
110
+ */
111
+ classes: PropTypes.object,
112
+ /**
113
+ * Displays horizontal grid.
114
+ */
115
+ horizontal: PropTypes.bool,
116
+ /**
117
+ * Displays vertical grid.
118
+ */
119
+ vertical: PropTypes.bool
120
+ } : void 0;
121
+ export { ChartsGrid };
@@ -0,0 +1,6 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
+ export function getChartsGridUtilityClass(slot) {
4
+ return generateUtilityClass('MuiChartsGrid', slot);
5
+ }
6
+ export const chartsGridClasses = generateUtilityClasses('MuiChartsGrid', ['root', 'line', 'horizontalLine', 'verticalLine']);
@@ -0,0 +1,2 @@
1
+ export * from './ChartsGrid';
2
+ export * from './chartsGridClasses';
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { SVGContext } from '../context/DrawingProvider';
3
+ import { SvgContext } from '../context/DrawingProvider';
4
4
  import { InteractionContext } from '../context/InteractionProvider';
5
5
  import { CartesianContext } from '../context/CartesianContextProvider';
6
6
  import { SeriesContext } from '../context/SeriesContextProvider';
@@ -9,7 +9,7 @@ function ChartsOnAxisClickHandler(props) {
9
9
  const {
10
10
  onAxisClick
11
11
  } = props;
12
- const svgRef = React.useContext(SVGContext);
12
+ const svgRef = React.useContext(SvgContext);
13
13
  const series = React.useContext(SeriesContext);
14
14
  const {
15
15
  axis
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className"];
3
+ const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className", "title", "desc"];
4
4
  import { styled } from '@mui/material/styles';
5
5
  import PropTypes from 'prop-types';
6
6
  import * as React from 'react';
@@ -17,7 +17,9 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props
17
17
  width,
18
18
  height,
19
19
  viewBox,
20
- disableAxisListener = false
20
+ disableAxisListener = false,
21
+ title,
22
+ desc
21
23
  } = props,
22
24
  other = _objectWithoutPropertiesLoose(props, _excluded);
23
25
  const svgView = _extends({
@@ -34,9 +36,9 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props
34
36
  ref: ref
35
37
  }, other, {
36
38
  children: [/*#__PURE__*/_jsx("title", {
37
- children: props.title
39
+ children: title
38
40
  }), /*#__PURE__*/_jsx("desc", {
39
- children: props.desc
41
+ children: desc
40
42
  }), children]
41
43
  }));
42
44
  });
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SVGContext } from '../context/DrawingProvider';
2
+ import { SvgContext } from '../context/DrawingProvider';
3
3
  export function generateVirtualElement(mousePosition) {
4
4
  if (mousePosition === null) {
5
5
  return {
@@ -44,7 +44,7 @@ export function generateVirtualElement(mousePosition) {
44
44
  };
45
45
  }
46
46
  export function useMouseTracker() {
47
- const svgRef = React.useContext(SVGContext);
47
+ const svgRef = React.useContext(SvgContext);
48
48
 
49
49
  // Use a ref to avoid rerendering on every mousemove event.
50
50
  const [mousePosition, setMousePosition] = React.useState(null);
@@ -4,7 +4,7 @@ import { Delaunay } from 'd3-delaunay';
4
4
  import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
5
5
  import { InteractionContext } from '../context/InteractionProvider';
6
6
  import { CartesianContext } from '../context/CartesianContextProvider';
7
- import { SVGContext, DrawingContext } from '../context/DrawingProvider';
7
+ import { SvgContext, DrawingContext } from '../context/DrawingProvider';
8
8
  import { SeriesContext } from '../context/SeriesContextProvider';
9
9
  import { getValueToPositionMapper } from '../hooks/useScale';
10
10
  import { getSVGPoint } from '../internals/utils';
@@ -14,7 +14,7 @@ function ChartsVoronoiHandler(props) {
14
14
  voronoiMaxRadius,
15
15
  onItemClick
16
16
  } = props;
17
- const svgRef = React.useContext(SVGContext);
17
+ const svgRef = React.useContext(SvgContext);
18
18
  const {
19
19
  width,
20
20
  height,
@@ -207,7 +207,6 @@ process.env.NODE_ENV !== "production" ? ChartsVoronoiHandler.propTypes = {
207
207
  /**
208
208
  * Defines the maximal distance between a scatter point and the pointer that triggers the interaction.
209
209
  * If `undefined`, the radius is assumed to be infinite.
210
- * @default undefined
211
210
  */
212
211
  voronoiMaxRadius: PropTypes.number
213
212
  } : void 0;
@@ -8,7 +8,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/utils';
8
8
  import { useThemeProps, useTheme } from '@mui/material/styles';
9
9
  import { CartesianContext } from '../context/CartesianContextProvider';
10
10
  import { DrawingContext } from '../context/DrawingProvider';
11
- import useTicks from '../hooks/useTicks';
11
+ import { useTicks } from '../hooks/useTicks';
12
12
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
13
13
  import { AxisRoot } from '../internals/components/AxisSharedComponents';
14
14
  import { ChartsText } from '../ChartsText';
@@ -330,7 +330,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
330
330
  */
331
331
  tickMaxStep: PropTypes.number,
332
332
  /**
333
- * Maximal step between two ticks.
333
+ * Minimal step between two ticks.
334
334
  * When using time data, the value is assumed to be in ms.
335
335
  * Not supported by categorical axis (band, points).
336
336
  */
@@ -8,7 +8,7 @@ import { unstable_composeClasses as composeClasses } from '@mui/utils';
8
8
  import { useThemeProps, useTheme } from '@mui/material/styles';
9
9
  import { CartesianContext } from '../context/CartesianContextProvider';
10
10
  import { DrawingContext } from '../context/DrawingProvider';
11
- import useTicks from '../hooks/useTicks';
11
+ import { useTicks } from '../hooks/useTicks';
12
12
  import { AxisRoot } from '../internals/components/AxisSharedComponents';
13
13
  import { ChartsText } from '../ChartsText';
14
14
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
@@ -260,7 +260,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
260
260
  */
261
261
  tickMaxStep: PropTypes.number,
262
262
  /**
263
- * Maximal step between two ticks.
263
+ * Minimal step between two ticks.
264
264
  * When using time data, the value is assumed to be in ms.
265
265
  * Not supported by categorical axis (band, points).
266
266
  */
@@ -0,0 +1,147 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["text", "children", "classes"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import composeClasses from '@mui/utils/composeClasses';
7
+ import { GaugeContainer } from './GaugeContainer';
8
+ import { GaugeValueArc } from './GaugeValueArc';
9
+ import { GaugeReferenceArc } from './GaugeReferenceArc';
10
+ import { getGaugeUtilityClass } from './gaugeClasses';
11
+ import { GaugeValueText } from './GaugeValueText';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+ const useUtilityClasses = props => {
15
+ const {
16
+ classes
17
+ } = props;
18
+ const slots = {
19
+ root: ['root'],
20
+ valueArc: ['valueArc'],
21
+ referenceArc: ['referenceArc'],
22
+ valueText: ['valueText']
23
+ };
24
+ return composeClasses(slots, getGaugeUtilityClass, classes);
25
+ };
26
+ function Gauge(props) {
27
+ const {
28
+ text,
29
+ children
30
+ } = props,
31
+ other = _objectWithoutPropertiesLoose(props, _excluded);
32
+ const classes = useUtilityClasses(props);
33
+ return /*#__PURE__*/_jsxs(GaugeContainer, _extends({}, other, {
34
+ className: classes.root,
35
+ children: [/*#__PURE__*/_jsx(GaugeReferenceArc, {
36
+ className: classes.referenceArc
37
+ }), /*#__PURE__*/_jsx(GaugeValueArc, {
38
+ className: classes.valueArc
39
+ }), /*#__PURE__*/_jsx(GaugeValueText, {
40
+ className: classes.valueText,
41
+ text: text
42
+ }), children]
43
+ }));
44
+ }
45
+ process.env.NODE_ENV !== "production" ? Gauge.propTypes = {
46
+ // ----------------------------- Warning --------------------------------
47
+ // | These PropTypes are generated from the TypeScript type definitions |
48
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
49
+ // ----------------------------------------------------------------------
50
+ children: PropTypes.node,
51
+ classes: PropTypes.object,
52
+ className: PropTypes.string,
53
+ /**
54
+ * The radius applied to arc corners (similar to border radius).
55
+ * Set it to '50%' to get rounded arc.
56
+ * @default 0
57
+ */
58
+ cornerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
59
+ /**
60
+ * The x coordinate of the arc center.
61
+ * Can be a number (in px) or a string with a percentage such as '50%'.
62
+ * The '100%' is the width the drawing area.
63
+ */
64
+ cx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
65
+ /**
66
+ * The y coordinate of the arc center.
67
+ * Can be a number (in px) or a string with a percentage such as '50%'.
68
+ * The '100%' is the height the drawing area.
69
+ */
70
+ cy: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
71
+ desc: PropTypes.string,
72
+ /**
73
+ * If `true`, the charts will not listen to the mouse move event.
74
+ * It might break interactive features, but will improve performance.
75
+ * @default false
76
+ */
77
+ disableAxisListener: PropTypes.bool,
78
+ /**
79
+ * The end angle (deg).
80
+ * @default 360
81
+ */
82
+ endAngle: PropTypes.number,
83
+ /**
84
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
85
+ */
86
+ height: PropTypes.number,
87
+ /**
88
+ * The radius between circle center and the begining of the arc.
89
+ * Can be a number (in px) or a string with a percentage such as '50%'.
90
+ * The '100%' is the maximal radius that fit into the drawing area.
91
+ * @default '80%'
92
+ */
93
+ innerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
94
+ /**
95
+ * The margin between the SVG and the drawing area.
96
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
97
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
98
+ * @default object Depends on the charts type.
99
+ */
100
+ margin: PropTypes.shape({
101
+ bottom: PropTypes.number,
102
+ left: PropTypes.number,
103
+ right: PropTypes.number,
104
+ top: PropTypes.number
105
+ }),
106
+ /**
107
+ * The radius between circle center and the end of the arc.
108
+ * Can be a number (in px) or a string with a percentage such as '50%'.
109
+ * The '100%' is the maximal radius that fit into the drawing area.
110
+ * @default '100%'
111
+ */
112
+ outerRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
113
+ /**
114
+ * The start angle (deg).
115
+ * @default 0
116
+ */
117
+ startAngle: PropTypes.number,
118
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
119
+ text: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
120
+ title: PropTypes.string,
121
+ /**
122
+ * The value of the gauge.
123
+ * Set to `null` to not display a value.
124
+ */
125
+ value: PropTypes.number,
126
+ /**
127
+ * The maximal value of the gauge.
128
+ * @default 100
129
+ */
130
+ valueMax: PropTypes.number,
131
+ /**
132
+ * The minimal value of the gauge.
133
+ * @default 0
134
+ */
135
+ valueMin: PropTypes.number,
136
+ viewBox: PropTypes.shape({
137
+ height: PropTypes.number,
138
+ width: PropTypes.number,
139
+ x: PropTypes.number,
140
+ y: PropTypes.number
141
+ }),
142
+ /**
143
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
144
+ */
145
+ width: PropTypes.number
146
+ } : void 0;
147
+ export { Gauge };