@mui/x-charts 7.0.0-beta.3 → 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 (218) hide show
  1. package/BarChart/BarChart.js +0 -2
  2. package/CHANGELOG.md +226 -15
  3. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  4. package/ChartsTooltip/utils.js +1 -1
  5. package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
  6. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
  7. package/ChartsXAxis/ChartsXAxis.js +1 -1
  8. package/ChartsYAxis/ChartsYAxis.js +1 -1
  9. package/Gauge/Gauge.js +0 -2
  10. package/Gauge/GaugeContainer.d.ts +0 -2
  11. package/Gauge/GaugeContainer.js +0 -2
  12. package/Gauge/GaugeProvider.js +3 -0
  13. package/Gauge/GaugeValueText.js +1 -1
  14. package/LineChart/LineChart.js +0 -2
  15. package/PieChart/PieChart.js +0 -2
  16. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
  17. package/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  18. package/ScatterChart/ScatterChart.js +0 -3
  19. package/SparkLineChart/SparkLineChart.js +0 -2
  20. package/context/CartesianContextProvider.d.ts +0 -8
  21. package/context/CartesianContextProvider.js +4 -89
  22. package/context/DrawingProvider.d.ts +2 -11
  23. package/context/DrawingProvider.js +10 -35
  24. package/context/HighlightProvider.js +3 -0
  25. package/context/InteractionProvider.js +3 -0
  26. package/context/SeriesContextProvider.js +3 -0
  27. package/context/index.d.ts +0 -2
  28. package/context/index.js +1 -15
  29. package/esm/BarChart/BarChart.js +0 -2
  30. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  31. package/esm/ChartsTooltip/utils.js +2 -2
  32. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  33. package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
  34. package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
  35. package/esm/Gauge/Gauge.js +0 -2
  36. package/esm/Gauge/GaugeContainer.js +0 -2
  37. package/esm/Gauge/GaugeProvider.js +3 -0
  38. package/esm/Gauge/GaugeValueText.js +1 -1
  39. package/esm/LineChart/LineChart.js +0 -2
  40. package/esm/PieChart/PieChart.js +0 -2
  41. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  42. package/esm/ScatterChart/ScatterChart.js +0 -3
  43. package/esm/SparkLineChart/SparkLineChart.js +0 -2
  44. package/esm/context/CartesianContextProvider.js +3 -88
  45. package/esm/context/DrawingProvider.js +10 -36
  46. package/esm/context/HighlightProvider.js +3 -0
  47. package/esm/context/InteractionProvider.js +3 -0
  48. package/esm/context/SeriesContextProvider.js +3 -0
  49. package/esm/context/index.js +1 -2
  50. package/esm/hooks/useAxisEvents.js +2 -2
  51. package/hooks/useAxisEvents.js +1 -1
  52. package/hooks/useTicks.d.ts +1 -1
  53. package/index.js +1 -1
  54. package/modern/BarChart/BarChart.js +0 -2
  55. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  56. package/modern/ChartsTooltip/utils.js +2 -2
  57. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  58. package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
  59. package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
  60. package/modern/Gauge/Gauge.js +0 -2
  61. package/modern/Gauge/GaugeContainer.js +0 -2
  62. package/modern/Gauge/GaugeProvider.js +3 -0
  63. package/modern/Gauge/GaugeValueText.js +1 -1
  64. package/modern/LineChart/LineChart.js +0 -2
  65. package/modern/PieChart/PieChart.js +0 -2
  66. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  67. package/modern/ScatterChart/ScatterChart.js +0 -3
  68. package/modern/SparkLineChart/SparkLineChart.js +0 -2
  69. package/modern/context/CartesianContextProvider.js +3 -88
  70. package/modern/context/DrawingProvider.js +10 -36
  71. package/modern/context/HighlightProvider.js +3 -0
  72. package/modern/context/InteractionProvider.js +3 -0
  73. package/modern/context/SeriesContextProvider.js +3 -0
  74. package/modern/context/index.js +1 -2
  75. package/modern/hooks/useAxisEvents.js +2 -2
  76. package/modern/index.js +1 -1
  77. package/package.json +1 -1
  78. package/legacy/BarChart/BarChart.js +0 -440
  79. package/legacy/BarChart/BarElement.js +0 -119
  80. package/legacy/BarChart/BarPlot.js +0 -232
  81. package/legacy/BarChart/extremums.js +0 -45
  82. package/legacy/BarChart/formatter.js +0 -78
  83. package/legacy/BarChart/index.js +0 -3
  84. package/legacy/BarChart/legend.js +0 -15
  85. package/legacy/ChartContainer/ChartContainer.js +0 -189
  86. package/legacy/ChartContainer/index.js +0 -1
  87. package/legacy/ChartsAxis/ChartsAxis.js +0 -215
  88. package/legacy/ChartsAxis/axisClasses.js +0 -5
  89. package/legacy/ChartsAxis/index.js +0 -2
  90. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
  91. package/legacy/ChartsAxisHighlight/index.js +0 -1
  92. package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
  93. package/legacy/ChartsClipPath/index.js +0 -1
  94. package/legacy/ChartsGrid/ChartsGrid.js +0 -119
  95. package/legacy/ChartsGrid/chartsGridClasses.js +0 -6
  96. package/legacy/ChartsGrid/index.js +0 -2
  97. package/legacy/ChartsLegend/ChartsLegend.js +0 -100
  98. package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
  99. package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
  100. package/legacy/ChartsLegend/index.js +0 -4
  101. package/legacy/ChartsLegend/utils.js +0 -15
  102. package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
  103. package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
  104. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
  105. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
  106. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
  107. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
  108. package/legacy/ChartsReferenceLine/common.js +0 -19
  109. package/legacy/ChartsReferenceLine/index.js +0 -2
  110. package/legacy/ChartsSurface.js +0 -78
  111. package/legacy/ChartsText/ChartsText.js +0 -95
  112. package/legacy/ChartsText/index.js +0 -1
  113. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
  114. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
  115. package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
  116. package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
  117. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
  118. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
  119. package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
  120. package/legacy/ChartsTooltip/index.js +0 -6
  121. package/legacy/ChartsTooltip/utils.js +0 -103
  122. package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
  123. package/legacy/ChartsVoronoiHandler/index.js +0 -1
  124. package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
  125. package/legacy/ChartsXAxis/index.js +0 -1
  126. package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
  127. package/legacy/ChartsYAxis/index.js +0 -1
  128. package/legacy/Gauge/Gauge.js +0 -146
  129. package/legacy/Gauge/GaugeContainer.js +0 -215
  130. package/legacy/Gauge/GaugeProvider.js +0 -87
  131. package/legacy/Gauge/GaugeReferenceArc.js +0 -37
  132. package/legacy/Gauge/GaugeValueArc.js +0 -44
  133. package/legacy/Gauge/GaugeValueText.js +0 -66
  134. package/legacy/Gauge/gaugeClasses.js +0 -7
  135. package/legacy/Gauge/index.js +0 -7
  136. package/legacy/Gauge/utils.js +0 -84
  137. package/legacy/LineChart/AnimatedArea.js +0 -102
  138. package/legacy/LineChart/AnimatedLine.js +0 -104
  139. package/legacy/LineChart/AreaElement.js +0 -112
  140. package/legacy/LineChart/AreaPlot.js +0 -149
  141. package/legacy/LineChart/LineChart.js +0 -452
  142. package/legacy/LineChart/LineElement.js +0 -112
  143. package/legacy/LineChart/LineHighlightElement.js +0 -79
  144. package/legacy/LineChart/LineHighlightPlot.js +0 -97
  145. package/legacy/LineChart/LinePlot.js +0 -144
  146. package/legacy/LineChart/MarkElement.js +0 -153
  147. package/legacy/LineChart/MarkPlot.js +0 -178
  148. package/legacy/LineChart/extremums.js +0 -54
  149. package/legacy/LineChart/formatter.js +0 -82
  150. package/legacy/LineChart/index.js +0 -11
  151. package/legacy/LineChart/legend.js +0 -15
  152. package/legacy/PieChart/PieArc.js +0 -103
  153. package/legacy/PieChart/PieArcLabel.js +0 -112
  154. package/legacy/PieChart/PieArcLabelPlot.js +0 -193
  155. package/legacy/PieChart/PieArcPlot.js +0 -180
  156. package/legacy/PieChart/PieChart.js +0 -404
  157. package/legacy/PieChart/PiePlot.js +0 -137
  158. package/legacy/PieChart/dataTransform/transition.js +0 -149
  159. package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
  160. package/legacy/PieChart/formatter.js +0 -55
  161. package/legacy/PieChart/index.js +0 -6
  162. package/legacy/PieChart/legend.js +0 -16
  163. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -185
  164. package/legacy/ResponsiveChartContainer/index.js +0 -1
  165. package/legacy/ResponsiveChartContainer/useChartContainerDimensions.js +0 -73
  166. package/legacy/ScatterChart/Scatter.js +0 -110
  167. package/legacy/ScatterChart/ScatterChart.js +0 -395
  168. package/legacy/ScatterChart/ScatterPlot.js +0 -80
  169. package/legacy/ScatterChart/extremums.js +0 -39
  170. package/legacy/ScatterChart/formatter.js +0 -12
  171. package/legacy/ScatterChart/index.js +0 -3
  172. package/legacy/ScatterChart/legend.js +0 -15
  173. package/legacy/SparkLineChart/SparkLineChart.js +0 -266
  174. package/legacy/SparkLineChart/index.js +0 -1
  175. package/legacy/colorPalettes/colorPalettes.js +0 -15
  176. package/legacy/colorPalettes/index.js +0 -1
  177. package/legacy/constants.js +0 -8
  178. package/legacy/context/CartesianContextProvider.js +0 -327
  179. package/legacy/context/DrawingProvider.js +0 -74
  180. package/legacy/context/HighlightProvider.js +0 -56
  181. package/legacy/context/InteractionProvider.js +0 -81
  182. package/legacy/context/SeriesContextProvider.js +0 -74
  183. package/legacy/context/index.js +0 -2
  184. package/legacy/hooks/index.js +0 -2
  185. package/legacy/hooks/useAxisEvents.js +0 -120
  186. package/legacy/hooks/useChartDimensions.js +0 -18
  187. package/legacy/hooks/useDrawingArea.js +0 -21
  188. package/legacy/hooks/useInteractionItemProps.js +0 -71
  189. package/legacy/hooks/useMounted.js +0 -21
  190. package/legacy/hooks/useReducedMotion.js +0 -27
  191. package/legacy/hooks/useScale.js +0 -33
  192. package/legacy/hooks/useTicks.js +0 -65
  193. package/legacy/index.js +0 -33
  194. package/legacy/internals/components/AxisSharedComponents.js +0 -25
  195. package/legacy/internals/defaultizeColor.js +0 -17
  196. package/legacy/internals/defaultizeValueFormatter.js +0 -12
  197. package/legacy/internals/domUtils.js +0 -121
  198. package/legacy/internals/geometry.js +0 -37
  199. package/legacy/internals/getCurve.js +0 -39
  200. package/legacy/internals/getScale.js +0 -17
  201. package/legacy/internals/getWordsByLines.js +0 -15
  202. package/legacy/internals/isBandScale.js +0 -3
  203. package/legacy/internals/stackSeries.js +0 -92
  204. package/legacy/internals/useAnimatedPath.js +0 -32
  205. package/legacy/internals/utils.js +0 -52
  206. package/legacy/models/axis.js +0 -6
  207. package/legacy/models/helpers.js +0 -1
  208. package/legacy/models/index.js +0 -4
  209. package/legacy/models/layout.js +0 -1
  210. package/legacy/models/seriesType/bar.js +0 -1
  211. package/legacy/models/seriesType/common.js +0 -1
  212. package/legacy/models/seriesType/config.js +0 -1
  213. package/legacy/models/seriesType/index.js +0 -5
  214. package/legacy/models/seriesType/line.js +0 -1
  215. package/legacy/models/seriesType/pie.js +0 -1
  216. package/legacy/models/seriesType/scatter.js +0 -1
  217. package/legacy/models/stacking.js +0 -1
  218. package/legacy/themeAugmentation/index.js +0 -3
