@mui/x-charts 9.0.1 → 9.0.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 (206) hide show
  1. package/BarChart/BarChart.js +29 -10
  2. package/BarChart/BarChart.mjs +29 -10
  3. package/BarChart/BarElement.js +1 -5
  4. package/BarChart/BarElement.mjs +1 -5
  5. package/BarChart/BarPlot.js +2 -1
  6. package/BarChart/BarPlot.mjs +2 -1
  7. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.mts +8 -7
  8. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +8 -7
  9. package/BarChart/seriesConfig/bar/seriesProcessor.js +37 -13
  10. package/BarChart/seriesConfig/bar/seriesProcessor.mjs +37 -13
  11. package/CHANGELOG.md +257 -0
  12. package/ChartsContainer/ChartsContainer.js +59 -30
  13. package/ChartsContainer/ChartsContainer.mjs +59 -30
  14. package/ChartsDataProvider/useChartsDataProviderProps.js +1 -6
  15. package/ChartsDataProvider/useChartsDataProviderProps.mjs +1 -6
  16. package/ChartsGrid/styledComponents.js +2 -2
  17. package/ChartsGrid/styledComponents.mjs +2 -2
  18. package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.mts +38 -0
  19. package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.ts +38 -0
  20. package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +115 -0
  21. package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +109 -0
  22. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.d.mts +9 -0
  23. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.d.ts +9 -0
  24. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.js +13 -0
  25. package/ChartsRadialDataProvider/ChartsRadialDataProvider.plugins.mjs +7 -0
  26. package/ChartsRadialDataProvider/index.d.mts +2 -0
  27. package/ChartsRadialDataProvider/index.d.ts +2 -0
  28. package/ChartsRadialDataProvider/index.js +27 -0
  29. package/ChartsRadialDataProvider/index.mjs +2 -0
  30. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.d.mts +13 -0
  31. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.d.ts +13 -0
  32. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.js +46 -0
  33. package/ChartsRadialDataProvider/useChartsRadialDataProviderProps.mjs +39 -0
  34. package/ChartsRadialGrid/ChartsRadialGrid.d.mts +33 -0
  35. package/ChartsRadialGrid/ChartsRadialGrid.d.ts +33 -0
  36. package/ChartsRadialGrid/ChartsRadialGrid.js +101 -0
  37. package/ChartsRadialGrid/ChartsRadialGrid.mjs +96 -0
  38. package/ChartsRadialGrid/ChartsRadiusGrid.d.mts +14 -0
  39. package/ChartsRadialGrid/ChartsRadiusGrid.d.ts +14 -0
  40. package/ChartsRadialGrid/ChartsRadiusGrid.js +72 -0
  41. package/ChartsRadialGrid/ChartsRadiusGrid.mjs +65 -0
  42. package/ChartsRadialGrid/ChartsRotationGrid.d.mts +13 -0
  43. package/ChartsRadialGrid/ChartsRotationGrid.d.ts +13 -0
  44. package/ChartsRadialGrid/ChartsRotationGrid.js +65 -0
  45. package/ChartsRadialGrid/ChartsRotationGrid.mjs +58 -0
  46. package/ChartsRadialGrid/chartsRadialGridClasses.d.mts +13 -0
  47. package/ChartsRadialGrid/chartsRadialGridClasses.d.ts +13 -0
  48. package/ChartsRadialGrid/chartsRadialGridClasses.js +14 -0
  49. package/ChartsRadialGrid/chartsRadialGridClasses.mjs +6 -0
  50. package/ChartsRadialGrid/index.d.mts +3 -0
  51. package/ChartsRadialGrid/index.d.ts +3 -0
  52. package/ChartsRadialGrid/index.js +19 -0
  53. package/ChartsRadialGrid/index.mjs +2 -0
  54. package/ChartsRadialGrid/styledComponents.d.mts +4 -0
  55. package/ChartsRadialGrid/styledComponents.d.ts +4 -0
  56. package/ChartsRadialGrid/styledComponents.js +50 -0
  57. package/ChartsRadialGrid/styledComponents.mjs +44 -0
  58. package/ChartsRadiusAxis/ChartsRadiusAxis.d.mts +48 -0
  59. package/ChartsRadiusAxis/ChartsRadiusAxis.d.ts +48 -0
  60. package/ChartsRadiusAxis/ChartsRadiusAxis.js +147 -0
  61. package/ChartsRadiusAxis/ChartsRadiusAxis.mjs +141 -0
  62. package/ChartsRadiusAxis/chartsRadiusAxisClasses.d.mts +6 -0
  63. package/ChartsRadiusAxis/chartsRadiusAxisClasses.d.ts +6 -0
  64. package/ChartsRadiusAxis/chartsRadiusAxisClasses.js +30 -0
  65. package/ChartsRadiusAxis/chartsRadiusAxisClasses.mjs +17 -0
  66. package/ChartsRadiusAxis/createGetLabelTextAnchors.d.mts +10 -0
  67. package/ChartsRadiusAxis/createGetLabelTextAnchors.d.ts +10 -0
  68. package/ChartsRadiusAxis/createGetLabelTextAnchors.js +46 -0
  69. package/ChartsRadiusAxis/createGetLabelTextAnchors.mjs +39 -0
  70. package/ChartsRadiusAxis/getLabelTransform.d.mts +11 -0
  71. package/ChartsRadiusAxis/getLabelTransform.d.ts +11 -0
  72. package/ChartsRadiusAxis/getLabelTransform.js +37 -0
  73. package/ChartsRadiusAxis/getLabelTransform.mjs +31 -0
  74. package/ChartsRadiusAxis/index.d.mts +3 -0
  75. package/ChartsRadiusAxis/index.d.ts +3 -0
  76. package/ChartsRadiusAxis/index.js +19 -0
  77. package/ChartsRadiusAxis/index.mjs +2 -0
  78. package/ChartsRadiusAxis/sharedRadialAxisClasses.d.mts +21 -0
  79. package/ChartsRadiusAxis/sharedRadialAxisClasses.d.ts +21 -0
  80. package/ChartsRadiusAxis/sharedRadialAxisClasses.js +14 -0
  81. package/ChartsRadiusAxis/sharedRadialAxisClasses.mjs +6 -0
  82. package/ChartsRotationAxis/ChartsRotationAxis.d.mts +48 -0
  83. package/ChartsRotationAxis/ChartsRotationAxis.d.ts +48 -0
  84. package/ChartsRotationAxis/ChartsRotationAxis.js +141 -0
  85. package/ChartsRotationAxis/ChartsRotationAxis.mjs +135 -0
  86. package/ChartsRotationAxis/chartsRotationAxisClasses.d.mts +5 -0
  87. package/ChartsRotationAxis/chartsRotationAxisClasses.d.ts +5 -0
  88. package/ChartsRotationAxis/chartsRotationAxisClasses.js +29 -0
  89. package/ChartsRotationAxis/chartsRotationAxisClasses.mjs +16 -0
  90. package/ChartsRotationAxis/getLabelTransform.d.mts +11 -0
  91. package/ChartsRotationAxis/getLabelTransform.d.ts +11 -0
  92. package/ChartsRotationAxis/getLabelTransform.js +37 -0
  93. package/ChartsRotationAxis/getLabelTransform.mjs +31 -0
  94. package/ChartsRotationAxis/index.d.mts +2 -0
  95. package/ChartsRotationAxis/index.d.ts +2 -0
  96. package/ChartsRotationAxis/index.js +19 -0
  97. package/ChartsRotationAxis/index.mjs +2 -0
  98. package/ChartsTooltip/useAxesTooltip.js +7 -4
  99. package/ChartsTooltip/useAxesTooltip.mjs +8 -5
  100. package/ChartsTooltip/useItemTooltip.d.mts +1 -1
  101. package/ChartsTooltip/useItemTooltip.d.ts +1 -1
  102. package/ChartsTooltip/useItemTooltip.js +17 -2
  103. package/ChartsTooltip/useItemTooltip.mjs +18 -3
  104. package/ChartsXAxis/useAxisTicksProps.d.mts +652 -490
  105. package/ChartsXAxis/useAxisTicksProps.d.ts +652 -490
  106. package/ChartsYAxis/useAxisTicksProps.d.mts +652 -490
  107. package/ChartsYAxis/useAxisTicksProps.d.ts +652 -490
  108. package/LineChart/LineChart.js +27 -9
  109. package/LineChart/LineChart.mjs +27 -9
  110. package/LineChart/seriesConfig/curveEvaluation.js +24 -19
  111. package/LineChart/seriesConfig/curveEvaluation.mjs +24 -19
  112. package/LineChart/seriesConfig/getItemAtPosition.js +14 -3
  113. package/LineChart/seriesConfig/getItemAtPosition.mjs +14 -3
  114. package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +4 -6
  115. package/LineChart/seriesConfig/getSeriesWithDefaultValues.mjs +4 -6
  116. package/LineChart/seriesConfig/seriesProcessor.d.mts +4 -2
  117. package/LineChart/seriesConfig/seriesProcessor.d.ts +4 -2
  118. package/LineChart/seriesConfig/seriesProcessor.js +39 -15
  119. package/LineChart/seriesConfig/seriesProcessor.mjs +39 -15
  120. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.mts +2 -2
  121. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
  122. package/ScatterChart/Scatter.d.mts +11 -0
  123. package/ScatterChart/Scatter.d.ts +11 -0
  124. package/ScatterChart/Scatter.js +11 -0
  125. package/ScatterChart/Scatter.mjs +14 -0
  126. package/ScatterChart/ScatterChart.js +29 -10
  127. package/ScatterChart/ScatterChart.mjs +29 -10
  128. package/ScatterChart/seriesConfig/seriesProcessor.js +9 -4
  129. package/ScatterChart/seriesConfig/seriesProcessor.mjs +9 -4
  130. package/SparkLineChart/SparkLineChart.js +27 -9
  131. package/SparkLineChart/SparkLineChart.mjs +27 -9
  132. package/hooks/useAxis.d.mts +2 -2
  133. package/hooks/useAxis.d.ts +2 -2
  134. package/hooks/useTicks.d.mts +1 -1
  135. package/hooks/useTicks.d.ts +1 -1
  136. package/hooks/useTicks.js +21 -3
  137. package/hooks/useTicks.mjs +21 -3
  138. package/index.d.mts +4 -0
  139. package/index.d.ts +4 -0
  140. package/index.js +46 -2
  141. package/index.mjs +5 -1
  142. package/internals/cubiqSolver.d.mts +5 -0
  143. package/internals/cubiqSolver.d.ts +5 -0
  144. package/internals/cubiqSolver.js +62 -0
  145. package/internals/cubiqSolver.mjs +56 -0
  146. package/internals/index.d.mts +5 -1
  147. package/internals/index.d.ts +5 -1
  148. package/internals/index.js +47 -2
  149. package/internals/index.mjs +5 -1
  150. package/internals/isPolar.d.mts +3 -2
  151. package/internals/isPolar.d.ts +3 -2
  152. package/internals/isPolar.js +4 -0
  153. package/internals/isPolar.mjs +3 -0
  154. package/internals/material/index.js +6 -1
  155. package/internals/material/index.mjs +6 -1
  156. package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.mts +8 -9
  157. package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.ts +8 -9
  158. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +8 -12
  159. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +8 -12
  160. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +1 -0
  161. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +1 -0
  162. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.mts +3 -2
  163. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +3 -2
  164. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +29 -16
  165. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +30 -17
  166. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.js +3 -3
  167. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.mjs +3 -3
  168. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.mts +2 -2
  169. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -2
  170. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +3 -3
  171. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +3 -3
  172. package/models/axis.d.mts +13 -2
  173. package/models/axis.d.ts +13 -2
  174. package/models/seriesType/bar.d.mts +21 -7
  175. package/models/seriesType/bar.d.ts +21 -7
  176. package/models/seriesType/common.d.mts +10 -0
  177. package/models/seriesType/common.d.ts +10 -0
  178. package/models/seriesType/composition.d.mts +3 -1
  179. package/models/seriesType/composition.d.ts +3 -1
  180. package/models/seriesType/composition.js +6 -2
  181. package/models/seriesType/composition.mjs +5 -1
  182. package/models/seriesType/index.d.mts +3 -3
  183. package/models/seriesType/index.d.ts +3 -3
  184. package/models/seriesType/index.js +0 -22
  185. package/models/seriesType/index.mjs +0 -2
  186. package/models/seriesType/line.d.mts +22 -8
  187. package/models/seriesType/line.d.ts +22 -8
  188. package/models/seriesType/scatter.d.mts +9 -0
  189. package/models/seriesType/scatter.d.ts +9 -0
  190. package/models/slots/chartsBaseSlotProps.d.mts +17 -0
  191. package/models/slots/chartsBaseSlotProps.d.ts +17 -0
  192. package/models/slots/chartsBaseSlots.d.mts +7 -1
  193. package/models/slots/chartsBaseSlots.d.ts +7 -1
  194. package/models/z-axis.d.mts +9 -0
  195. package/models/z-axis.d.ts +9 -0
  196. package/package.json +182 -126
  197. package/themeAugmentation/components.d.mts +4 -0
  198. package/themeAugmentation/components.d.ts +4 -0
  199. package/themeAugmentation/overrides.d.mts +2 -0
  200. package/themeAugmentation/overrides.d.ts +2 -0
  201. package/themeAugmentation/props.d.mts +2 -0
  202. package/themeAugmentation/props.d.ts +2 -0
  203. package/utils/epsilon.d.mts +1 -0
  204. package/utils/epsilon.d.ts +1 -0
  205. package/utils/epsilon.js +7 -0
  206. package/utils/epsilon.mjs +1 -0
