@mui/x-charts 7.0.0-beta.3 → 7.0.0-beta.5

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 (221) hide show
  1. package/BarChart/BarChart.js +0 -2
  2. package/CHANGELOG.md +357 -22
  3. package/ChartsGrid/ChartsGrid.js +2 -2
  4. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  5. package/ChartsTooltip/utils.js +1 -1
  6. package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
  7. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
  8. package/ChartsXAxis/ChartsXAxis.js +1 -1
  9. package/ChartsYAxis/ChartsYAxis.js +1 -1
  10. package/Gauge/Gauge.js +0 -2
  11. package/Gauge/GaugeContainer.d.ts +0 -2
  12. package/Gauge/GaugeContainer.js +0 -2
  13. package/Gauge/GaugeProvider.js +3 -0
  14. package/Gauge/GaugeValueText.js +1 -1
  15. package/LineChart/LineChart.js +0 -2
  16. package/PieChart/PieChart.js +0 -2
  17. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
  18. package/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  19. package/ScatterChart/ScatterChart.js +0 -3
  20. package/SparkLineChart/SparkLineChart.js +0 -2
  21. package/context/CartesianContextProvider.d.ts +0 -8
  22. package/context/CartesianContextProvider.js +4 -89
  23. package/context/DrawingProvider.d.ts +2 -11
  24. package/context/DrawingProvider.js +10 -35
  25. package/context/HighlightProvider.js +3 -0
  26. package/context/InteractionProvider.js +3 -0
  27. package/context/SeriesContextProvider.js +3 -0
  28. package/context/index.d.ts +0 -2
  29. package/context/index.js +1 -15
  30. package/esm/BarChart/BarChart.js +0 -2
  31. package/esm/ChartsGrid/ChartsGrid.js +2 -2
  32. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  33. package/esm/ChartsTooltip/utils.js +2 -2
  34. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  35. package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
  36. package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
  37. package/esm/Gauge/Gauge.js +0 -2
  38. package/esm/Gauge/GaugeContainer.js +0 -2
  39. package/esm/Gauge/GaugeProvider.js +3 -0
  40. package/esm/Gauge/GaugeValueText.js +1 -1
  41. package/esm/LineChart/LineChart.js +0 -2
  42. package/esm/PieChart/PieChart.js +0 -2
  43. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  44. package/esm/ScatterChart/ScatterChart.js +0 -3
  45. package/esm/SparkLineChart/SparkLineChart.js +0 -2
  46. package/esm/context/CartesianContextProvider.js +3 -88
  47. package/esm/context/DrawingProvider.js +10 -36
  48. package/esm/context/HighlightProvider.js +3 -0
  49. package/esm/context/InteractionProvider.js +3 -0
  50. package/esm/context/SeriesContextProvider.js +3 -0
  51. package/esm/context/index.js +1 -2
  52. package/esm/hooks/useAxisEvents.js +2 -2
  53. package/hooks/useAxisEvents.js +1 -1
  54. package/hooks/useTicks.d.ts +1 -1
  55. package/index.js +1 -1
  56. package/modern/BarChart/BarChart.js +0 -2
  57. package/modern/ChartsGrid/ChartsGrid.js +2 -2
  58. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  59. package/modern/ChartsTooltip/utils.js +2 -2
  60. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  61. package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
  62. package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
  63. package/modern/Gauge/Gauge.js +0 -2
  64. package/modern/Gauge/GaugeContainer.js +0 -2
  65. package/modern/Gauge/GaugeProvider.js +3 -0
  66. package/modern/Gauge/GaugeValueText.js +1 -1
  67. package/modern/LineChart/LineChart.js +0 -2
  68. package/modern/PieChart/PieChart.js +0 -2
  69. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  70. package/modern/ScatterChart/ScatterChart.js +0 -3
  71. package/modern/SparkLineChart/SparkLineChart.js +0 -2
  72. package/modern/context/CartesianContextProvider.js +3 -88
  73. package/modern/context/DrawingProvider.js +10 -36
  74. package/modern/context/HighlightProvider.js +3 -0
  75. package/modern/context/InteractionProvider.js +3 -0
  76. package/modern/context/SeriesContextProvider.js +3 -0
  77. package/modern/context/index.js +1 -2
  78. package/modern/hooks/useAxisEvents.js +2 -2
  79. package/modern/index.js +1 -1
  80. package/package.json +1 -1
  81. package/legacy/BarChart/BarChart.js +0 -440
  82. package/legacy/BarChart/BarElement.js +0 -119
  83. package/legacy/BarChart/BarPlot.js +0 -232
  84. package/legacy/BarChart/extremums.js +0 -45
  85. package/legacy/BarChart/formatter.js +0 -78
  86. package/legacy/BarChart/index.js +0 -3
  87. package/legacy/BarChart/legend.js +0 -15
  88. package/legacy/ChartContainer/ChartContainer.js +0 -189
  89. package/legacy/ChartContainer/index.js +0 -1
  90. package/legacy/ChartsAxis/ChartsAxis.js +0 -215
  91. package/legacy/ChartsAxis/axisClasses.js +0 -5
  92. package/legacy/ChartsAxis/index.js +0 -2
  93. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
  94. package/legacy/ChartsAxisHighlight/index.js +0 -1
  95. package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
  96. package/legacy/ChartsClipPath/index.js +0 -1
  97. package/legacy/ChartsGrid/ChartsGrid.js +0 -119
  98. package/legacy/ChartsGrid/chartsGridClasses.js +0 -6
  99. package/legacy/ChartsGrid/index.js +0 -2
  100. package/legacy/ChartsLegend/ChartsLegend.js +0 -100
  101. package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
  102. package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
  103. package/legacy/ChartsLegend/index.js +0 -4
  104. package/legacy/ChartsLegend/utils.js +0 -15
  105. package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
  106. package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
  107. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
  108. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
  109. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
  110. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
  111. package/legacy/ChartsReferenceLine/common.js +0 -19
  112. package/legacy/ChartsReferenceLine/index.js +0 -2
  113. package/legacy/ChartsSurface.js +0 -78
  114. package/legacy/ChartsText/ChartsText.js +0 -95
  115. package/legacy/ChartsText/index.js +0 -1
  116. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
  117. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
  118. package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
  119. package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
  120. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
  121. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
  122. package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
  123. package/legacy/ChartsTooltip/index.js +0 -6
  124. package/legacy/ChartsTooltip/utils.js +0 -103
  125. package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
  126. package/legacy/ChartsVoronoiHandler/index.js +0 -1
  127. package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
  128. package/legacy/ChartsXAxis/index.js +0 -1
  129. package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
  130. package/legacy/ChartsYAxis/index.js +0 -1
  131. package/legacy/Gauge/Gauge.js +0 -146
  132. package/legacy/Gauge/GaugeContainer.js +0 -215
  133. package/legacy/Gauge/GaugeProvider.js +0 -87
  134. package/legacy/Gauge/GaugeReferenceArc.js +0 -37
  135. package/legacy/Gauge/GaugeValueArc.js +0 -44
  136. package/legacy/Gauge/GaugeValueText.js +0 -66
  137. package/legacy/Gauge/gaugeClasses.js +0 -7
  138. package/legacy/Gauge/index.js +0 -7
  139. package/legacy/Gauge/utils.js +0 -84
  140. package/legacy/LineChart/AnimatedArea.js +0 -102
  141. package/legacy/LineChart/AnimatedLine.js +0 -104
  142. package/legacy/LineChart/AreaElement.js +0 -112
  143. package/legacy/LineChart/AreaPlot.js +0 -149
  144. package/legacy/LineChart/LineChart.js +0 -452
  145. package/legacy/LineChart/LineElement.js +0 -112
  146. package/legacy/LineChart/LineHighlightElement.js +0 -79
  147. package/legacy/LineChart/LineHighlightPlot.js +0 -97
  148. package/legacy/LineChart/LinePlot.js +0 -144
  149. package/legacy/LineChart/MarkElement.js +0 -153
  150. package/legacy/LineChart/MarkPlot.js +0 -178
  151. package/legacy/LineChart/extremums.js +0 -54
  152. package/legacy/LineChart/formatter.js +0 -82
  153. package/legacy/LineChart/index.js +0 -11
  154. package/legacy/LineChart/legend.js +0 -15
  155. package/legacy/PieChart/PieArc.js +0 -103
  156. package/legacy/PieChart/PieArcLabel.js +0 -112
  157. package/legacy/PieChart/PieArcLabelPlot.js +0 -193
  158. package/legacy/PieChart/PieArcPlot.js +0 -180
  159. package/legacy/PieChart/PieChart.js +0 -404
  160. package/legacy/PieChart/PiePlot.js +0 -137
  161. package/legacy/PieChart/dataTransform/transition.js +0 -149
  162. package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
  163. package/legacy/PieChart/formatter.js +0 -55
  164. package/legacy/PieChart/index.js +0 -6
  165. package/legacy/PieChart/legend.js +0 -16
  166. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -185
  167. package/legacy/ResponsiveChartContainer/index.js +0 -1
  168. package/legacy/ResponsiveChartContainer/useChartContainerDimensions.js +0 -73
  169. package/legacy/ScatterChart/Scatter.js +0 -110
  170. package/legacy/ScatterChart/ScatterChart.js +0 -395
  171. package/legacy/ScatterChart/ScatterPlot.js +0 -80
  172. package/legacy/ScatterChart/extremums.js +0 -39
  173. package/legacy/ScatterChart/formatter.js +0 -12
  174. package/legacy/ScatterChart/index.js +0 -3
  175. package/legacy/ScatterChart/legend.js +0 -15
  176. package/legacy/SparkLineChart/SparkLineChart.js +0 -266
  177. package/legacy/SparkLineChart/index.js +0 -1
  178. package/legacy/colorPalettes/colorPalettes.js +0 -15
  179. package/legacy/colorPalettes/index.js +0 -1
  180. package/legacy/constants.js +0 -8
  181. package/legacy/context/CartesianContextProvider.js +0 -327
  182. package/legacy/context/DrawingProvider.js +0 -74
  183. package/legacy/context/HighlightProvider.js +0 -56
  184. package/legacy/context/InteractionProvider.js +0 -81
  185. package/legacy/context/SeriesContextProvider.js +0 -74
  186. package/legacy/context/index.js +0 -2
  187. package/legacy/hooks/index.js +0 -2
  188. package/legacy/hooks/useAxisEvents.js +0 -120
  189. package/legacy/hooks/useChartDimensions.js +0 -18
  190. package/legacy/hooks/useDrawingArea.js +0 -21
  191. package/legacy/hooks/useInteractionItemProps.js +0 -71
  192. package/legacy/hooks/useMounted.js +0 -21
  193. package/legacy/hooks/useReducedMotion.js +0 -27
  194. package/legacy/hooks/useScale.js +0 -33
  195. package/legacy/hooks/useTicks.js +0 -65
  196. package/legacy/index.js +0 -33
  197. package/legacy/internals/components/AxisSharedComponents.js +0 -25
  198. package/legacy/internals/defaultizeColor.js +0 -17
  199. package/legacy/internals/defaultizeValueFormatter.js +0 -12
  200. package/legacy/internals/domUtils.js +0 -121
  201. package/legacy/internals/geometry.js +0 -37
  202. package/legacy/internals/getCurve.js +0 -39
  203. package/legacy/internals/getScale.js +0 -17
  204. package/legacy/internals/getWordsByLines.js +0 -15
  205. package/legacy/internals/isBandScale.js +0 -3
  206. package/legacy/internals/stackSeries.js +0 -92
  207. package/legacy/internals/useAnimatedPath.js +0 -32
  208. package/legacy/internals/utils.js +0 -52
  209. package/legacy/models/axis.js +0 -6
  210. package/legacy/models/helpers.js +0 -1
  211. package/legacy/models/index.js +0 -4
  212. package/legacy/models/layout.js +0 -1
  213. package/legacy/models/seriesType/bar.js +0 -1
  214. package/legacy/models/seriesType/common.js +0 -1
  215. package/legacy/models/seriesType/config.js +0 -1
  216. package/legacy/models/seriesType/index.js +0 -5
  217. package/legacy/models/seriesType/line.js +0 -1
  218. package/legacy/models/seriesType/pie.js +0 -1
  219. package/legacy/models/seriesType/scatter.js +0 -1
  220. package/legacy/models/stacking.js +0 -1
  221. package/legacy/themeAugmentation/index.js +0 -3