@@ -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 };
@@ -1,119 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style", "onClick"];
4
- import * as React from 'react';
5
- import PropTypes from 'prop-types';
6
- import composeClasses from '@mui/utils/composeClasses';
7
- import { useSlotProps } from '@mui/base/utils';
8
- import generateUtilityClass from '@mui/utils/generateUtilityClass';
9
- import { styled } from '@mui/material/styles';
10
- import { color as d3Color } from 'd3-color';
11
- import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
12
- import { animated } from '@react-spring/web';
13
- import { getIsFaded, getIsHighlighted, useInteractionItemProps } from '../hooks/useInteractionItemProps';
14
- import { InteractionContext } from '../context/InteractionProvider';
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- export function getBarElementUtilityClass(slot) {
17
- return generateUtilityClass('MuiBarElement', slot);
18
- }
19
- export var barElementClasses = generateUtilityClasses('MuiBarElement', ['root']);
20
- var useUtilityClasses = function useUtilityClasses(ownerState) {
21
- var classes = ownerState.classes,
22
- id = ownerState.id;
23
- var slots = {
24
- root: ['root', "series-".concat(id)]
25
- };
26
- return composeClasses(slots, getBarElementUtilityClass, classes);
27
- };
28
- export var BarElementPath = styled(animated.rect, {
29
- name: 'MuiBarElement',
30
- slot: 'Root',
31
- overridesResolver: function overridesResolver(_, styles) {
32
- return styles.root;
33
- }
34
- })(function (_ref) {
35
- var ownerState = _ref.ownerState;
36
- return {
37
- stroke: 'none',
38
- shapeRendering: 'crispEdges',
39
- fill: ownerState.isHighlighted ? d3Color(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
40
- transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
41
- opacity: ownerState.isFaded && 0.3 || 1
42
- };
43
- });
44
- function BarElement(props) {
45
- var _slots$bar;
46
- var id = props.id,
47
- dataIndex = props.dataIndex,
48
- innerClasses = props.classes,
49
- color = props.color,
50
- highlightScope = props.highlightScope,
51
- slots = props.slots,
52
- slotProps = props.slotProps,
53
- style = props.style,
54
- onClick = props.onClick,
55
- other = _objectWithoutProperties(props, _excluded);
56
- var getInteractionItemProps = useInteractionItemProps(highlightScope);
57
- var _React$useContext = React.useContext(InteractionContext),
58
- item = _React$useContext.item;
59
- var isHighlighted = getIsHighlighted(item, {
60
- type: 'bar',
61
- seriesId: id,
62
- dataIndex: dataIndex
63
- }, highlightScope);
64
- var isFaded = !isHighlighted && getIsFaded(item, {
65
- type: 'bar',
66
- seriesId: id,
67
- dataIndex: dataIndex
68
- }, highlightScope);
69
- var ownerState = {
70
- id: id,
71
- dataIndex: dataIndex,
72
- classes: innerClasses,
73
- color: color,
74
- isFaded: isFaded,
75
- isHighlighted: isHighlighted
76
- };
77
- var classes = useUtilityClasses(ownerState);
78
- var Bar = (_slots$bar = slots == null ? void 0 : slots.bar) != null ? _slots$bar : BarElementPath;
79
- var barProps = useSlotProps({
80
- elementType: Bar,
81
- externalSlotProps: slotProps == null ? void 0 : slotProps.bar,
82
- additionalProps: _extends({}, other, getInteractionItemProps({
83
- type: 'bar',
84
- seriesId: id,
85
- dataIndex: dataIndex
86
- }), {
87
- style: style,
88
- className: classes.root,
89
- onClick: onClick,
90
- cursor: onClick ? 'pointer' : 'unset'
91
- }),
92
- ownerState: ownerState
93
- });
94
- return /*#__PURE__*/_jsx(Bar, _extends({}, barProps));
95
- }
96
- process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
97
- // ----------------------------- Warning --------------------------------
98
- // | These PropTypes are generated from the TypeScript type definitions |
99
- // | To update them edit the TypeScript types and run "yarn proptypes" |
100
- // ----------------------------------------------------------------------
101
- classes: PropTypes.object,
102
- dataIndex: PropTypes.number.isRequired,
103
- highlightScope: PropTypes.shape({
104
- faded: PropTypes.oneOf(['global', 'none', 'series']),
105
- highlighted: PropTypes.oneOf(['item', 'none', 'series'])
106
- }),
107
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
108
- /**
109
- * The props used for each component slot.
110
- * @default {}
111
- */
112
- slotProps: PropTypes.object,
113
- /**
114
- * Overridable component slots.
115
- * @default {}
116
- */
117
- slots: PropTypes.object
118
- } : void 0;
119
- export { BarElement };