@@ -1,27 +1,33 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { isBandScaleConfig, isPointScaleConfig, isContinuousScaleConfig } from "../../../../models/axis.mjs";
3
3
  import { getColorScale, getOrdinalColorScale } from "../../../colorScale.mjs";
4
- import { getDefaultTickNumber, getTickNumber, scaleTickNumberByRange } from "../../../ticks.mjs";
4
+ import { getDefaultTickNumber, getTickNumber } from "../../../ticks.mjs";
5
5
  import { getScale } from "../../../getScale.mjs";
6
6
  import { isDateData, createDateFormatter } from "../../../dateHelpers.mjs";
7
7
  import { getAxisExtremum } from "./getAxisExtremum.mjs";
8
8
  import { deg2rad } from "../../../angleConversion.mjs";
9
9
  import { getAxisTriggerTooltip } from "./getAxisTriggerTooltip.mjs";
10
10
  import { scaleBand, scalePoint } from "../../../scales/index.mjs";
11
+ import { EPSILON } from "../../../../utils/epsilon.mjs";
11
12
  function getRange(drawingArea, axisDirection, axis) {
12
13
  if (axisDirection === 'rotation') {
13
- if (axis.scaleType === 'point') {
14
- const angles = [deg2rad(axis.startAngle, 0), deg2rad(axis.endAngle, 2 * Math.PI)];
15
- const diff = angles[1] - angles[0];
16
- if (diff > Math.PI * 2 - 0.1) {
17
- // If we cover a full circle, we remove a slice to avoid having data point at the same place.
18
- angles[1] -= diff / axis.data.length;
19
- }
20
- return angles;
14
+ const angles = [deg2rad(axis.startAngle, 0), deg2rad(axis.endAngle, 2 * Math.PI)];
15
+ const diff = angles[1] - angles[0];
16
+ const isFullCircle = diff >= Math.PI * 2 - EPSILON;
17
+ if (axis.scaleType === 'point' && isFullCircle) {
18
+ // For point scale, remove a slice to avoid overlapping first and last points.
19
+ angles[1] -= diff / axis.data.length;
21
20
  }
22
- return [deg2rad(axis.startAngle, 0), deg2rad(axis.endAngle, 2 * Math.PI)];
21
+ return {
22
+ range: angles,
23
+ isFullCircle
24
+ };
23
25
  }
24
- return [0, Math.min(drawingArea.height, drawingArea.width) / 2];
26
+ const availableRadius = Math.min(drawingArea.height, drawingArea.width) / 2;
27
+ return {
28
+ range: [axis.minRadius ?? 0, axis.maxRadius ?? availableRadius],
29
+ isFullCircle: false
30
+ };
25
31
  }
26
32
  const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
27
33
  const DEFAULT_BAR_GAP_RATIO = 0.1;
@@ -42,7 +48,10 @@ export function computeAxisValue({
42
48
  const completeAxis = {};
43
49
  allAxis.forEach((eachAxis, axisIndex) => {
44
50
  const axis = eachAxis;
45
- const range = getRange(drawingArea, axisDirection, axis);
51
+ const {
52
+ range,
53
+ isFullCircle
54
+ } = getRange(drawingArea, axisDirection, axis);
46
55
  const [minData, maxData] = getAxisExtremum(axis, axisDirection, seriesConfig, axisIndex, formattedSeries);
47
56
  const triggerTooltip = !axis.ignoreTooltip && axisIdsTriggeringTooltip.has(axis.id);
48
57
  const data = axis.data ?? [];
@@ -60,7 +69,8 @@ export function computeAxisValue({
60
69
  tickNumber: axis.data.length,
61
70
  colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? getOrdinalColorScale(_extends({
62
71
  values: axis.data
63
- }, axis.colorMap)) : getColorScale(axis.colorMap))
72
+ }, axis.colorMap)) : getColorScale(axis.colorMap)),
73
+ isFullCircle
64
74
  });
