@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,452 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- import * as React from 'react';
4
- import useId from '@mui/utils/useId';
5
- import PropTypes from 'prop-types';
6
- import { AreaPlot } from './AreaPlot';
7
- import { LinePlot } from './LinePlot';
8
- import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
9
- import { MarkPlot } from './MarkPlot';
10
- import { ChartsAxis } from '../ChartsAxis/ChartsAxis';
11
- import { DEFAULT_X_AXIS_KEY } from '../constants';
12
- import { ChartsTooltip } from '../ChartsTooltip';
13
- import { ChartsLegend } from '../ChartsLegend';
14
- import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
15
- import { ChartsClipPath } from '../ChartsClipPath';
16
- import { LineHighlightPlot } from './LineHighlightPlot';
17
- import { ChartsGrid } from '../ChartsGrid';
18
- import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
19
- import { jsx as _jsx } from "react/jsx-runtime";
20
- import { jsxs as _jsxs } from "react/jsx-runtime";
21
- /**
22
- * Demos:
23
- *
24
- * - [Lines](https://mui.com/x/react-charts/lines/)
25
- * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
26
- *
27
- * API:
28
- *
29
- * - [LineChart API](https://mui.com/x/api/charts/line-chart/)
30
- */
31
- var LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
32
- var xAxis = props.xAxis,
33
- yAxis = props.yAxis,
34
- series = props.series,
35
- width = props.width,
36
- height = props.height,
37
- margin = props.margin,
38
- colors = props.colors,
39
- dataset = props.dataset,
40
- sx = props.sx,
41
- tooltip = props.tooltip,
42
- onAxisClick = props.onAxisClick,
43
- onAreaClick = props.onAreaClick,
44
- onLineClick = props.onLineClick,
45
- onMarkClick = props.onMarkClick,
46
- _props$axisHighlight = props.axisHighlight,
47
- axisHighlight = _props$axisHighlight === void 0 ? {
48
- x: 'line'
49
- } : _props$axisHighlight,
50
- disableLineItemHighlight = props.disableLineItemHighlight,
51
- legend = props.legend,
52
- grid = props.grid,
53
- topAxis = props.topAxis,
54
- leftAxis = props.leftAxis,
55
- rightAxis = props.rightAxis,
56
- bottomAxis = props.bottomAxis,
57
- children = props.children,
58
- slots = props.slots,
59
- slotProps = props.slotProps,
60
- skipAnimation = props.skipAnimation;
61
- var id = useId();
62
- var clipPathId = "".concat(id, "-clip-path");
63
- return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
64
- ref: ref,
65
- series: series.map(function (s) {
66
- return _extends({
67
- disableHighlight: !!disableLineItemHighlight,
68
- type: 'line'
69
- }, s);
70
- }),
71
- width: width,
72
- height: height,
73
- margin: margin,
74
- xAxis: xAxis != null ? xAxis : [{
75
- id: DEFAULT_X_AXIS_KEY,
76
- scaleType: 'point',
77
- data: Array.from({
78
- length: Math.max.apply(Math, _toConsumableArray(series.map(function (s) {
79
- var _ref, _s$data;
80
- return ((_ref = (_s$data = s.data) != null ? _s$data : dataset) != null ? _ref : []).length;
81
- })))
82
- }, function (_, index) {
83
- return index;
84
- })
85
- }],
86
- yAxis: yAxis,
87
- colors: colors,
88
- dataset: dataset,
89
- sx: sx,
90
- disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none' && !onAxisClick,
91
- children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
92
- onAxisClick: onAxisClick
93
- }), grid && /*#__PURE__*/_jsx(ChartsGrid, {
94
- vertical: grid.vertical,
95
- horizontal: grid.horizontal
96
- }), /*#__PURE__*/_jsxs("g", {
97
- clipPath: "url(#".concat(clipPathId, ")"),
98
- children: [/*#__PURE__*/_jsx(AreaPlot, {
99
- slots: slots,
100
- slotProps: slotProps,
101
- onItemClick: onAreaClick,
102
- skipAnimation: skipAnimation
103
- }), /*#__PURE__*/_jsx(LinePlot, {
104
- slots: slots,
105
- slotProps: slotProps,
106
- onItemClick: onLineClick,
107
- skipAnimation: skipAnimation
108
- })]
109
- }), /*#__PURE__*/_jsx(ChartsAxis, {
110
- topAxis: topAxis,
111
- leftAxis: leftAxis,
112
- rightAxis: rightAxis,
113
- bottomAxis: bottomAxis,
114
- slots: slots,
115
- slotProps: slotProps
116
- }), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(MarkPlot, {
117
- slots: slots,
118
- slotProps: slotProps,
119
- onItemClick: onMarkClick,
120
- skipAnimation: skipAnimation
121
- }), /*#__PURE__*/_jsx(LineHighlightPlot, {
122
- slots: slots,
123
- slotProps: slotProps
124
- }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
125
- slots: slots,
126
- slotProps: slotProps
127
- })), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
128
- slots: slots,
129
- slotProps: slotProps
130
- })), /*#__PURE__*/_jsx(ChartsClipPath, {
131
- id: clipPathId
132
- }), children]
133
- });
134
- });
135
- process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
136
- // ----------------------------- Warning --------------------------------
137
- // | These PropTypes are generated from the TypeScript type definitions |
138
- // | To update them edit the TypeScript types and run "yarn proptypes" |
139
- // ----------------------------------------------------------------------
140
- /**
141
- * The configuration of axes highlight.
142
- * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
143
- * @default { x: 'line' }
144
- */
145
- axisHighlight: PropTypes.shape({
146
- x: PropTypes.oneOf(['band', 'line', 'none']),
147
- y: PropTypes.oneOf(['band', 'line', 'none'])
148
- }),
149
- /**
150
- * Indicate which axis to display the bottom of the charts.
151
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
152
- * @default xAxisIds[0] The id of the first provided axis
153
- */
154
- bottomAxis: PropTypes.oneOfType([PropTypes.shape({
155
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
156
- classes: PropTypes.object,
157
- disableLine: PropTypes.bool,
158
- disableTicks: PropTypes.bool,
159
- fill: PropTypes.string,
160
- label: PropTypes.string,
161
- labelFontSize: PropTypes.number,
162
- labelStyle: PropTypes.object,
163
- position: PropTypes.oneOf(['bottom', 'top']),
164
- slotProps: PropTypes.object,
165
- slots: PropTypes.object,
166
- stroke: PropTypes.string,
167
- tickFontSize: PropTypes.number,
168
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
169
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
170
- tickLabelStyle: PropTypes.object,
171
- tickMaxStep: PropTypes.number,
172
- tickMinStep: PropTypes.number,
173
- tickNumber: PropTypes.number,
174
- tickSize: PropTypes.number
175
- }), PropTypes.string]),
176
- children: PropTypes.node,
177
- className: PropTypes.string,
178
- /**
179
- * Color palette used to colorize multiple series.
180
- * @default blueberryTwilightPalette
181
- */
182
- colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
183
- /**
184
- * An array of objects that can be used to populate series and axes data using their `dataKey` property.
185
- */
186
- dataset: PropTypes.arrayOf(PropTypes.object),
187
- desc: PropTypes.string,
188
- /**
189
- * If `true`, the charts will not listen to the mouse move event.
190
- * It might break interactive features, but will improve performance.
191
- * @default false
192
- */
193
- disableAxisListener: PropTypes.bool,
194
- /**
195
- * If `true`, render the line highlight item.
196
- */
197
- disableLineItemHighlight: PropTypes.bool,
198
- /**
199
- * Option to display a cartesian grid in the background.
200
- */
201
- grid: PropTypes.shape({
202
- horizontal: PropTypes.bool,
203
- vertical: PropTypes.bool
204
- }),
205
- /**
206
- * The height of the chart in px. If not defined, it takes the height of the parent element.
207
- * @default undefined
208
- */
209
- height: PropTypes.number,
210
- /**
211
- * Indicate which axis to display the left of the charts.
212
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
213
- * @default yAxisIds[0] The id of the first provided axis
214
- */
215
- leftAxis: PropTypes.oneOfType([PropTypes.shape({
216
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
217
- classes: PropTypes.object,
218
- disableLine: PropTypes.bool,
219
- disableTicks: PropTypes.bool,
220
- fill: PropTypes.string,
221
- label: PropTypes.string,
222
- labelFontSize: PropTypes.number,
223
- labelStyle: PropTypes.object,
224
- position: PropTypes.oneOf(['left', 'right']),
225
- slotProps: PropTypes.object,
226
- slots: PropTypes.object,
227
- stroke: PropTypes.string,
228
- tickFontSize: PropTypes.number,
229
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
230
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
231
- tickLabelStyle: PropTypes.object,
232
- tickMaxStep: PropTypes.number,
233
- tickMinStep: PropTypes.number,
234
- tickNumber: PropTypes.number,
235
- tickSize: PropTypes.number
236
- }), PropTypes.string]),
237
- /**
238
- * @deprecated Consider using `slotProps.legend` instead.
239
- */
240
- legend: PropTypes.shape({
241
- classes: PropTypes.object,
242
- direction: PropTypes.oneOf(['column', 'row']),
243
- hidden: PropTypes.bool,
244
- position: PropTypes.shape({
245
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
246
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
247
- }),
248
- slotProps: PropTypes.object,
249
- slots: PropTypes.object
250
- }),
251
- /**
252
- * The margin between the SVG and the drawing area.
253
- * It's used for leaving some space for extra information such as the x- and y-axis or legend.
254
- * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
255
- * @default object Depends on the charts type.
256
- */
257
- margin: PropTypes.shape({
258
- bottom: PropTypes.number,
259
- left: PropTypes.number,
260
- right: PropTypes.number,
261
- top: PropTypes.number
262
- }),
263
- /**
264
- * Callback fired when an area element is clicked.
265
- */
266
- onAreaClick: PropTypes.func,
267
- /**
268
- * The function called for onClick events.
269
- * The second argument contains information about all line/bar elements at the current mouse position.
270
- * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
271
- * @param {null | AxisData} data The data about the clicked axis and items associated with it.
272
- */
273
- onAxisClick: PropTypes.func,
274
- /**
275
- * Callback fired when a line element is clicked.
276
- */
277
- onLineClick: PropTypes.func,
278
- /**
279
- * Callback fired when a mark element is clicked.
280
- */
281
- onMarkClick: PropTypes.func,
282
- /**
283
- * Indicate which axis to display the right of the charts.
284
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
285
- * @default null
286
- */
287
- rightAxis: PropTypes.oneOfType([PropTypes.shape({
288
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
289
- classes: PropTypes.object,
290
- disableLine: PropTypes.bool,
291
- disableTicks: PropTypes.bool,
292
- fill: PropTypes.string,
293
- label: PropTypes.string,
294
- labelFontSize: PropTypes.number,
295
- labelStyle: PropTypes.object,
296
- position: PropTypes.oneOf(['left', 'right']),
297
- slotProps: PropTypes.object,
298
- slots: PropTypes.object,
299
- stroke: PropTypes.string,
300
- tickFontSize: PropTypes.number,
301
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
302
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
303
- tickLabelStyle: PropTypes.object,
304
- tickMaxStep: PropTypes.number,
305
- tickMinStep: PropTypes.number,
306
- tickNumber: PropTypes.number,
307
- tickSize: PropTypes.number
308
- }), PropTypes.string]),
309
- /**
310
- * The series to display in the line chart.
311
- */
312
- series: PropTypes.arrayOf(PropTypes.object).isRequired,
313
- /**
314
- * If `true`, animations are skipped.
315
- * @default false
316
- */
317
- skipAnimation: PropTypes.bool,
318
- /**
319
- * The props used for each component slot.
320
- * @default {}
321
- */
322
- slotProps: PropTypes.object,
323
- /**
324
- * Overridable component slots.
325
- * @default {}
326
- */
327
- slots: PropTypes.object,
328
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
329
- title: PropTypes.string,
330
- /**
331
- * The configuration of the tooltip.
332
- * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
333
- * @default { trigger: 'item' }
334
- */
335
- tooltip: PropTypes.shape({
336
- axisContent: PropTypes.elementType,
337
- classes: PropTypes.object,
338
- itemContent: PropTypes.elementType,
339
- slotProps: PropTypes.object,
340
- slots: PropTypes.object,
341
- trigger: PropTypes.oneOf(['axis', 'item', 'none'])
342
- }),
343
- /**
344
- * Indicate which axis to display the top of the charts.
345
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
346
- * @default null
347
- */
348
- topAxis: PropTypes.oneOfType([PropTypes.shape({
349
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
350
- classes: PropTypes.object,
351
- disableLine: PropTypes.bool,
352
- disableTicks: PropTypes.bool,
353
- fill: PropTypes.string,
354
- label: PropTypes.string,
355
- labelFontSize: PropTypes.number,
356
- labelStyle: PropTypes.object,
357
- position: PropTypes.oneOf(['bottom', 'top']),
358
- slotProps: PropTypes.object,
359
- slots: PropTypes.object,
360
- stroke: PropTypes.string,
361
- tickFontSize: PropTypes.number,
362
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
363
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
364
- tickLabelStyle: PropTypes.object,
365
- tickMaxStep: PropTypes.number,
366
- tickMinStep: PropTypes.number,
367
- tickNumber: PropTypes.number,
368
- tickSize: PropTypes.number
369
- }), PropTypes.string]),
370
- viewBox: PropTypes.shape({
371
- height: PropTypes.number,
372
- width: PropTypes.number,
373
- x: PropTypes.number,
374
- y: PropTypes.number
375
- }),
376
- /**
377
- * The width of the chart in px. If not defined, it takes the width of the parent element.
378
- * @default undefined
379
- */
380
- width: PropTypes.number,
381
- /**
382
- * The configuration of the x-axes.
383
- * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
384
- */
385
- xAxis: PropTypes.arrayOf(PropTypes.shape({
386
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
387
- classes: PropTypes.object,
388
- data: PropTypes.array,
389
- dataKey: PropTypes.string,
390
- disableLine: PropTypes.bool,
391
- disableTicks: PropTypes.bool,
392
- fill: PropTypes.string,
393
- hideTooltip: PropTypes.bool,
394
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
395
- label: PropTypes.string,
396
- labelFontSize: PropTypes.number,
397
- labelStyle: PropTypes.object,
398
- max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
399
- min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
400
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
401
- reverse: PropTypes.bool,
402
- scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
403
- slotProps: PropTypes.object,
404
- slots: PropTypes.object,
405
- stroke: PropTypes.string,
406
- tickFontSize: PropTypes.number,
407
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
408
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
409
- tickLabelStyle: PropTypes.object,
410
- tickMaxStep: PropTypes.number,
411
- tickMinStep: PropTypes.number,
412
- tickNumber: PropTypes.number,
413
- tickSize: PropTypes.number,
414
- valueFormatter: PropTypes.func
415
- })),
416
- /**
417
- * The configuration of the y-axes.
418
- * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
419
- */
420
- yAxis: PropTypes.arrayOf(PropTypes.shape({
421
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
422
- classes: PropTypes.object,
423
- data: PropTypes.array,
424
- dataKey: PropTypes.string,
425
- disableLine: PropTypes.bool,
426
- disableTicks: PropTypes.bool,
427
- fill: PropTypes.string,
428
- hideTooltip: PropTypes.bool,
429
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
430
- label: PropTypes.string,
431
- labelFontSize: PropTypes.number,
432
- labelStyle: PropTypes.object,
433
- max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
434
- min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
435
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
436
- reverse: PropTypes.bool,
437
- scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
438
- slotProps: PropTypes.object,
439
- slots: PropTypes.object,
440
- stroke: PropTypes.string,
441
- tickFontSize: PropTypes.number,
442
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
443
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
444
- tickLabelStyle: PropTypes.object,
445
- tickMaxStep: PropTypes.number,
446
- tickMinStep: PropTypes.number,
447
- tickNumber: PropTypes.number,
448
- tickSize: PropTypes.number,
449
- valueFormatter: PropTypes.func
450
- }))
451
- } : void 0;
452
- export { LineChart };
@@ -1,112 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps", "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 generateUtilityClasses from '@mui/utils/generateUtilityClasses';
10
- import { InteractionContext } from '../context/InteractionProvider';
11
- import { getIsFaded, getIsHighlighted, useInteractionItemProps } from '../hooks/useInteractionItemProps';
12
- import { AnimatedLine } from './AnimatedLine';
13
- import { jsx as _jsx } from "react/jsx-runtime";
14
- export function getLineElementUtilityClass(slot) {
15
- return generateUtilityClass('MuiLineElement', slot);
16
- }
17
- export var lineElementClasses = generateUtilityClasses('MuiLineElement', ['root', 'highlighted', 'faded']);
18
- var useUtilityClasses = function useUtilityClasses(ownerState) {
19
- var classes = ownerState.classes,
20
- id = ownerState.id,
21
- isFaded = ownerState.isFaded,
22
- isHighlighted = ownerState.isHighlighted;
23
- var slots = {
24
- root: ['root', "series-".concat(id), isHighlighted && 'highlighted', isFaded && 'faded']
25
- };
26
- return composeClasses(slots, getLineElementUtilityClass, classes);
27
- };
28
- /**
29
- * Demos:
30
- *
31
- * - [Lines](https://mui.com/x/react-charts/lines/)
32
- * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
33
- *
34
- * API:
35
- *
36
- * - [LineElement API](https://mui.com/x/api/charts/line-element/)
37
- */
38
- function LineElement(props) {
39
- var _slots$line;
40
- var id = props.id,
41
- innerClasses = props.classes,
42
- color = props.color,
43
- highlightScope = props.highlightScope,
44
- slots = props.slots,
45
- slotProps = props.slotProps,
46
- onClick = props.onClick,
47
- other = _objectWithoutProperties(props, _excluded);
48
- var getInteractionItemProps = useInteractionItemProps(highlightScope);
49
- var _React$useContext = React.useContext(InteractionContext),
50
- item = _React$useContext.item;
51
- var isHighlighted = getIsHighlighted(item, {
52
- type: 'line',
53
- seriesId: id
54
- }, highlightScope);
55
- var isFaded = !isHighlighted && getIsFaded(item, {
56
- type: 'line',
57
- seriesId: id
58
- }, highlightScope);
59
- var ownerState = {
60
- id: id,
61
- classes: innerClasses,
62
- color: color,
63
- isFaded: isFaded,
64
- isHighlighted: isHighlighted
65
- };
66
- var classes = useUtilityClasses(ownerState);
67
- var Line = (_slots$line = slots == null ? void 0 : slots.line) != null ? _slots$line : AnimatedLine;
68
- var lineProps = useSlotProps({
69
- elementType: Line,
70
- externalSlotProps: slotProps == null ? void 0 : slotProps.line,
71
- additionalProps: _extends({}, other, getInteractionItemProps({
72
- type: 'line',
73
- seriesId: id
74
- }), {
75
- className: classes.root,
76
- onClick: onClick,
77
- cursor: onClick ? 'pointer' : 'unset'
78
- }),
79
- ownerState: ownerState
80
- });
81
- return /*#__PURE__*/_jsx(Line, _extends({}, lineProps));
82
- }
83
- process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
84
- // ----------------------------- Warning --------------------------------
85
- // | These PropTypes are generated from the TypeScript type definitions |
86
- // | To update them edit the TypeScript types and run "yarn proptypes" |
87
- // ----------------------------------------------------------------------
88
- classes: PropTypes.object,
89
- color: PropTypes.string.isRequired,
90
- d: PropTypes.string.isRequired,
91
- highlightScope: PropTypes.shape({
92
- faded: PropTypes.oneOf(['global', 'none', 'series']),
93
- highlighted: PropTypes.oneOf(['item', 'none', 'series'])
94
- }),
95
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
96
- /**
97
- * If `true`, animations are skipped.
98
- * @default false
99
- */
100
- skipAnimation: PropTypes.bool,
101
- /**
102
- * The props used for each component slot.
103
- * @default {}
104
- */
105
- slotProps: PropTypes.object,
106
- /**
107
- * Overridable component slots.
108
- * @default {}
109
- */
110
- slots: PropTypes.object
111
- } : void 0;
112
- export { LineElement };
@@ -1,79 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["x", "y", "id", "classes", "color"];
4
- import * as React from 'react';
5
- import PropTypes from 'prop-types';
6
- import composeClasses from '@mui/utils/composeClasses';
7
- import generateUtilityClass from '@mui/utils/generateUtilityClass';
8
- import { styled } from '@mui/material/styles';
9
- import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- export function getHighlightElementUtilityClass(slot) {
12
- return generateUtilityClass('MuiHighlightElement', slot);
13
- }
14
- export var lineHighlightElementClasses = generateUtilityClasses('MuiHighlightElement', ['root']);
15
- var useUtilityClasses = function useUtilityClasses(ownerState) {
16
- var classes = ownerState.classes,
17
- id = ownerState.id;
18
- var slots = {
19
- root: ['root', "series-".concat(id)]
20
- };
21
- return composeClasses(slots, getHighlightElementUtilityClass, classes);
22
- };
23
- var HighlightElement = styled('circle', {
24
- name: 'MuiHighlightElement',
25
- slot: 'Root',
26
- overridesResolver: function overridesResolver(_, styles) {
27
- return styles.root;
28
- }
29
- })(function (_ref) {
30
- var ownerState = _ref.ownerState;
31
- return {
32
- transform: "translate(".concat(ownerState.x, "px, ").concat(ownerState.y, "px)"),
33
- transformOrigin: "".concat(ownerState.x, "px ").concat(ownerState.y, "px"),
34
- fill: ownerState.color
35
- };
36
- });
37
- /**
38
- * Demos:
39
- *
40
- * - [Lines](https://mui.com/x/react-charts/lines/)
41
- * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
42
- *
43
- * API:
44
- *
45
- * - [LineHighlightElement API](https://mui.com/x/api/charts/line-highlight-element/)
46
- */
47
- function LineHighlightElement(props) {
48
- var x = props.x,
49
- y = props.y,
50
- id = props.id,
51
- innerClasses = props.classes,
52
- color = props.color,
53
- other = _objectWithoutProperties(props, _excluded);
54
- var ownerState = {
55
- id: id,
56
- classes: innerClasses,
57
- color: color,
58
- x: x,
59
- y: y
60
- };
61
- var classes = useUtilityClasses(ownerState);
62
- return /*#__PURE__*/_jsx(HighlightElement, _extends({
63
- pointerEvents: "none",
64
- ownerState: ownerState,
65
- className: classes.root,
66
- cx: 0,
67
- cy: 0,
68
- r: other.r === undefined ? 5 : other.r
69
- }, other));
70
- }
71
- process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
72
- // ----------------------------- Warning --------------------------------
73
- // | These PropTypes are generated from the TypeScript type definitions |
74
- // | To update them edit the TypeScript types and run "yarn proptypes" |
75
- // ----------------------------------------------------------------------
76
- classes: PropTypes.object,
77
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
78
- } : void 0;
79
- export { LineHighlightElement };