@mui/x-charts 6.19.1 → 6.19.3

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 (109) hide show
  1. package/BarChart/BarChart.js +1 -0
  2. package/BarChart/BarElement.d.ts +37 -20
  3. package/CHANGELOG.md +84 -0
  4. package/ChartsLegend/ChartsLegend.d.ts +5 -2
  5. package/ChartsLegend/ChartsLegend.js +137 -1
  6. package/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
  7. package/ChartsSurface.d.ts +2 -2
  8. package/ChartsSurface.js +33 -1
  9. package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  10. package/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  11. package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
  12. package/ChartsTooltip/ChartsTooltipTable.js +2 -0
  13. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  14. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
  15. package/LineChart/LineChart.d.ts +1 -0
  16. package/LineChart/LineChart.js +2 -0
  17. package/PieChart/PieArcLabelPlot.d.ts +5 -0
  18. package/PieChart/PieArcLabelPlot.js +2 -0
  19. package/PieChart/PieArcPlot.d.ts +5 -0
  20. package/PieChart/PieArcPlot.js +1 -0
  21. package/PieChart/PieChart.d.ts +14 -2
  22. package/PieChart/PieChart.js +3 -2
  23. package/ScatterChart/ScatterChart.js +1 -0
  24. package/SparkLineChart/SparkLineChart.d.ts +15 -1
  25. package/SparkLineChart/SparkLineChart.js +8 -1
  26. package/context/CartesianContextProvider.d.ts +1 -1
  27. package/context/CartesianContextProvider.js +7 -6
  28. package/context/DrawingProvider.d.ts +1 -1
  29. package/context/DrawingProvider.js +8 -7
  30. package/context/HighlightProvider.d.ts +2 -2
  31. package/context/HighlightProvider.js +4 -3
  32. package/context/InteractionProvider.d.ts +2 -2
  33. package/context/InteractionProvider.js +4 -3
  34. package/context/SeriesContextProvider.d.ts +3 -1
  35. package/context/SeriesContextProvider.js +7 -6
  36. package/esm/BarChart/BarChart.js +1 -0
  37. package/esm/ChartsLegend/ChartsLegend.js +139 -2
  38. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
  39. package/esm/ChartsSurface.js +35 -2
  40. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  41. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  42. package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
  43. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  44. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
  45. package/esm/LineChart/LineChart.js +2 -0
  46. package/esm/PieChart/PieArcLabelPlot.js +2 -0
  47. package/esm/PieChart/PieArcPlot.js +1 -0
  48. package/esm/PieChart/PieChart.js +3 -2
  49. package/esm/ScatterChart/ScatterChart.js +1 -0
  50. package/esm/SparkLineChart/SparkLineChart.js +8 -1
  51. package/esm/context/CartesianContextProvider.js +7 -6
  52. package/esm/context/DrawingProvider.js +8 -7
  53. package/esm/context/HighlightProvider.js +6 -4
  54. package/esm/context/InteractionProvider.js +6 -4
  55. package/esm/context/SeriesContextProvider.js +9 -7
  56. package/esm/hooks/useDrawingArea.js +7 -3
  57. package/esm/index.js +2 -0
  58. package/hooks/useDrawingArea.d.ts +2 -0
  59. package/hooks/useDrawingArea.js +7 -3
  60. package/index.d.ts +2 -0
  61. package/index.js +23 -1
  62. package/legacy/BarChart/BarChart.js +1 -0
  63. package/legacy/ChartsLegend/ChartsLegend.js +139 -2
  64. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +5 -3
  65. package/legacy/ChartsReferenceLine/common.js +3 -4
  66. package/legacy/ChartsSurface.js +35 -2
  67. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  68. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  69. package/legacy/ChartsTooltip/ChartsTooltipTable.js +8 -7
  70. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  71. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
  72. package/legacy/LineChart/LineChart.js +2 -0
  73. package/legacy/PieChart/PieArcLabelPlot.js +2 -0
  74. package/legacy/PieChart/PieArcPlot.js +1 -0
  75. package/legacy/PieChart/PieChart.js +3 -2
  76. package/legacy/ScatterChart/ScatterChart.js +1 -0
  77. package/legacy/SparkLineChart/SparkLineChart.js +8 -1
  78. package/legacy/context/CartesianContextProvider.js +15 -15
  79. package/legacy/context/DrawingProvider.js +6 -6
  80. package/legacy/context/HighlightProvider.js +4 -3
  81. package/legacy/context/InteractionProvider.js +4 -3
  82. package/legacy/context/SeriesContextProvider.js +8 -7
  83. package/legacy/hooks/useDrawingArea.js +7 -3
  84. package/legacy/index.js +3 -1
  85. package/legacy/internals/components/AxisSharedComponents.js +5 -6
  86. package/models/seriesType/pie.d.ts +1 -0
  87. package/modern/BarChart/BarChart.js +1 -0
  88. package/modern/ChartsLegend/ChartsLegend.js +139 -2
  89. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
  90. package/modern/ChartsSurface.js +35 -2
  91. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  92. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  93. package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
  94. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  95. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
  96. package/modern/LineChart/LineChart.js +2 -0
  97. package/modern/PieChart/PieArcLabelPlot.js +2 -0
  98. package/modern/PieChart/PieArcPlot.js +1 -0
  99. package/modern/PieChart/PieChart.js +3 -2
  100. package/modern/ScatterChart/ScatterChart.js +1 -0
  101. package/modern/SparkLineChart/SparkLineChart.js +8 -1
  102. package/modern/context/CartesianContextProvider.js +7 -6
  103. package/modern/context/DrawingProvider.js +8 -7
  104. package/modern/context/HighlightProvider.js +6 -4
  105. package/modern/context/InteractionProvider.js +6 -4
  106. package/modern/context/SeriesContextProvider.js +9 -7
  107. package/modern/hooks/useDrawingArea.js +7 -3
  108. package/modern/index.js +3 -1
  109. package/package.json +1 -1