65
75
  if (isDateData(axis.data)) {
66
76
  const dateFormatter = createDateFormatter(axis.data, range, axis.tickNumber);
@@ -77,7 +87,8 @@ export function computeAxisValue({
77
87
  tickNumber: axis.data.length,
78
88
  colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? getOrdinalColorScale(_extends({
79
89
  values: axis.data
80
- }, axis.colorMap)) : getColorScale(axis.colorMap))
90
+ }, axis.colorMap)) : getColorScale(axis.colorMap)),
91
+ isFullCircle
81
92
  });
82
93
  if (isDateData(axis.data)) {
83
94
  const dateFormatter = createDateFormatter(axis.data, range, axis.tickNumber);
@@ -99,10 +110,12 @@ export function computeAxisValue({
99
110
  axisExtremums[0] = min;
100
111
  axisExtremums[1] = max;
101
112
  }
102
- const rawTickNumber = getTickNumber(axis, axisExtremums, getDefaultTickNumber(Math.abs(range[1] - range[0])));
103
- const tickNumber = scaleTickNumberByRange(rawTickNumber, range);
113
+
114
+ // Use degrees to display more ticks by default
115
+ const ratio = axisDirection === 'rotation' ? 180 / 3 : 1;
116
+ const tickNumber = axis.tickNumber ?? getTickNumber(axis, axisExtremums, getDefaultTickNumber(ratio * Math.abs(range[1] - range[0])));
104
117
  const scale = getScale(scaleType, axisExtremums, range);
105
- const finalScale = domainLimit === 'nice' ? scale.nice(rawTickNumber) : scale;
118
+ const finalScale = domainLimit === 'nice' ? scale.nice(tickNumber) : scale;
106
119
  const [minDomain, maxDomain] = finalScale.domain();
107
120
  const domain = [axis.min ?? minDomain, axis.max ?? maxDomain];
108
121
  completeAxis[axis.id] = _extends({
@@ -16,17 +16,17 @@ function defaultizeAxis(inAxis, dataset, axisName) {
16
16
  return inputAxes.map((axisConfig, index) => {
17
17
  const id = `defaultized-${axisName}-axis-${index}`;
18
18
  const dataKey = axisConfig.dataKey;
19
- if (dataKey === undefined || axisConfig.data !== undefined) {
19
+ if (axisConfig.data !== undefined || dataKey === undefined && !axisConfig.valueGetter) {
20
20
  return (0, _extends2.default)({
21
21
  id
22
22
  }, axisConfig);
23
23
  }
24
24
  if (dataset === undefined) {
25
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: The ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided. ` + 'When using dataKey, a dataset must be provided to retrieve the axis data. ' + `Either provide a dataset prop or use the data property directly on the ${axisName}-axis.` : (0, _formatErrorMessage2.default)(39, axisName, axisName));
25
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: The ${axisName}-axis uses \`dataKey\` or \`valueGetter\` but no \`dataset\` is provided. ` + 'When using dataKey or valueGetter, a dataset must be provided to retrieve the axis data. ' + `Either provide a dataset prop or use the data property directly on the ${axisName}-axis.` : (0, _formatErrorMessage2.default)(39, axisName, axisName));
26
26
  }
27
27
  return (0, _extends2.default)({
28
28
  id,
29
- data: dataset.map(d => d[dataKey])
29
+ data: axisConfig.valueGetter ? dataset.map(d => axisConfig.valueGetter(d)) : dataset.map(d => d[dataKey])
30
30
  }, axisConfig);
31
31
  });
32
32
  }
@@ -9,17 +9,17 @@ export function defaultizeAxis(inAxis, dataset, axisName) {
9
9
  return inputAxes.map((axisConfig, index) => {
10
10
  const id = `defaultized-${axisName}-axis-${index}`;
11
11
  const dataKey = axisConfig.dataKey;
12
- if (dataKey === undefined || axisConfig.data !== undefined) {
12
+ if (axisConfig.data !== undefined || dataKey === undefined && !axisConfig.valueGetter) {
13
13
  return _extends({
14
14
  id
15
15
  }, axisConfig);
16
16
  }
17
17
  if (dataset === undefined) {
18
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: The ${axisName}-axis uses \`dataKey\` but no \`dataset\` is provided. ` + 'When using dataKey, a dataset must be provided to retrieve the axis data. ' + `Either provide a dataset prop or use the data property directly on the ${axisName}-axis.` : _formatErrorMessage(39, axisName, axisName));
18
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: The ${axisName}-axis uses \`dataKey\` or \`valueGetter\` but no \`dataset\` is provided. ` + 'When using dataKey or valueGetter, a dataset must be provided to retrieve the axis data. ' + `Either provide a dataset prop or use the data property directly on the ${axisName}-axis.` : _formatErrorMessage(39, axisName, axisName));
19
19
  }
20
20
  return _extends({
21
21
  id,
22
- data: dataset.map(d => d[dataKey])
22
+ data: axisConfig.valueGetter ? dataset.map(d => axisConfig.valueGetter(d)) : dataset.map(d => d[dataKey])
23
23
  }, axisConfig);
24
24
  });
25
25
  }
@@ -1,12 +1,12 @@
1
1
  export declare const selectorChartsTooltipPointerItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.mjs").UseChartTooltipState<keyof import("../../../index.mjs").ChartsSeriesConfig>> & {
2
2
  cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
3
- }) => import("../../../../index.mjs").LineItemIdentifier | import("../../../../index.mjs").BarItemIdentifier | import("../../../../index.mjs").ScatterItemIdentifier | import("../../../../index.mjs").PieItemIdentifier | import("../../../../index.mjs").RadarItemIdentifier | null;
3
+ }) => import("../../../index.mjs").LineItemIdentifier | import("../../../index.mjs").BarItemIdentifier | import("../../../../index.mjs").ScatterItemIdentifier | import("../../../../index.mjs").PieItemIdentifier | import("../../../../index.mjs").RadarItemIdentifier | null;
4
4
  export declare const selectorChartsTooltipPointerItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.mjs").UseChartTooltipState<keyof import("../../../index.mjs").ChartsSeriesConfig>> & {