@@ -1,6 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import useId from '@mui/utils/useId';
5
4
  import useChartDimensions from '../hooks/useChartDimensions';
6
5
 
@@ -17,16 +16,16 @@ export const DrawingContext = /*#__PURE__*/React.createContext({
17
16
  width: 400,
18
17
  chartId: ''
19
18
  });
20
- export const SVGContext = /*#__PURE__*/React.createContext({
19
+ if (process.env.NODE_ENV !== 'production') {
20
+ DrawingContext.displayName = 'DrawingContext';
21
+ }
22
+ export const SvgContext = /*#__PURE__*/React.createContext({
21
23
  current: null
22
24
  });
23
-
24
- /**
25
- * API:
26
- *
27
- * - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
28
- */
29
- function DrawingProvider(props) {
25
+ if (process.env.NODE_ENV !== 'production') {
26
+ SvgContext.displayName = 'SvgContext';
27
+ }
28
+ export function DrawingProvider(props) {
30
29
  const {
31
30
  width,
32
31
  height,
@@ -39,36 +38,11 @@ function DrawingProvider(props) {
39
38
  const value = React.useMemo(() => _extends({
40
39
  chartId: chartId ?? ''
41
40
  }, drawingArea), [chartId, drawingArea]);
42
- return /*#__PURE__*/_jsx(SVGContext.Provider, {
41
+ return /*#__PURE__*/_jsx(SvgContext.Provider, {
43
42
  value: svgRef,
44
43
  children: /*#__PURE__*/_jsx(DrawingContext.Provider, {
45
44
  value: value,
46
45
  children: children
47
46
  })
48
47
  });
49
- }
50
- process.env.NODE_ENV !== "production" ? DrawingProvider.propTypes = {
51
- // ----------------------------- Warning --------------------------------
52
- // | These PropTypes are generated from the TypeScript type definitions |
53
- // | To update them edit the TypeScript types and run "yarn proptypes" |
54
- // ----------------------------------------------------------------------
55
- children: PropTypes.node,
56
- height: PropTypes.number.isRequired,
57
- /**
58
- * The margin between the SVG and the drawing area.
59
- * It's used for leaving some space for extra information such as the x- and y-axis or legend.
60
- * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
61
- * @default object Depends on the charts type.
62
- */
63
- margin: PropTypes.shape({
64
- bottom: PropTypes.number,
65
- left: PropTypes.number,
66
- right: PropTypes.number,
67
- top: PropTypes.number
68
- }),
69
- svgRef: PropTypes.shape({
70
- current: PropTypes.object
71
- }).isRequired,
72
- width: PropTypes.number.isRequired
73
- } : void 0;
74
- export { DrawingProvider };
48
+ }
@@ -10,6 +10,9 @@ export const HighlighContext = /*#__PURE__*/React.createContext({
10
10
  scope: defaultScope,
11
11
  dispatch: () => null
12
12
  });
13
+ if (process.env.NODE_ENV !== 'production') {
14
+ HighlighContext.displayName = 'HighlighContext';
15
+ }
13
16
  const dataReducer = (prevState, action) => {
14
17
  switch (action.type) {
15
18
  case 'enterItem':
@@ -10,6 +10,9 @@ export const InteractionContext = /*#__PURE__*/React.createContext({
10
10
  useVoronoiInteraction: false,
11
11
  dispatch: () => null
12
12
  });
13
+ if (process.env.NODE_ENV !== 'production') {
14
+ InteractionContext.displayName = 'InteractionContext';
15
+ }
13
16
  const dataReducer = (prevState, action) => {
14
17
  switch (action.type) {
15
18
  case 'enterItem':
@@ -9,6 +9,9 @@ import { defaultizeColor } from '../internals/defaultizeColor';
9
9
  import { blueberryTwilightPalette } from '../colorPalettes';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  export const SeriesContext = /*#__PURE__*/React.createContext({});
12
+ if (process.env.NODE_ENV !== 'production') {
13
+ SeriesContext.displayName = 'SeriesContext';
14
+ }
12
15
  const seriesTypeFormatter = {
13
16
  bar: barSeriesFormatter,
14
17
  scatter: scatterSeriesFormatter,
@@ -1,2 +1 @@
1
- export { CartesianContextProvider } from './CartesianContextProvider';
2
- export { DrawingProvider } from './DrawingProvider';
1
+ export {};
@@ -1,14 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { InteractionContext } from '../context/InteractionProvider';
3
3
  import { CartesianContext } from '../context/CartesianContextProvider';
4
- import { SVGContext, DrawingContext } from '../context/DrawingProvider';
4
+ import { SvgContext, DrawingContext } from '../context/DrawingProvider';
5
5
  import { isBandScale } from '../internals/isBandScale';
6
6
  import { getSVGPoint } from '../internals/utils';
7
7
  function getAsANumber(value) {
8
8
  return value instanceof Date ? value.getTime() : value;
9
9
  }
10
10
  export const useAxisEvents = disableAxisListener => {
11
- const svgRef = React.useContext(SVGContext);
11
+ const svgRef = React.useContext(SvgContext);
12
12
  const {
13
13
  width,
14
14
  height,
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.0.0-beta.3
2
+ * @mui/x-charts v7.0.0-beta.5
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "7.0.0-beta.3",
3
+ "version": "7.0.0-beta.5",
4
4
  "description": "The community edition of the charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -1,440 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
- import * as React from 'react';
4
- import useId from '@mui/utils/useId';
5
- import PropTypes from 'prop-types';
6
- import { BarPlot } from './BarPlot';
7
- import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
8
- import { ChartsAxis } from '../ChartsAxis';
9
- import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
10
- import { ChartsTooltip } from '../ChartsTooltip';
11
- import { ChartsLegend } from '../ChartsLegend';
12
- import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
13
- import { ChartsClipPath } from '../ChartsClipPath';
14
- import { ChartsGrid } from '../ChartsGrid';
15
- import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { jsxs as _jsxs } from "react/jsx-runtime";
18
- /**
19
- * Demos:
20
- *
21
- * - [Bars](https://mui.com/x/react-charts/bars/)
22
- * - [Bar demonstration](https://mui.com/x/react-charts/bar-demo/)
23
- * - [Stacking](https://mui.com/x/react-charts/stacking/)
24
- *
25
- * API:
26
- *
27
- * - [BarChart API](https://mui.com/x/api/charts/bar-chart/)
28
- */
29
- var BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
30
- var xAxis = props.xAxis,
31
- yAxis = props.yAxis,
32
- series = props.series,
33
- width = props.width,
34
- height = props.height,
35
- margin = props.margin,
36
- colors = props.colors,
37
- dataset = props.dataset,
38
- sx = props.sx,
39
- layout = props.layout,
40
- tooltip = props.tooltip,
41
- axisHighlight = props.axisHighlight,
42
- legend = props.legend,
43
- grid = props.grid,
44
- topAxis = props.topAxis,
45
- leftAxis = props.leftAxis,
46
- rightAxis = props.rightAxis,
47
- bottomAxis = props.bottomAxis,
48
- skipAnimation = props.skipAnimation,
49
- onItemClick = props.onItemClick,
50
- onAxisClick = props.onAxisClick,
51
- children = props.children,
52
- slots = props.slots,
53
- slotProps = props.slotProps;
54
- var id = useId();
55
- var clipPathId = "".concat(id, "-clip-path");
56
- var hasHorizontalSeries = layout === 'horizontal' || layout === undefined && series.some(function (item) {
57
- return item.layout === 'horizontal';
58
- });
59
- var defaultAxisConfig = {
60
- scaleType: 'band',
61
- data: Array.from({
62
- length: Math.max.apply(Math, _toConsumableArray(series.map(function (s) {
63
- var _ref, _s$data;
64
- return ((_ref = (_s$data = s.data) != null ? _s$data : dataset) != null ? _ref : []).length;
65
- })))
66
- }, function (_, index) {
67
- return index;
68
- })
69
- };
70
- var defaultizedAxisHighlight = _extends({}, hasHorizontalSeries ? {
71
- y: 'band'
72
- } : {
73
- x: 'band'
74
- }, axisHighlight);
75
- return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
76
- ref: ref,
77
- series: series.map(function (s) {
78
- return _extends({
79
- type: 'bar'
80
- }, s, {
81
- layout: hasHorizontalSeries ? 'horizontal' : 'vertical'
82
- });
83
- }),
84
- width: width,
85
- height: height,
86
- margin: margin,
87
- xAxis: xAxis != null ? xAxis : hasHorizontalSeries ? undefined : [_extends({
88
- id: DEFAULT_X_AXIS_KEY
89
- }, defaultAxisConfig)],
90
- yAxis: yAxis != null ? yAxis : hasHorizontalSeries ? [_extends({
91
- id: DEFAULT_Y_AXIS_KEY
92
- }, defaultAxisConfig)] : undefined,
93
- colors: colors,
94
- dataset: dataset,
95
- sx: sx,
96
- disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none' && !onAxisClick,
97
- children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
98
- onAxisClick: onAxisClick
99
- }), grid && /*#__PURE__*/_jsx(ChartsGrid, {
100
- vertical: grid.vertical,
101
- horizontal: grid.horizontal
102
- }), /*#__PURE__*/_jsx("g", {
103
- clipPath: "url(#".concat(clipPathId, ")"),
104
- children: /*#__PURE__*/_jsx(BarPlot, {
105
- slots: slots,
106
- slotProps: slotProps,
107
- skipAnimation: skipAnimation,
108
- onItemClick: onItemClick
109
- })
110
- }), /*#__PURE__*/_jsx(ChartsAxis, {
111
- topAxis: topAxis,
112
- leftAxis: leftAxis,
113
- rightAxis: rightAxis,
114
- bottomAxis: bottomAxis,
115
- slots: slots,
116
- slotProps: slotProps
117
- }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
118
- slots: slots,
119
- slotProps: slotProps
120
- })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
121
- slots: slots,
122
- slotProps: slotProps
123
- })), /*#__PURE__*/_jsx(ChartsClipPath, {
124
- id: clipPathId
125
- }), children]
126
- });
127
- });
128
- process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
129
- // ----------------------------- Warning --------------------------------
130
- // | These PropTypes are generated from the TypeScript type definitions |
131
- // | To update them edit the TypeScript types and run "yarn proptypes" |
132
- // ----------------------------------------------------------------------
133
- /**
134
- * The configuration of axes highlight.
135
- * Default is set to 'band' in the bar direction.
136
- * Depends on `layout` prop.
137
- * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
138
- */
139
- axisHighlight: PropTypes.shape({
140
- x: PropTypes.oneOf(['band', 'line', 'none']),
141
- y: PropTypes.oneOf(['band', 'line', 'none'])
142
- }),
143
- /**
144
- * Indicate which axis to display the bottom of the charts.
145
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
146
- * @default xAxisIds[0] The id of the first provided axis
147
- */
148
- bottomAxis: PropTypes.oneOfType([PropTypes.shape({
149
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
150
- classes: PropTypes.object,
151
- disableLine: PropTypes.bool,
152
- disableTicks: PropTypes.bool,
153
- fill: PropTypes.string,
154
- label: PropTypes.string,
155
- labelFontSize: PropTypes.number,
156
- labelStyle: PropTypes.object,
157
- position: PropTypes.oneOf(['bottom', 'top']),
158
- slotProps: PropTypes.object,
159
- slots: PropTypes.object,
160
- stroke: PropTypes.string,
161
- tickFontSize: PropTypes.number,
162
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
163
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
164
- tickLabelStyle: PropTypes.object,
165
- tickMaxStep: PropTypes.number,
166
- tickMinStep: PropTypes.number,
167
- tickNumber: PropTypes.number,
168
- tickSize: PropTypes.number
169
- }), PropTypes.string]),
170
- children: PropTypes.node,
171
- className: PropTypes.string,
172
- /**
173
- * Color palette used to colorize multiple series.
174
- * @default blueberryTwilightPalette
175
- */
176
- colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
177
- /**
178
- * An array of objects that can be used to populate series and axes data using their `dataKey` property.
179
- */
180
- dataset: PropTypes.arrayOf(PropTypes.object),
181
- desc: PropTypes.string,
182
- /**
183
- * If `true`, the charts will not listen to the mouse move event.
184
- * It might break interactive features, but will improve performance.
185
- * @default false
186
- */
187
- disableAxisListener: PropTypes.bool,
188
- /**
189
- * Option to display a cartesian grid in the background.
190
- */
191
- grid: PropTypes.shape({
192
- horizontal: PropTypes.bool,
193
- vertical: PropTypes.bool
194
- }),
195
- /**
196
- * The height of the chart in px. If not defined, it takes the height of the parent element.
197
- * @default undefined
198
- */
199
- height: PropTypes.number,
200
- /**
201
- * The direction of the bar elements.
202
- * @default 'vertical'
203
- */
204
- layout: PropTypes.oneOf(['horizontal', 'vertical']),
205
- /**
206
- * Indicate which axis to display the left of the charts.
207
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
208
- * @default yAxisIds[0] The id of the first provided axis
209
- */
210
- leftAxis: PropTypes.oneOfType([PropTypes.shape({
211
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
212
- classes: PropTypes.object,
213
- disableLine: PropTypes.bool,
214
- disableTicks: PropTypes.bool,
215
- fill: PropTypes.string,
216
- label: PropTypes.string,
217
- labelFontSize: PropTypes.number,
218
- labelStyle: PropTypes.object,
219
- position: PropTypes.oneOf(['left', 'right']),
220
- slotProps: PropTypes.object,
221
- slots: PropTypes.object,
222
- stroke: PropTypes.string,
223
- tickFontSize: PropTypes.number,
224
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
225
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
226
- tickLabelStyle: PropTypes.object,
227
- tickMaxStep: PropTypes.number,
228
- tickMinStep: PropTypes.number,
229
- tickNumber: PropTypes.number,
230
- tickSize: PropTypes.number
231
- }), PropTypes.string]),
232
- /**
233
- * @deprecated Consider using `slotProps.legend` instead.
234
- */
235
- legend: PropTypes.shape({
236
- classes: PropTypes.object,
237
- direction: PropTypes.oneOf(['column', 'row']),
238
- hidden: PropTypes.bool,
239
- position: PropTypes.shape({
240
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
241
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
242
- }),
243
- slotProps: PropTypes.object,
244
- slots: PropTypes.object
245
- }),
246
- /**
247
- * The margin between the SVG and the drawing area.
248
- * It's used for leaving some space for extra information such as the x- and y-axis or legend.
249
- * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
250
- * @default object Depends on the charts type.
251
- */
252
- margin: PropTypes.shape({
253
- bottom: PropTypes.number,
254
- left: PropTypes.number,
255
- right: PropTypes.number,
256
- top: PropTypes.number
257
- }),
258
- /**
259
- * The function called for onClick events.
260
- * The second argument contains information about all line/bar elements at the current mouse position.
261
- * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
262
- * @param {null | AxisData} data The data about the clicked axis and items associated with it.
263
- */
264
- onAxisClick: PropTypes.func,
265
- /**
266
- * Callback fired when a bar item is clicked.
267
- * @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
268
- * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
269
- */
270
- onItemClick: PropTypes.func,
271
- /**
272
- * Indicate which axis to display the right of the charts.
273
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
274
- * @default null
275
- */
276
- rightAxis: PropTypes.oneOfType([PropTypes.shape({
277
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
278
- classes: PropTypes.object,
279
- disableLine: PropTypes.bool,
280
- disableTicks: PropTypes.bool,
281
- fill: PropTypes.string,
282
- label: PropTypes.string,
283
- labelFontSize: PropTypes.number,
284
- labelStyle: PropTypes.object,
285
- position: PropTypes.oneOf(['left', 'right']),
286
- slotProps: PropTypes.object,
287
- slots: PropTypes.object,
288
- stroke: PropTypes.string,
289
- tickFontSize: PropTypes.number,
290
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
291
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
292
- tickLabelStyle: PropTypes.object,
293
- tickMaxStep: PropTypes.number,
294
- tickMinStep: PropTypes.number,
295
- tickNumber: PropTypes.number,
296
- tickSize: PropTypes.number
297
- }), PropTypes.string]),
298
- /**
299
- * The series to display in the bar chart.
300
- */
301
- series: PropTypes.arrayOf(PropTypes.object).isRequired,
302
- /**
303
- * If `true`, animations are skipped.
304
- * @default false
305
- */
306
- skipAnimation: PropTypes.bool,
307
- /**
308
- * The props used for each component slot.
309
- * @default {}
310
- */
311
- slotProps: PropTypes.object,
312
- /**
313
- * Overridable component slots.
314
- * @default {}
315
- */
316
- slots: PropTypes.object,
317
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
318
- title: PropTypes.string,
319
- /**
320
- * The configuration of the tooltip.
321
- * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
322
- */
323
- tooltip: PropTypes.shape({
324
- axisContent: PropTypes.elementType,
325
- classes: PropTypes.object,
326
- itemContent: PropTypes.elementType,
327
- slotProps: PropTypes.object,
328
- slots: PropTypes.object,
329
- trigger: PropTypes.oneOf(['axis', 'item', 'none'])
330
- }),
331
- /**
332
- * Indicate which axis to display the top of the charts.
333
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
334
- * @default null
335
- */
336
- topAxis: PropTypes.oneOfType([PropTypes.shape({
337
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
338
- classes: PropTypes.object,
339
- disableLine: PropTypes.bool,
340
- disableTicks: PropTypes.bool,
341
- fill: PropTypes.string,
342
- label: PropTypes.string,
343
- labelFontSize: PropTypes.number,
344
- labelStyle: PropTypes.object,
345
- position: PropTypes.oneOf(['bottom', 'top']),
346
- slotProps: PropTypes.object,
347
- slots: PropTypes.object,
348
- stroke: PropTypes.string,
349
- tickFontSize: PropTypes.number,
350
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
351
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
352
- tickLabelStyle: PropTypes.object,
353
- tickMaxStep: PropTypes.number,
354
- tickMinStep: PropTypes.number,
355
- tickNumber: PropTypes.number,
356
- tickSize: PropTypes.number
357
- }), PropTypes.string]),
358
- viewBox: PropTypes.shape({
359
- height: PropTypes.number,
360
- width: PropTypes.number,
361
- x: PropTypes.number,
362
- y: PropTypes.number
363
- }),
364
- /**
365
- * The width of the chart in px. If not defined, it takes the width of the parent element.
366
- * @default undefined
367
- */
368
- width: PropTypes.number,
369
- /**
370
- * The configuration of the x-axes.
371
- * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
372
- */
373
- xAxis: PropTypes.arrayOf(PropTypes.shape({
374
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
375
- classes: PropTypes.object,
376
- data: PropTypes.array,
377
- dataKey: PropTypes.string,
378
- disableLine: PropTypes.bool,
379
- disableTicks: PropTypes.bool,
380
- fill: PropTypes.string,
381
- hideTooltip: PropTypes.bool,
382
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
383
- label: PropTypes.string,
384
- labelFontSize: PropTypes.number,
385
- labelStyle: PropTypes.object,
386
- max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
387
- min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
388
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
389
- reverse: PropTypes.bool,
390
- scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
391
- slotProps: PropTypes.object,
392
- slots: PropTypes.object,
393
- stroke: PropTypes.string,
394
- tickFontSize: PropTypes.number,
395
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
396
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
397
- tickLabelStyle: PropTypes.object,
398
- tickMaxStep: PropTypes.number,
399
- tickMinStep: PropTypes.number,
400
- tickNumber: PropTypes.number,
401
- tickSize: PropTypes.number,
402
- valueFormatter: PropTypes.func
403
- })),
404
- /**
405
- * The configuration of the y-axes.
406
- * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
407
- */
408
- yAxis: PropTypes.arrayOf(PropTypes.shape({
409
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
410
- classes: PropTypes.object,
411
- data: PropTypes.array,
412
- dataKey: PropTypes.string,
413
- disableLine: PropTypes.bool,
414
- disableTicks: PropTypes.bool,
415
- fill: PropTypes.string,
416
- hideTooltip: PropTypes.bool,
417
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
418
- label: PropTypes.string,
419
- labelFontSize: PropTypes.number,
420
- labelStyle: PropTypes.object,
421
- max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
422
- min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
423
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
424
- reverse: PropTypes.bool,
425
- scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
426
- slotProps: PropTypes.object,
427
- slots: PropTypes.object,
428
- stroke: PropTypes.string,
429
- tickFontSize: PropTypes.number,
430
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
431
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
432
- tickLabelStyle: PropTypes.object,
433
- tickMaxStep: PropTypes.number,
434
- tickMinStep: PropTypes.number,
435
- tickNumber: PropTypes.number,
436
- tickSize: PropTypes.number,
437
- valueFormatter: PropTypes.func
438
- }))
439
- } : void 0;
440
- export { BarChart };