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

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