5
5
  cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
6
6
  }) => boolean;
7
7
  export declare const selectorChartsTooltipItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("../useChartInteraction/useChartInteraction.types.mjs").UseChartInteractionState> & {
8
8
  cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
9
- }) => import("../../../../index.mjs").LineItemIdentifier | import("../../../../index.mjs").BarItemIdentifier | import("../../../../index.mjs").ScatterItemIdentifier | import("../../../../index.mjs").PieItemIdentifier | import("../../../../index.mjs").RadarItemIdentifier | null;
9
+ }) => import("../../../index.mjs").LineItemIdentifier | import("../../../index.mjs").BarItemIdentifier | import("../../../../index.mjs").ScatterItemIdentifier | import("../../../../index.mjs").PieItemIdentifier | import("../../../../index.mjs").RadarItemIdentifier | null;
10
10
  export declare const selectorChartsTooltipItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../../index.mjs").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../../index.mjs").UseChartInteractionListenerState & Partial<import("../useChartInteraction/useChartInteraction.types.mjs").UseChartInteractionState> & {
11
11
  cacheKey: import("../../models/index.mjs").ChartStateCacheKey;
12
12
  }) => boolean;
@@ -1,12 +1,12 @@
1
1
  export declare const selectorChartsTooltipPointerItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.js").UseChartTooltipState<keyof import("../../../index.js").ChartsSeriesConfig>> & {
2
2
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
3
- }) => import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
3
+ }) => import("../../../index.js").LineItemIdentifier | import("../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
4
4
  export declare const selectorChartsTooltipPointerItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartTooltip.types.js").UseChartTooltipState<keyof import("../../../index.js").ChartsSeriesConfig>> & {
5
5
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
6
6
  }) => boolean;
7
7
  export declare const selectorChartsTooltipItem: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("../useChartInteraction/useChartInteraction.types.js").UseChartInteractionState> & {
8
8
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
9
- }) => import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
9
+ }) => import("../../../index.js").LineItemIdentifier | import("../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
10
10
  export declare const selectorChartsTooltipItemIsDefined: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("../useChartInteraction/useChartInteraction.types.js").UseChartInteractionState> & {
11
11
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
12
12
  }) => boolean;