@@ -78,7 +78,21 @@ process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propType
78
78
  */
79
79
  series: PropTypes.shape({
80
80
  color: PropTypes.string,
81
- data: PropTypes.arrayOf(PropTypes.number).isRequired,
81
+ data: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.shape({
82
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
83
+ x: PropTypes.number.isRequired,
84
+ y: PropTypes.number.isRequired
85
+ })), PropTypes.arrayOf(PropTypes.shape({
86
+ color: PropTypes.string.isRequired,
87
+ endAngle: PropTypes.number.isRequired,
88
+ formattedValue: PropTypes.string.isRequired,
89
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
90
+ index: PropTypes.number.isRequired,
91
+ label: PropTypes.string,
92
+ padAngle: PropTypes.number.isRequired,
93
+ startAngle: PropTypes.number.isRequired,
94
+ value: PropTypes.number.isRequired
95
+ }))]).isRequired,
82
96
  highlightScope: PropTypes.shape({
83
97
  faded: PropTypes.oneOf(['global', 'none', 'series']),
84
98
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
@@ -117,6 +117,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
117
117
  * - 'none': display nothing.
118
118
  * - 'line': display a line at the current mouse position.
119
119
  * - 'band': display a band at the current mouse position. Only available with band scale.
120
+ * @default { x: 'line' }
120
121
  */
121
122
  axisHighlight: PropTypes.shape({
122
123
  x: PropTypes.oneOf(['band', 'line', 'none']),
@@ -153,6 +154,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
153
154
  className: PropTypes.string,
154
155
  /**
155
156
  * Color palette used to colorize multiple series.
157
+ * @default blueberryTwilightPalette
156
158
  */
157
159
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
158
160
  /**
@@ -104,6 +104,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
104
104
  arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
105
105
  /**
106
106
  * The minimal angle required to display the arc label.
107
+ * @default 0
107
108
  */
108
109
  arcLabelMinAngle: PropTypes.number,
109
110
  /**
@@ -129,6 +130,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
129
130
  })).isRequired,
130
131
  /**
131
132
  * Override the arc attibutes when it is faded.
133
+ * @default { additionalRadius: -5 }
132
134
  */
133
135
  faded: PropTypes.shape({
134
136
  additionalRadius: PropTypes.number,
@@ -110,6 +110,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
110
110
  })).isRequired,
111
111
  /**
112
112
  * Override the arc attibutes when it is faded.
113
+ * @default { additionalRadius: -5 }
113
114
  */
114
115
  faded: PropTypes.shape({
115
116
  additionalRadius: PropTypes.number,
@@ -108,7 +108,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
108
108
  /**
109
109
  * Indicate which axis to display the bottom of the charts.
110
110
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
111
- * @default xAxisIds[0] The id of the first provided axis
111
+ * @default null
112
112
  */
113
113
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
114
114
  axisId: PropTypes.string,
@@ -136,6 +136,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
136
136
  className: PropTypes.string,
137
137
  /**
138
138
  * Color palette used to colorize multiple series.
139
+ * @default blueberryTwilightPalette
139
140
  */
140
141
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
141
142
  /**
@@ -157,7 +158,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
157
158
  /**
158
159
  * Indicate which axis to display the left of the charts.
159
160
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
160
- * @default yAxisIds[0] The id of the first provided axis
161
+ * @default null
161
162
  */
162
163
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
163
164
  axisId: PropTypes.string,
@@ -113,6 +113,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
113
113
  className: PropTypes.string,
114
114
  /**
115
115
  * Color palette used to colorize multiple series.
116
+ * @default blueberryTwilightPalette
116
117
  */
117
118
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
118
119
  /**
@@ -119,6 +119,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
119
119
  className: PropTypes.string,
120
120
  /**
121
121
  * Color palette used to colorize multiple series.
122
+ * @default blueberryTwilightPalette
122
123
  */
123
124
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
124
125
  /**
@@ -149,7 +150,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
149
150
  * The margin between the SVG and the drawing area.
150
151
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
151
152
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
152
- * @default object Depends on the charts type.
153
+ * @default {
154
+ * top: 5,
155
+ * bottom: 5,
156
+ * left: 5,
157
+ * right: 5,
158
+ * }
153
159
  */
154
160
  margin: PropTypes.shape({
155
161
  bottom: PropTypes.number,
@@ -198,6 +204,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
198
204
  * Formatter used by the tooltip.
199
205
  * @param {number} value The value to format.
200
206
  * @returns {string} the formatted value.
207
+ * @default (v: number) => v.toString()
201
208
  */
202
209
  valueFormatter: PropTypes.func,
203
210
  viewBox: PropTypes.shape({
@@ -38,12 +38,13 @@ export const CartesianContext = /*#__PURE__*/React.createContext({
38
38
  *
39
39
  * - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
40
40
  */
41
- function CartesianContextProvider({
42
- xAxis: inXAxis,
43
- yAxis: inYAxis,
44
- dataset,
45
- children
46
- }) {
41
+ function CartesianContextProvider(props) {
42
+ const {
43
+ xAxis: inXAxis,
44
+ yAxis: inYAxis,
45
+ dataset,
46
+ children
47
+ } = props;
47
48
  const formattedSeries = React.useContext(SeriesContext);
48
49
  const drawingArea = React.useContext(DrawingContext);
49
50
  const xAxis = React.useMemo(() => inXAxis?.map(axisConfig => {
@@ -23,13 +23,14 @@ export const SVGContext = /*#__PURE__*/React.createContext({
23
23
  *
24
24
  * - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
25
25
  */
26
- function DrawingProvider({
27
- width,
28
- height,
29
- margin,
30
- svgRef,
31
- children
32
- }) {
26
+ function DrawingProvider(props) {
27
+ const {
28
+ width,
29
+ height,
30
+ margin,
31
+ svgRef,
32
+ children
33
+ } = props;
33
34
  const drawingArea = useChartDimensions(width, height, margin);
34
35
  return /*#__PURE__*/_jsx(SVGContext.Provider, {
35
36
  value: svgRef,
@@ -29,9 +29,10 @@ const dataReducer = (prevState, action) => {
29
29
  return prevState;
30
30
  }
31
31
  };
32
- export function HighlightProvider({
33
- children
34
- }) {
32
+ function HighlightProvider(props) {
33
+ const {
34
+ children
35
+ } = props;
35
36
  const [data, dispatch] = React.useReducer(dataReducer, {
36
37
  item: null,
37
38
  scope: defaultScope
@@ -43,4 +44,5 @@ export function HighlightProvider({
43
44
  value: value,
44
45
  children: children
45
46
  });
46
- }
47
+ }
48
+ export { HighlightProvider };
@@ -31,9 +31,10 @@ const dataReducer = (prevState, action) => {
31
31
  return prevState;
32
32
  }
33
33
  };
34
- export function InteractionProvider({
35
- children
36
- }) {
34
+ function InteractionProvider(props) {
35
+ const {
36
+ children
37
+ } = props;
37
38
  const [data, dispatch] = React.useReducer(dataReducer, {
38
39
  item: null,
39
40
  axis: {
@@ -48,4 +49,5 @@ export function InteractionProvider({
48
49
  value: value,
49
50
  children: children
50
51
  });
51
- }
52
+ }
53
+ export { InteractionProvider };
@@ -55,16 +55,18 @@ const formatSeries = (series, colors, dataset) => {
55
55
  });
56
56
  return formattedSeries;
57
57
  };
58
- export function SeriesContextProvider({
59
- series,
60
- dataset,
61
- colors = blueberryTwilightPalette,
62
- children
63
- }) {
58
+ function SeriesContextProvider(props) {
59
+ const {
60
+ series,
61
+ dataset,
62
+ colors = blueberryTwilightPalette,
63
+ children
64
+ } = props;
64
65
  const theme = useTheme();
65
66
  const formattedSeries = React.useMemo(() => formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset), [series, colors, theme.palette.mode, dataset]);
66
67
  return /*#__PURE__*/_jsx(SeriesContext.Provider, {
67
68
  value: formattedSeries,
68
69
  children: children
69
70
  });
70
- }
71
+ }
72
+ export { SeriesContextProvider };
@@ -5,12 +5,16 @@ export function useDrawingArea() {
5
5
  left,
6
6
  top,
7
7
  width,
8
- height
8
+ height,
9
+ bottom,
10
+ right
9
11
  } = React.useContext(DrawingContext);
10
12
  return React.useMemo(() => ({
11
13
  left,
12
14
  top,
13
15
  width,
14
- height
15
- }), [height, left, top, width]);
16
+ height,
17
+ bottom,
18
+ right
19
+ }), [height, left, top, width, bottom, right]);
16
20
  }
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v6.19.1
2
+ * @mui/x-charts v6.19.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -24,4 +24,6 @@ export * from './PieChart';
24
24
  export * from './ScatterChart';
25
25
  export * from './SparkLineChart';
26
26
  export * from './ChartContainer';
27
+ export * from './ChartsSurface';
28
+ export * from './ChartsLegend';
27
29
  export * from './ResponsiveChartContainer';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "6.19.1",
3
+ "version": "6.19.3",
4
4
  "description": "The community edition of the charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",