@@ -44,16 +44,16 @@ function getZAxisState(zAxis, dataset) {
44
44
  zAxis.forEach((axisConfig, index) => {
45
45
  const dataKey = axisConfig.dataKey;
46
46
  const defaultizedId = axisConfig.id ?? `defaultized-z-axis-${index}`;
47
- if (dataKey === undefined || axisConfig.data !== undefined) {
47
+ if (axisConfig.data !== undefined || dataKey === undefined && !axisConfig.valueGetter) {
48
48
  zAxisLookup[defaultizedId] = processColorMap(addDefaultId(axisConfig, defaultizedId));
49
49
  axisIds.push(defaultizedId);
50
50
  return;
51
51
  }
52
52
  if (dataset === undefined) {
53
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The z-axis uses `dataKey` but no `dataset` is provided. ' + 'When using dataKey, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the z-axis.' : (0, _formatErrorMessage2.default)(41));
53
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The z-axis uses `dataKey` or `valueGetter` but no `dataset` is provided. ' + 'When using dataKey or valueGetter, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the z-axis.' : (0, _formatErrorMessage2.default)(41));
54
54
  }
55
55
  zAxisLookup[defaultizedId] = processColorMap(addDefaultId((0, _extends2.default)({}, axisConfig, {
56
- data: dataset.map(d => d[dataKey])
56
+ data: axisConfig.valueGetter ? dataset.map(d => axisConfig.valueGetter(d)) : dataset.map(d => d[dataKey])
57
57
  }), defaultizedId));
58
58
  axisIds.push(defaultizedId);
59
59
  });
@@ -37,16 +37,16 @@ function getZAxisState(zAxis, dataset) {
37
37
  zAxis.forEach((axisConfig, index) => {
38
38
  const dataKey = axisConfig.dataKey;
39
39
  const defaultizedId = axisConfig.id ?? `defaultized-z-axis-${index}`;
40
- if (dataKey === undefined || axisConfig.data !== undefined) {
40
+ if (axisConfig.data !== undefined || dataKey === undefined && !axisConfig.valueGetter) {
41
41
  zAxisLookup[defaultizedId] = processColorMap(addDefaultId(axisConfig, defaultizedId));
42
42
  axisIds.push(defaultizedId);
43
43
  return;
44
44
  }
45
45
  if (dataset === undefined) {
46
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The z-axis uses `dataKey` but no `dataset` is provided. ' + 'When using dataKey, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the z-axis.' : _formatErrorMessage(41));
46
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X Charts: The z-axis uses `dataKey` or `valueGetter` but no `dataset` is provided. ' + 'When using dataKey or valueGetter, a dataset must be provided to retrieve the axis data. ' + 'Either provide a dataset prop or use the data property directly on the z-axis.' : _formatErrorMessage(41));
47
47
  }
48
48
  zAxisLookup[defaultizedId] = processColorMap(addDefaultId(_extends({}, axisConfig, {
49
- data: dataset.map(d => d[dataKey])
49
+ data: axisConfig.valueGetter ? dataset.map(d => axisConfig.valueGetter(d)) : dataset.map(d => d[dataKey])
50
50
  }), defaultizedId));
51
51
  axisIds.push(defaultizedId);
52
52
  });
package/models/axis.d.mts CHANGED
@@ -2,6 +2,7 @@ import type * as React from 'react';
2
2
  import type { ScaleBand, ScaleLinear, ScaleLogarithmic, ScaleOrdinal, ScalePoint, ScalePower, ScaleSequential, ScaleThreshold, ScaleTime, ScaleSymLog, NumberValue } from '@mui/x-charts-vendor/d3-scale';
3
3
  import { type SxProps } from '@mui/system/styleFunctionSx';
4
4
  import { type HasProperty, type MakeOptional, type MakeRequired } from '@mui/x-internals/types';
5
+ import { type DatasetElementType } from "./seriesType/config.mjs";
5
6
  import type { DefaultizedZoomOptions } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs";
6
7
  import { type ChartsAxisClasses } from "../ChartsAxis/axisClasses.mjs";
7
8
  import type { TickParams } from "../hooks/useTicks.mjs";
@@ -446,6 +447,14 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
446
447
  * The key used to retrieve `data` from the `dataset` prop.
447
448
  */
448
449
  dataKey?: string;
450
+ /**
451
+ * A function to extract and transform the value from the `dataset` item.
452
+ * It receives the full dataset item and should return the axis value.
453
+ * Can be used as an alternative to `dataKey`.
454
+ * @param {DatasetElementType<unknown>} item The full dataset item.
455
+ * @returns {V} The transformed value.
456
+ */
457
+ valueGetter?: (item: DatasetElementType<unknown>) => V;
449
458
  /**
450
459
  * Formats the axis value.
451
460
  * @param {V} value The value to format.
@@ -513,6 +522,8 @@ export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps ext
513
522
  * Indicate if the axis should be consider by a tooltip with `trigger='axis'`.
514
523
  */
515
524
  triggerTooltip?: boolean;
525
+ /** @ignore - internal. True when a rotation axis covers a full circle. */
526
+ isFullCircle?: boolean;
516
527
  } & (AxisProps extends ChartsXAxisProps ? AxisSideConfig<AxisProps> & {
517
528
  height: number;
518
529
  } : AxisProps extends ChartsYAxisProps ? AxisSideConfig<AxisProps> & {
@@ -564,8 +575,8 @@ export interface AxisItemIdentifier {
564
575
  }
565
576
  export type XAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsXAxisProps>, 'id'> : never;
566
577
  export type YAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsYAxisProps>, 'id'> : never;
567
- export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? AxisConfig<S, V, ChartsRotationAxisProps> : never;
568
- export type RadiusAxis<S extends 'linear' = 'linear', V = any> = S extends 'linear' ? AxisConfig<S, V, ChartsRadiusAxisProps> : never;
578
+ export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsRotationAxisProps>, 'id'> : never;
579
+ export type RadiusAxis<S extends 'linear' = 'linear', V = any> = S extends 'linear' ? MakeOptional<AxisConfig<S, V, ChartsRadiusAxisProps>, 'id'> : never;
569
580
  /**
570
581
  * The axis configuration with missing values filled with default values.
571
582
  */
package/models/axis.d.ts CHANGED
@@ -2,6 +2,7 @@ import type * as React from 'react';
2
2
  import type { ScaleBand, ScaleLinear, ScaleLogarithmic, ScaleOrdinal, ScalePoint, ScalePower, ScaleSequential, ScaleThreshold, ScaleTime, ScaleSymLog, NumberValue } from '@mui/x-charts-vendor/d3-scale';
3
3
  import { type SxProps } from '@mui/system/styleFunctionSx';
4
4
  import { type HasProperty, type MakeOptional, type MakeRequired } from '@mui/x-internals/types';
5
+ import { type DatasetElementType } from "./seriesType/config.js";
5
6
  import type { DefaultizedZoomOptions } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
6
7
  import { type ChartsAxisClasses } from "../ChartsAxis/axisClasses.js";
7
8
  import type { TickParams } from "../hooks/useTicks.js";
@@ -446,6 +447,14 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
446
447
  * The key used to retrieve `data` from the `dataset` prop.
447
448
  */
448
449
  dataKey?: string;
450
+ /**
451
+ * A function to extract and transform the value from the `dataset` item.
452
+ * It receives the full dataset item and should return the axis value.
453
+ * Can be used as an alternative to `dataKey`.
454
+ * @param {DatasetElementType<unknown>} item The full dataset item.
455
+ * @returns {V} The transformed value.
456
+ */
457
+ valueGetter?: (item: DatasetElementType<unknown>) => V;
449
458
  /**
450
459
  * Formats the axis value.
451
460
  * @param {V} value The value to format.
@@ -513,6 +522,8 @@ export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps ext
513
522
  * Indicate if the axis should be consider by a tooltip with `trigger='axis'`.
514
523
  */
515
524
  triggerTooltip?: boolean;
525
+ /** @ignore - internal. True when a rotation axis covers a full circle. */
526
+ isFullCircle?: boolean;
516
527
  } & (AxisProps extends ChartsXAxisProps ? AxisSideConfig<AxisProps> & {
517
528
  height: number;
518
529
  } : AxisProps extends ChartsYAxisProps ? AxisSideConfig<AxisProps> & {
@@ -564,8 +575,8 @@ export interface AxisItemIdentifier {
564
575
  }
565
576
  export type XAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsXAxisProps>, 'id'> : never;
566
577
  export type YAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsYAxisProps>, 'id'> : never;
567
- export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? AxisConfig<S, V, ChartsRotationAxisProps> : never;
568
- export type RadiusAxis<S extends 'linear' = 'linear', V = any> = S extends 'linear' ? AxisConfig<S, V, ChartsRadiusAxisProps> : never;
578
+ export type RotationAxis<S extends ScaleName = ScaleName, V = any> = S extends ScaleName ? MakeOptional<AxisConfig<S, V, ChartsRotationAxisProps>, 'id'> : never;
579
+ export type RadiusAxis<S extends 'linear' = 'linear', V = any> = S extends 'linear' ? MakeOptional<AxisConfig<S, V, ChartsRadiusAxisProps>, 'id'> : never;
569
580
  /**
570
581
  * The axis configuration with missing values filled with default values.
571
582
  */
@@ -1,10 +1,13 @@
1
1
  import { type DefaultizedProps } from '@mui/x-internals/types';
2
2
  import type { StackOffsetType } from "../stacking.mjs";
3
3
  import { type CartesianSeriesType, type CommonSeriesType, type CommonDefaultizedProps, type StackableSeriesType, type SeriesId } from "./common.mjs";
4
+ import { type DatasetElementType } from "./config.mjs";
4
5
  import { type BarItem, type BarLabelContext } from "../../BarChart/index.mjs";
5
6
  export type BarValueType = number;
6
- export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'bar'>, CartesianSeriesType, StackableSeriesType {
7
- type: 'bar';
7
+ /**
8
+ * @internal The series type shared by the bar and radialBar charts
9
+ */
10
+ export interface CommonBarSeriesType {
8
11
  /**
9
12
  * Data associated to each bar.
10
13
  */
@@ -13,6 +16,14 @@ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'ba
13
16
  * The key used to retrieve data from the dataset.
14
17
  */
15
18
  dataKey?: string;
19
+ /**
20
+ * A function to extract and transform the value from the `dataset` item.
21
+ * It receives the full dataset item and should return the series value.
22
+ * Can be used as an alternative to `dataKey`.
23
+ * @param {DatasetElementType<unknown>} item The full dataset item.
24
+ * @returns {BarValueType | null} The transformed value.
25
+ */
26
+ valueGetter?: (item: DatasetElementType<unknown>) => BarValueType | null;
16
27
  /**
17
28
  * The label to display on the tooltip or the legend. It can be a string or a function.
18
29
  */
@@ -22,11 +33,6 @@ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'ba
22
33
  * @default 'vertical'
23
34
  */
24
35
  layout?: 'horizontal' | 'vertical';
25
- /**
26
- * Defines how stacked series handle negative values.
27
- * @default 'diverging'
28
- */
29
- stackOffset?: StackOffsetType;
30
36
  /**
31
37
  * If provided, the value will be used as the minimum size of the bar in pixels.
32
38
  * This is useful to avoid bars with a size of 0.
@@ -45,6 +51,9 @@ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'ba
45
51
  * @returns {string} The formatted label.
46
52
  */
47
53
  barLabel?: 'value' | ((item: BarItem, context: BarLabelContext) => string | null | undefined);
54
+ }
55
+ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'bar'>, CartesianSeriesType, StackableSeriesType, CommonBarSeriesType {
56
+ type: 'bar';
48
57
  /**
49
58
  * The placement of the bar label. It accepts the following values:
50
59
  * - 'center': the label is centered on the bar
@@ -52,6 +61,11 @@ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'ba
52
61
  * @default 'center'
53
62
  */
54
63
  barLabelPlacement?: 'center' | 'outside';
64
+ /**
65
+ * Defines how stacked series handle negative values.
66
+ * @default 'diverging'
67
+ */
68
+ stackOffset?: StackOffsetType;
55
69
  }
56
70
  /**
57
71
  * An object that allows to identify a single bar.
@@ -1,10 +1,13 @@
1
1
  import { type DefaultizedProps } from '@mui/x-internals/types';
2
2
  import type { StackOffsetType } from "../stacking.js";
3
3
  import { type CartesianSeriesType, type CommonSeriesType, type CommonDefaultizedProps, type StackableSeriesType, type SeriesId } from "./common.js";
4
+ import { type DatasetElementType } from "./config.js";
4
5
  import { type BarItem, type BarLabelContext } from "../../BarChart/index.js";
5
6
  export type BarValueType = number;
6
- export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'bar'>, CartesianSeriesType, StackableSeriesType {
7
- type: 'bar';
7
+ /**
8
+ * @internal The series type shared by the bar and radialBar charts
9
+ */
10
+ export interface CommonBarSeriesType {
8
11
  /**
9
12
  * Data associated to each bar.
10
13
  */
@@ -13,6 +16,14 @@ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'ba
13
16
  * The key used to retrieve data from the dataset.
14
17
  */
15
18
  dataKey?: string;
19
+ /**
20
+ * A function to extract and transform the value from the `dataset` item.
21
+ * It receives the full dataset item and should return the series value.
22
+ * Can be used as an alternative to `dataKey`.
23
+ * @param {DatasetElementType<unknown>} item The full dataset item.
24
+ * @returns {BarValueType | null} The transformed value.
25
+ */
26
+ valueGetter?: (item: DatasetElementType<unknown>) => BarValueType | null;
16
27
  /**
17
28
  * The label to display on the tooltip or the legend. It can be a string or a function.
18
29
  */
@@ -22,11 +33,6 @@ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'ba
22
33
  * @default 'vertical'
23
34
  */
24
35
  layout?: 'horizontal' | 'vertical';
25
- /**
26
- * Defines how stacked series handle negative values.
27
- * @default 'diverging'
28
- */
29
- stackOffset?: StackOffsetType;
30
36
  /**
31
37
  * If provided, the value will be used as the minimum size of the bar in pixels.
32
38
  * This is useful to avoid bars with a size of 0.
@@ -45,6 +51,9 @@ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'ba
45
51
  * @returns {string} The formatted label.
46
52
  */
47
53
  barLabel?: 'value' | ((item: BarItem, context: BarLabelContext) => string | null | undefined);
54
+ }
55
+ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'bar'>, CartesianSeriesType, StackableSeriesType, CommonBarSeriesType {
56
+ type: 'bar';
48
57
  /**
49
58
  * The placement of the bar label. It accepts the following values:
50
59
  * - 'center': the label is centered on the bar
@@ -52,6 +61,11 @@ export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'ba
52
61
  * @default 'center'
53
62
  */
54
63
  barLabelPlacement?: 'center' | 'outside';
64
+ /**
65
+ * Defines how stacked series handle negative values.
66
+ * @default 'diverging'
67
+ */
68
+ stackOffset?: StackOffsetType;
55
69
  }
56
70
  /**
57
71
  * An object that allows to identify a single bar.
@@ -67,6 +67,16 @@ export type CartesianSeriesType = {
67
67
  */
68
68
  yAxisId?: AxisId;
69
69
  };
70
+ export type RadialSeriesType = {
71
+ /**
72
+ * The id of the rotation-axis used to render the series.
73
+ */
74
+ rotationAxisId?: AxisId;
75
+ /**
76
+ * The id of the radius-axis used to render the series.
77
+ */
78
+ radiusAxisId?: AxisId;
79
+ };
70
80
  export type StackableSeriesType = {
71
81
  /**
72
82
  * The key that identifies the stacking group.
@@ -67,6 +67,16 @@ export type CartesianSeriesType = {
67
67
  */
68
68
  yAxisId?: AxisId;
69
69
  };
70
+ export type RadialSeriesType = {
71
+ /**
72
+ * The id of the rotation-axis used to render the series.
73
+ */
74
+ rotationAxisId?: AxisId;
75
+ /**
76
+ * The id of the radius-axis used to render the series.
77
+ */
78
+ radiusAxisId?: AxisId;
79
+ };
70
80
  export type StackableSeriesType = {
71
81
  /**
72
82
  * The key that identifies the stacking group.
@@ -1,4 +1,6 @@
1
1
  import type { ChartSeriesType, ChartsSeriesConfig } from "./config.mjs";
2
2
  export type ComposableCartesianChartSeriesType = 'bar' | 'line' | 'scatter' | (ChartsSeriesConfig['rangeBar'] extends undefined ? never : 'rangeBar') | (ChartsSeriesConfig['ohlc'] extends undefined ? never : 'ohlc');
3
3
  export declare const composableCartesianSeriesTypes: Set<ComposableCartesianChartSeriesType>;
4
- export type ComposableChartSeriesType<SeriesType extends ChartSeriesType> = SeriesType extends ComposableCartesianChartSeriesType ? ComposableCartesianChartSeriesType : SeriesType;
4
+ export type ComposableRadialChartSeriesType = 'radialLine' | 'radialBar';
5
+ export declare const composableRadialSeriesTypes: Set<ComposableRadialChartSeriesType>;
6
+ export type ComposableChartSeriesType<SeriesType extends ChartSeriesType> = SeriesType extends ComposableCartesianChartSeriesType ? ComposableCartesianChartSeriesType : SeriesType extends ComposableRadialChartSeriesType ? ComposableRadialChartSeriesType : SeriesType;
@@ -1,4 +1,6 @@
1
1
  import type { ChartSeriesType, ChartsSeriesConfig } from "./config.js";
2
2
  export type ComposableCartesianChartSeriesType = 'bar' | 'line' | 'scatter' | (ChartsSeriesConfig['rangeBar'] extends undefined ? never : 'rangeBar') | (ChartsSeriesConfig['ohlc'] extends undefined ? never : 'ohlc');
3
3
  export declare const composableCartesianSeriesTypes: Set<ComposableCartesianChartSeriesType>;
4
- export type ComposableChartSeriesType<SeriesType extends ChartSeriesType> = SeriesType extends ComposableCartesianChartSeriesType ? ComposableCartesianChartSeriesType : SeriesType;
4
+ export type ComposableRadialChartSeriesType = 'radialLine' | 'radialBar';
5
+ export declare const composableRadialSeriesTypes: Set<ComposableRadialChartSeriesType>;
6
+ export type ComposableChartSeriesType<SeriesType extends ChartSeriesType> = SeriesType extends ComposableCartesianChartSeriesType ? ComposableCartesianChartSeriesType : SeriesType extends ComposableRadialChartSeriesType ? ComposableRadialChartSeriesType : SeriesType;
@@ -3,5 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.composableCartesianSeriesTypes = void 0;
7
- const composableCartesianSeriesTypes = exports.composableCartesianSeriesTypes = new Set(['bar', 'line', 'scatter', 'rangeBar', 'ohlc']);
6
+ exports.composableRadialSeriesTypes = exports.composableCartesianSeriesTypes = void 0;
7
+ const composableCartesianSeriesTypes = exports.composableCartesianSeriesTypes = new Set(['bar', 'line', 'scatter', 'rangeBar', 'ohlc']);
8
+
9
+ // Idem for radial series
10
+
11
+ const composableRadialSeriesTypes = exports.composableRadialSeriesTypes = new Set(['radialLine', 'radialBar']);
@@ -1 +1,5 @@
1
- export const composableCartesianSeriesTypes = new Set(['bar', 'line', 'scatter', 'rangeBar', 'ohlc']);
1
+ export const composableCartesianSeriesTypes = new Set(['bar', 'line', 'scatter', 'rangeBar', 'ohlc']);
2
+
3
+ // Idem for radial series
4
+
5
+ export const composableRadialSeriesTypes = new Set(['radialLine', 'radialBar']);
@@ -10,11 +10,11 @@ export type SeriesItemIdentifierWithData<SeriesType extends ChartSeriesType> = S
10
10
  */
11
11
  export type HighlightItemIdentifier<SeriesType extends ChartSeriesType> = SeriesType extends any ? DistributiveOmit<ChartsSeriesConfig[SeriesType]['highlightIdentifier'], 'type'> : never;
12
12
  export type HighlightItemIdentifierWithType<SeriesType extends ChartSeriesType> = SeriesType extends any ? ChartsSeriesConfig[SeriesType]['highlightIdentifier'] : never;
13
- export type FocusedItemIdentifier<SeriesType extends ChartSeriesType = ChartSeriesType> = SeriesType extends 'line' | 'radar' ? DefaultizedProps<ChartsSeriesConfig[SeriesType]['itemIdentifier'], 'dataIndex'> : SeriesType extends 'heatmap' ? DefaultizedProps<ChartsSeriesConfig[SeriesType]['itemIdentifier'], 'xIndex' | 'yIndex'> : ChartsSeriesConfig[SeriesType]['itemIdentifier'];
13
+ export type FocusedItemIdentifier<SeriesType extends ChartSeriesType = ChartSeriesType> = SeriesType extends 'line' | 'radar' | 'radialLine' ? DefaultizedProps<ChartsSeriesConfig[SeriesType]['itemIdentifier'], 'dataIndex'> : SeriesType extends 'heatmap' ? DefaultizedProps<ChartsSeriesConfig[SeriesType]['itemIdentifier'], 'xIndex' | 'yIndex'> : ChartsSeriesConfig[SeriesType]['itemIdentifier'];
14
14
  export { type SeriesId } from "./common.mjs";
15
15
  export type { CartesianChartSeriesType, StackableChartSeriesType } from "./config.mjs";
16
- export * from "./line.mjs";
17
- export * from "./bar.mjs";
16
+ export type { ShowMarkParams, MarkShape, LineSeriesType, LineItemIdentifier, DefaultizedLineSeriesType } from "./line.mjs";
17
+ export type { BarValueType, BarSeriesType, BarItemIdentifier, DefaultizedBarSeriesType } from "./bar.mjs";
18
18
  export * from "./scatter.mjs";
19
19
  export * from "./pie.mjs";
20
20
  export * from "./radar.mjs";
@@ -10,11 +10,11 @@ export type SeriesItemIdentifierWithData<SeriesType extends ChartSeriesType> = S
10
10
  */
11
11
  export type HighlightItemIdentifier<SeriesType extends ChartSeriesType> = SeriesType extends any ? DistributiveOmit<ChartsSeriesConfig[SeriesType]['highlightIdentifier'], 'type'> : never;
12
12
  export type HighlightItemIdentifierWithType<SeriesType extends ChartSeriesType> = SeriesType extends any ? ChartsSeriesConfig[SeriesType]['highlightIdentifier'] : never;
13
- export type FocusedItemIdentifier<SeriesType extends ChartSeriesType = ChartSeriesType> = SeriesType extends 'line' | 'radar' ? DefaultizedProps<ChartsSeriesConfig[SeriesType]['itemIdentifier'], 'dataIndex'> : SeriesType extends 'heatmap' ? DefaultizedProps<ChartsSeriesConfig[SeriesType]['itemIdentifier'], 'xIndex' | 'yIndex'> : ChartsSeriesConfig[SeriesType]['itemIdentifier'];
13
+ export type FocusedItemIdentifier<SeriesType extends ChartSeriesType = ChartSeriesType> = SeriesType extends 'line' | 'radar' | 'radialLine' ? DefaultizedProps<ChartsSeriesConfig[SeriesType]['itemIdentifier'], 'dataIndex'> : SeriesType extends 'heatmap' ? DefaultizedProps<ChartsSeriesConfig[SeriesType]['itemIdentifier'], 'xIndex' | 'yIndex'> : ChartsSeriesConfig[SeriesType]['itemIdentifier'];
14
14
  export { type SeriesId } from "./common.js";
15
15
  export type { CartesianChartSeriesType, StackableChartSeriesType } from "./config.js";
16
- export * from "./line.js";
17
- export * from "./bar.js";
16
+ export type { ShowMarkParams, MarkShape, LineSeriesType, LineItemIdentifier, DefaultizedLineSeriesType } from "./line.js";
17
+ export type { BarValueType, BarSeriesType, BarItemIdentifier, DefaultizedBarSeriesType } from "./bar.js";
18
18
  export * from "./scatter.js";
19
19
  export * from "./pie.js";
20
20
  export * from "./radar.js";
@@ -3,28 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _line = require("./line");
7
- Object.keys(_line).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _line[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _line[key];
14
- }
15
- });
16
- });
17
- var _bar = require("./bar");
18
- Object.keys(_bar).forEach(function (key) {
19
- if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _bar[key]) return;
21
- Object.defineProperty(exports, key, {
22
- enumerable: true,
23
- get: function () {
24
- return _bar[key];
25
- }
26
- });
27
- });
28
6
  var _scatter = require("./scatter");
29
7
  Object.keys(_scatter).forEach(function (key) {
30
8
  if (key === "default" || key === "__esModule") return;
@@ -9,8 +9,6 @@
9
9
  * Identifies an highlighted item or series.
10
10
  */
11
11
 
12
- export * from "./line.mjs";
13
- export * from "./bar.mjs";
14
12
  export * from "./scatter.mjs";
15
13
  export * from "./pie.mjs";
16
14
  export * from "./radar.mjs";