@mui/x-charts 9.3.0 → 9.5.0

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 (264) hide show
  1. package/BarChart/BarElement.d.mts +3 -2
  2. package/BarChart/BarElement.d.ts +3 -2
  3. package/BarChart/BarLabel/BarLabelItem.d.mts +3 -2
  4. package/BarChart/BarLabel/BarLabelItem.d.ts +3 -2
  5. package/BarChart/seriesConfig/bar/extremums.js +7 -2
  6. package/BarChart/seriesConfig/bar/extremums.mjs +7 -2
  7. package/CHANGELOG.md +296 -0
  8. package/ChartsContainer/ChartsContainer.js +21 -0
  9. package/ChartsContainer/ChartsContainer.mjs +21 -0
  10. package/ChartsLabel/ChartsLabelMark.js +1 -21
  11. package/ChartsLabel/ChartsLabelMark.mjs +0 -20
  12. package/ChartsLegend/chartsLegend.types.d.mts +3 -2
  13. package/ChartsLegend/chartsLegend.types.d.ts +3 -2
  14. package/ChartsLegend/piecewiseColorLegendClasses.js +8 -2
  15. package/ChartsLegend/piecewiseColorLegendClasses.mjs +8 -2
  16. package/ChartsOverlay/ChartsOverlay.d.mts +5 -4
  17. package/ChartsOverlay/ChartsOverlay.d.ts +5 -4
  18. package/ChartsRadialAxisHighlight/index.d.mts +6 -1
  19. package/ChartsRadialAxisHighlight/index.d.ts +6 -1
  20. package/ChartsRadialAxisHighlight/index.js +9 -2
  21. package/ChartsRadialAxisHighlight/index.mjs +8 -1
  22. package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.mts +1 -1
  23. package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.ts +1 -1
  24. package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +1 -1
  25. package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +1 -1
  26. package/ChartsRadialDataProvider/index.d.mts +5 -0
  27. package/ChartsRadialDataProvider/index.d.ts +5 -0
  28. package/ChartsRadialDataProvider/index.js +12 -1
  29. package/ChartsRadialDataProvider/index.mjs +7 -0
  30. package/ChartsRadialGrid/index.d.mts +6 -1
  31. package/ChartsRadialGrid/index.d.ts +6 -1
  32. package/ChartsRadialGrid/index.js +8 -2
  33. package/ChartsRadialGrid/index.mjs +8 -1
  34. package/ChartsRadiusAxis/index.d.mts +6 -1
  35. package/ChartsRadiusAxis/index.d.ts +6 -1
  36. package/ChartsRadiusAxis/index.js +10 -2
  37. package/ChartsRadiusAxis/index.mjs +7 -1
  38. package/ChartsReferenceLine/ChartsXReferenceLine.js +6 -1
  39. package/ChartsReferenceLine/ChartsXReferenceLine.mjs +6 -1
  40. package/ChartsReferenceLine/ChartsYReferenceLine.js +5 -0
  41. package/ChartsReferenceLine/ChartsYReferenceLine.mjs +5 -0
  42. package/ChartsRotationAxis/index.d.mts +6 -1
  43. package/ChartsRotationAxis/index.d.ts +6 -1
  44. package/ChartsRotationAxis/index.js +10 -2
  45. package/ChartsRotationAxis/index.mjs +7 -1
  46. package/ChartsTooltip/ChartTooltip.types.d.mts +3 -2
  47. package/ChartsTooltip/ChartTooltip.types.d.ts +3 -2
  48. package/ChartsTooltip/ChartsTooltipContainer.js +11 -4
  49. package/ChartsTooltip/ChartsTooltipContainer.mjs +11 -4
  50. package/ChartsTooltip/useAxesTooltip.js +2 -2
  51. package/ChartsTooltip/useAxesTooltip.mjs +2 -2
  52. package/ChartsTooltip/useItemTooltip.js +2 -2
  53. package/ChartsTooltip/useItemTooltip.mjs +2 -2
  54. package/ChartsXAxis/useAxisTicksProps.d.mts +84 -3
  55. package/ChartsXAxis/useAxisTicksProps.d.ts +84 -3
  56. package/ChartsYAxis/useAxisTicksProps.d.mts +84 -3
  57. package/ChartsYAxis/useAxisTicksProps.d.ts +84 -3
  58. package/LineChart/AreaElement.d.mts +3 -2
  59. package/LineChart/AreaElement.d.ts +3 -2
  60. package/LineChart/AreaElement.js +1 -1
  61. package/LineChart/AreaElement.mjs +1 -1
  62. package/LineChart/CircleMarkElement.js +1 -1
  63. package/LineChart/CircleMarkElement.mjs +1 -1
  64. package/LineChart/LineElement.d.mts +3 -2
  65. package/LineChart/LineElement.d.ts +3 -2
  66. package/LineChart/LineElement.js +1 -1
  67. package/LineChart/LineElement.mjs +1 -1
  68. package/LineChart/LineHighlightPlot.d.mts +3 -2
  69. package/LineChart/LineHighlightPlot.d.ts +3 -2
  70. package/LineChart/LineHighlightPlot.js +65 -45
  71. package/LineChart/LineHighlightPlot.mjs +65 -45
  72. package/LineChart/MarkElement.js +1 -1
  73. package/LineChart/MarkElement.mjs +1 -1
  74. package/LineChart/MarkPlot.d.mts +3 -2
  75. package/LineChart/MarkPlot.d.ts +3 -2
  76. package/LineChart/seriesConfig/curveEvaluation.js +28 -14
  77. package/LineChart/seriesConfig/curveEvaluation.mjs +27 -14
  78. package/LineChart/seriesConfig/extremums.js +5 -1
  79. package/LineChart/seriesConfig/extremums.mjs +5 -1
  80. package/LineChart/useMarkPlotData.js +3 -1
  81. package/LineChart/useMarkPlotData.mjs +3 -1
  82. package/PieChart/PieArcLabelPlot.d.mts +3 -2
  83. package/PieChart/PieArcLabelPlot.d.ts +3 -2
  84. package/PieChart/PieArcPlot.d.mts +3 -2
  85. package/PieChart/PieArcPlot.d.ts +3 -2
  86. package/RadarChart/RadarAxis/RadarAxis.utils.d.mts +2 -2
  87. package/RadarChart/RadarAxis/RadarAxis.utils.d.ts +2 -2
  88. package/ScatterChart/BatchScatter.d.mts +2 -8
  89. package/ScatterChart/BatchScatter.d.ts +2 -8
  90. package/ScatterChart/BatchScatter.js +17 -12
  91. package/ScatterChart/BatchScatter.mjs +17 -12
  92. package/ScatterChart/FocusedScatterMark.js +2 -2
  93. package/ScatterChart/FocusedScatterMark.mjs +2 -2
  94. package/ScatterChart/HighlightedScatterMark.js +3 -3
  95. package/ScatterChart/HighlightedScatterMark.mjs +3 -3
  96. package/ScatterChart/Scatter.d.mts +5 -0
  97. package/ScatterChart/Scatter.d.ts +5 -0
  98. package/ScatterChart/Scatter.js +7 -2
  99. package/ScatterChart/Scatter.mjs +7 -2
  100. package/ScatterChart/ScatterChart.d.mts +2 -1
  101. package/ScatterChart/ScatterChart.d.ts +2 -1
  102. package/ScatterChart/ScatterChart.js +28 -3
  103. package/ScatterChart/ScatterChart.mjs +28 -3
  104. package/ScatterChart/ScatterChart.plugins.d.mts +2 -1
  105. package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
  106. package/ScatterChart/ScatterChart.plugins.js +2 -1
  107. package/ScatterChart/ScatterChart.plugins.mjs +2 -1
  108. package/ScatterChart/ScatterMarker.types.d.mts +3 -2
  109. package/ScatterChart/ScatterMarker.types.d.ts +3 -2
  110. package/ScatterChart/ScatterPlot.d.mts +7 -4
  111. package/ScatterChart/ScatterPlot.d.ts +7 -4
  112. package/ScatterChart/ScatterPlot.js +31 -4
  113. package/ScatterChart/ScatterPlot.mjs +31 -4
  114. package/ScatterChart/async/ScatterAsync.d.mts +9 -0
  115. package/ScatterChart/async/ScatterAsync.d.ts +9 -0
  116. package/ScatterChart/async/ScatterAsync.js +71 -0
  117. package/ScatterChart/async/ScatterAsync.mjs +67 -0
  118. package/ScatterChart/async/ScatterAsyncBatch.d.mts +24 -0
  119. package/ScatterChart/async/ScatterAsyncBatch.d.ts +24 -0
  120. package/ScatterChart/async/ScatterAsyncBatch.js +112 -0
  121. package/ScatterChart/async/ScatterAsyncBatch.mjs +106 -0
  122. package/ScatterChart/async/scatterRenderData.selectors.d.mts +38 -0
  123. package/ScatterChart/async/scatterRenderData.selectors.d.ts +38 -0
  124. package/ScatterChart/async/scatterRenderData.selectors.js +93 -0
  125. package/ScatterChart/async/scatterRenderData.selectors.mjs +87 -0
  126. package/ScatterChart/seriesConfig/extremums.js +6 -0
  127. package/ScatterChart/seriesConfig/extremums.mjs +6 -0
  128. package/ScatterChart/seriesConfig/getColor.js +1 -1
  129. package/ScatterChart/seriesConfig/getColor.mjs +1 -1
  130. package/ScatterChart/seriesConfig/getMarkerSize.d.mts +18 -0
  131. package/ScatterChart/seriesConfig/getMarkerSize.d.ts +18 -0
  132. package/ScatterChart/seriesConfig/getMarkerSize.js +43 -0
  133. package/ScatterChart/seriesConfig/getMarkerSize.mjs +37 -0
  134. package/ScatterChart/seriesConfig/seriesProcessor.js +23 -8
  135. package/ScatterChart/seriesConfig/seriesProcessor.mjs +23 -8
  136. package/ScatterChart/useScatterItemPosition.d.mts +4 -0
  137. package/ScatterChart/useScatterItemPosition.d.ts +4 -0
  138. package/ScatterChart/useScatterItemPosition.js +9 -0
  139. package/ScatterChart/useScatterItemPosition.mjs +8 -0
  140. package/SparkLineChart/SparkLineChart.js +2 -1
  141. package/SparkLineChart/SparkLineChart.mjs +2 -1
  142. package/Toolbar/Toolbar.types.d.mts +3 -2
  143. package/Toolbar/Toolbar.types.d.ts +3 -2
  144. package/index.js +1 -1
  145. package/index.mjs +1 -1
  146. package/internals/animation/animation.d.mts +1 -2
  147. package/internals/animation/animation.d.ts +1 -2
  148. package/internals/commonNextFocusItem.d.mts +10 -2
  149. package/internals/commonNextFocusItem.d.ts +10 -2
  150. package/internals/commonNextFocusItem.js +12 -4
  151. package/internals/commonNextFocusItem.mjs +12 -4
  152. package/internals/createCommonKeyboardFocusHandler.d.mts +1 -1
  153. package/internals/createCommonKeyboardFocusHandler.d.ts +1 -1
  154. package/internals/createCommonKeyboardFocusHandler.js +3 -3
  155. package/internals/createCommonKeyboardFocusHandler.mjs +3 -3
  156. package/internals/getSeriesColorFn.d.mts +5 -5
  157. package/internals/getSeriesColorFn.d.ts +5 -5
  158. package/internals/incompleteDatasetKeysError.d.mts +1 -0
  159. package/internals/incompleteDatasetKeysError.d.ts +1 -0
  160. package/internals/incompleteDatasetKeysError.js +11 -0
  161. package/internals/incompleteDatasetKeysError.mjs +4 -0
  162. package/internals/index.d.mts +3 -0
  163. package/internals/index.d.ts +3 -0
  164. package/internals/index.js +36 -0
  165. package/internals/index.mjs +3 -0
  166. package/internals/plugins/allPlugins.d.mts +4 -3
  167. package/internals/plugins/allPlugins.d.ts +4 -3
  168. package/internals/plugins/allPlugins.js +2 -1
  169. package/internals/plugins/allPlugins.mjs +2 -1
  170. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.mts +12 -3
  171. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +12 -3
  172. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +10 -1
  173. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.mjs +10 -1
  174. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.mts +15 -1
  175. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +15 -1
  176. package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
  177. package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.mjs +4 -3
  178. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
  179. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +3 -3
  180. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.mts +10 -1
  181. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +10 -1
  182. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +18 -1
  183. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.mjs +16 -0
  184. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +27 -2
  185. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.mjs +27 -2
  186. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
  187. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.mjs +1 -3
  188. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +11 -3
  189. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +11 -3
  190. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +24 -5
  191. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.mjs +24 -5
  192. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.mts +1 -1
  193. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -1
  194. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +46 -2
  195. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.mjs +47 -2
  196. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +46 -11
  197. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +46 -11
  198. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.mts +2 -1
  199. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.ts +2 -1
  200. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +3 -2
  201. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.mjs +3 -2
  202. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.mts +4 -0
  203. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +4 -0
  204. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +3 -1
  205. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.mjs +1 -0
  206. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +5 -3
  207. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +7 -5
  208. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +17 -3
  209. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +17 -3
  210. package/internals/plugins/featurePlugins/useProgressiveRendering/index.d.mts +3 -0
  211. package/internals/plugins/featurePlugins/useProgressiveRendering/index.d.ts +3 -0
  212. package/internals/plugins/featurePlugins/useProgressiveRendering/index.js +27 -0
  213. package/internals/plugins/featurePlugins/useProgressiveRendering/index.mjs +2 -0
  214. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.d.mts +13 -0
  215. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.d.ts +13 -0
  216. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.js +136 -0
  217. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.mjs +128 -0
  218. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.d.mts +42 -0
  219. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.d.ts +42 -0
  220. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.js +166 -0
  221. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.mjs +159 -0
  222. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.d.mts +34 -0
  223. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.d.ts +34 -0
  224. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.js +5 -0
  225. package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.mjs +1 -0
  226. package/internals/scales/scaleBand.js +70 -43
  227. package/internals/scales/scaleBand.mjs +71 -44
  228. package/internals/sizeScale.d.mts +6 -0
  229. package/internals/sizeScale.d.ts +6 -0
  230. package/internals/sizeScale.js +46 -0
  231. package/internals/sizeScale.mjs +38 -0
  232. package/models/axis.d.mts +18 -12
  233. package/models/axis.d.ts +18 -12
  234. package/models/chartsSlotsComponentsProps.d.mts +25 -0
  235. package/models/chartsSlotsComponentsProps.d.ts +25 -0
  236. package/models/chartsSlotsComponentsProps.js +5 -0
  237. package/models/chartsSlotsComponentsProps.mjs +1 -0
  238. package/models/index.d.mts +1 -0
  239. package/models/index.d.ts +1 -0
  240. package/models/index.js +11 -0
  241. package/models/index.mjs +1 -0
  242. package/models/seriesType/bar.d.mts +1 -1
  243. package/models/seriesType/bar.d.ts +1 -1
  244. package/models/seriesType/common.d.mts +4 -4
  245. package/models/seriesType/common.d.ts +4 -4
  246. package/models/seriesType/config.d.mts +3 -3
  247. package/models/seriesType/config.d.ts +3 -3
  248. package/models/seriesType/line.d.mts +6 -3
  249. package/models/seriesType/line.d.ts +6 -3
  250. package/models/seriesType/pie.d.mts +1 -1
  251. package/models/seriesType/pie.d.ts +1 -1
  252. package/models/seriesType/radar.d.mts +1 -1
  253. package/models/seriesType/radar.d.ts +1 -1
  254. package/models/seriesType/scatter.d.mts +35 -3
  255. package/models/seriesType/scatter.d.ts +35 -3
  256. package/models/sizeMapping.d.mts +64 -0
  257. package/models/sizeMapping.d.ts +64 -0
  258. package/models/sizeMapping.js +5 -0
  259. package/models/sizeMapping.mjs +1 -0
  260. package/models/slots/chartsBaseSlots.d.mts +6 -5
  261. package/models/slots/chartsBaseSlots.d.ts +6 -5
  262. package/models/z-axis.d.mts +10 -1
  263. package/models/z-axis.d.ts +10 -1
  264. package/package.json +5 -5
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable func-names */
2
2
  // Adapted from d3-scale v4.0.2
3
3
  // https://github.com/d3/d3-scale/blob/d6904a4bde09e16005e0ad8ca3e25b10ce54fa0d/src/band.js
4
- import { InternMap, range as sequence } from '@mui/x-charts-vendor/d3-array';
4
+ import { InternMap } from '@mui/x-charts-vendor/d3-array';
5
5
  export function keyof(value) {
6
6
  if (Array.isArray(value)) {
7
7
  return JSON.stringify(value);
@@ -13,60 +13,57 @@ export function keyof(value) {
13
13
  }
14
14
 
15
15
  /**
16
- * Constructs a new band scale with the specified range, no padding, no rounding and center alignment.
17
- * The domain defaults to the empty domain.
18
- * If range is not specified, it defaults to the unit range [0, 1].
19
- *
20
- * The generic corresponds to the data type of domain elements.
21
- *
22
- * @param range A two-element array of numeric values.
23
- */
24
-
25
- /**
26
- * Constructs a new band scale with the specified domain and range, no padding, no rounding and center alignment.
27
- *
28
- * The generic corresponds to the data type of domain elements.
29
- *
30
- * @param domain Array of domain values.
31
- * @param range A two-element array of numeric values.
16
+ * The internal state shared when copying a scale. The domain index (`InternMap`) is the expensive
17
+ * part to build — `O(domain)` and is immutable once set (the domain setter replaces it rather than
18
+ * mutating it), so a copy can share the same reference instead of rebuilding it. This makes `copy()`
19
+ * `O(1)`, which matters because zooming copies the scale on every frame to apply a new range.
32
20
  */
33
21
 
34
- export function scaleBand(...args) {
22
+ function createScaleBand(seed) {
35
23
  // @ts-expect-error, InternMap accepts two arguments, but its types are set as Map, which doesn't.
36
- let index = new InternMap(undefined, keyof);
37
- let domain = [];
38
- let ordinalRange = [];
39
- let r0 = 0;
40
- let r1 = 1;
24
+ let index = seed ? seed.index : new InternMap(undefined, keyof);
25
+ let domain = seed ? seed.domain : [];
26
+ let r0 = seed ? seed.r0 : 0;
27
+ let r1 = seed ? seed.r1 : 1;
28
+ let isRound = seed ? seed.isRound : false;
29
+ let paddingInner = seed ? seed.paddingInner : 0;
30
+ let paddingOuter = seed ? seed.paddingOuter : 0;
31
+ let align = seed ? seed.align : 0.5;
32
+
33
+ // Derived on every rescale. Positions are affine in the index, so they are computed on demand in
34
+ // `scale()` rather than materialized into an array — keeping rescale `O(1)` instead of `O(domain)`.
41
35
  let step;
42
36
  let bandwidth;
43
- let isRound = false;
44
- let paddingInner = 0;
45
- let paddingOuter = 0;
46
- let align = 0.5;
37
+ let reverse = false;
38
+ let start = 0;
47
39
  const scale = d => {
48
40
  const i = index.get(d);
49
41
  if (i === undefined) {
50
42
  return undefined;
51
43
  }
52
- return ordinalRange[i % ordinalRange.length];
44
+ const n = domain.length;
45
+ if (n === 0) {
46
+ return undefined;
47
+ }
48
+ const k = reverse ? n - 1 - i % n : i % n;
49
+ return start + step * k;
53
50
  };
54
51
  const rescale = () => {
55
52
  const n = domain.length;
56
- const reverse = r1 < r0;
57
- const start = reverse ? r1 : r0;
58
- const stop = reverse ? r0 : r1;
59
- step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
53
+ reverse = r1 < r0;
54
+ const lo = reverse ? r1 : r0;
55
+ const hi = reverse ? r0 : r1;
56
+ step = (hi - lo) / Math.max(1, n - paddingInner + paddingOuter * 2);
60
57
  if (isRound) {
61
58
  step = Math.floor(step);
62
59
  }
63
- const adjustedStart = start + (stop - start - step * (n - paddingInner)) * align;
60
+ let adjustedStart = lo + (hi - lo - step * (n - paddingInner)) * align;
64
61
  bandwidth = step * (1 - paddingInner);
65
- const finalStart = isRound ? Math.round(adjustedStart) : adjustedStart;
66
- const finalBandwidth = isRound ? Math.round(bandwidth) : bandwidth;
67
- bandwidth = finalBandwidth;
68
- const values = sequence(n).map(i => finalStart + step * i);
69
- ordinalRange = reverse ? values.reverse() : values;
62
+ if (isRound) {
63
+ adjustedStart = Math.round(adjustedStart);
64
+ bandwidth = Math.round(bandwidth);
65
+ }
66
+ start = adjustedStart;
70
67
  return scale;
71
68
  };
72
69
  scale.domain = function (_) {
@@ -141,19 +138,49 @@ export function scaleBand(...args) {
141
138
  align = Math.max(0, Math.min(1, _));
142
139
  return rescale();
143
140
  };
144
- scale.copy = () => {
145
- return scaleBand(domain, [r0, r1]).round(isRound).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
146
- };
147
141
 
148
- // Initialize from arguments
142
+ // Shares the immutable domain index with the copy, so copying does not rebuild it.
143
+ scale.copy = () => createScaleBand({
144
+ index,
145
+ domain,
146
+ r0,
147
+ r1,
148
+ isRound,
149
+ paddingInner,
150
+ paddingOuter,
151
+ align
152
+ });
153
+ rescale();
154
+ return scale;
155
+ }
156
+
157
+ /**
158
+ * Constructs a new band scale with the specified range, no padding, no rounding and center alignment.
159
+ * The domain defaults to the empty domain.
160
+ * If range is not specified, it defaults to the unit range [0, 1].
161
+ *
162
+ * The generic corresponds to the data type of domain elements.
163
+ *
164
+ * @param range A two-element array of numeric values.
165
+ */
166
+
167
+ /**
168
+ * Constructs a new band scale with the specified domain and range, no padding, no rounding and center alignment.
169
+ *
170
+ * The generic corresponds to the data type of domain elements.
171
+ *
172
+ * @param domain Array of domain values.
173
+ * @param range A two-element array of numeric values.
174
+ */
175
+
176
+ export function scaleBand(...args) {
177
+ const scale = createScaleBand();
149
178
  const [arg0, arg1] = args;
150
179
  if (args.length > 1) {
151
180
  scale.domain(arg0);
152
181
  scale.range(arg1);
153
182
  } else if (arg0) {
154
183
  scale.range(arg0);
155
- } else {
156
- rescale();
157
184
  }
158
185
  return scale;
159
186
  }
@@ -0,0 +1,6 @@
1
+ import { type ScaleOrdinal, type ScaleThreshold, type ScaleSequential } from '@mui/x-charts-vendor/d3-scale';
2
+ import { type ContinuousSizeConfig, type PiecewiseSizeConfig, type OrdinalSizeConfig } from "../models/sizeMapping.mjs";
3
+ export declare function getSequentialSizeScale<Value extends number | Date>(config: ContinuousSizeConfig<Value> | PiecewiseSizeConfig<Value>): ScaleThreshold<Value, number, never> | ScaleSequential<number, never>;
4
+ export declare function getOrdinalSizeScale(config: OrdinalSizeConfig): ScaleOrdinal<number | Date | string, number, number | null>;
5
+ export declare function getSizeScale(config: OrdinalSizeConfig): ScaleOrdinal<number | Date | string, number, number | null>;
6
+ export declare function getSizeScale(config: ContinuousSizeConfig | PiecewiseSizeConfig): ScaleThreshold<number | Date, number | null> | ScaleSequential<number, number | null>;
@@ -0,0 +1,6 @@
1
+ import { type ScaleOrdinal, type ScaleThreshold, type ScaleSequential } from '@mui/x-charts-vendor/d3-scale';
2
+ import { type ContinuousSizeConfig, type PiecewiseSizeConfig, type OrdinalSizeConfig } from "../models/sizeMapping.js";
3
+ export declare function getSequentialSizeScale<Value extends number | Date>(config: ContinuousSizeConfig<Value> | PiecewiseSizeConfig<Value>): ScaleThreshold<Value, number, never> | ScaleSequential<number, never>;
4
+ export declare function getOrdinalSizeScale(config: OrdinalSizeConfig): ScaleOrdinal<number | Date | string, number, number | null>;
5
+ export declare function getSizeScale(config: OrdinalSizeConfig): ScaleOrdinal<number | Date | string, number, number | null>;
6
+ export declare function getSizeScale(config: ContinuousSizeConfig | PiecewiseSizeConfig): ScaleThreshold<number | Date, number | null> | ScaleSequential<number, number | null>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getOrdinalSizeScale = getOrdinalSizeScale;
7
+ exports.getSequentialSizeScale = getSequentialSizeScale;
8
+ exports.getSizeScale = getSizeScale;
9
+ var _d3Scale = require("@mui/x-charts-vendor/d3-scale");
10
+ const isFunctionInterpolator = config => {
11
+ return typeof config.size === 'function';
12
+ };
13
+ function getClampedSize(sizes) {
14
+ const [minSize, maxSize] = sizes;
15
+ return t => {
16
+ const clampedT = Math.max(Math.min(t, 1), 0);
17
+ return minSize + clampedT * (maxSize - minSize);
18
+ };
19
+ }
20
+ function getSequentialSizeScale(config) {
21
+ if (config.type === 'piecewise') {
22
+ return (0, _d3Scale.scaleThreshold)(config.thresholds, config.sizes);
23
+ }
24
+ if (isFunctionInterpolator(config)) {
25
+ return (0, _d3Scale.scaleSequential)([config.min ?? 0, config.max ?? 100], config.size);
26
+ }
27
+ const interpolator = config.interpolator ?? 'sqrt';
28
+ switch (interpolator) {
29
+ case 'log':
30
+ return (0, _d3Scale.scaleSequentialLog)([config.min ?? 0, config.max ?? 100], getClampedSize(config.size));
31
+ case 'linear':
32
+ return (0, _d3Scale.scaleSequential)([config.min ?? 0, config.max ?? 100], getClampedSize(config.size));
33
+ case 'sqrt':
34
+ default:
35
+ return (0, _d3Scale.scaleSequentialSqrt)([config.min ?? 0, config.max ?? 100], getClampedSize(config.size));
36
+ }
37
+ }
38
+ function getOrdinalSizeScale(config) {
39
+ if (config.values) {
40
+ return (0, _d3Scale.scaleOrdinal)(config.values, config.sizes).unknown(config.unknownSize ?? null);
41
+ }
42
+ return (0, _d3Scale.scaleOrdinal)(config.sizes.map((_, index) => index), config.sizes).unknown(config.unknownSize ?? null);
43
+ }
44
+ function getSizeScale(config) {
45
+ return config.type === 'ordinal' ? getOrdinalSizeScale(config) : getSequentialSizeScale(config);
46
+ }
@@ -0,0 +1,38 @@
1
+ import { scaleOrdinal, scaleThreshold, scaleSequential, scaleSequentialSqrt, scaleSequentialLog } from '@mui/x-charts-vendor/d3-scale';
2
+ const isFunctionInterpolator = config => {
3
+ return typeof config.size === 'function';
4
+ };
5
+ function getClampedSize(sizes) {
6
+ const [minSize, maxSize] = sizes;
7
+ return t => {
8
+ const clampedT = Math.max(Math.min(t, 1), 0);
9
+ return minSize + clampedT * (maxSize - minSize);
10
+ };
11
+ }
12
+ export function getSequentialSizeScale(config) {
13
+ if (config.type === 'piecewise') {
14
+ return scaleThreshold(config.thresholds, config.sizes);
15
+ }
16
+ if (isFunctionInterpolator(config)) {
17
+ return scaleSequential([config.min ?? 0, config.max ?? 100], config.size);
18
+ }
19
+ const interpolator = config.interpolator ?? 'sqrt';
20
+ switch (interpolator) {
21
+ case 'log':
22
+ return scaleSequentialLog([config.min ?? 0, config.max ?? 100], getClampedSize(config.size));
23
+ case 'linear':
24
+ return scaleSequential([config.min ?? 0, config.max ?? 100], getClampedSize(config.size));
25
+ case 'sqrt':
26
+ default:
27
+ return scaleSequentialSqrt([config.min ?? 0, config.max ?? 100], getClampedSize(config.size));
28
+ }
29
+ }
30
+ export function getOrdinalSizeScale(config) {
31
+ if (config.values) {
32
+ return scaleOrdinal(config.values, config.sizes).unknown(config.unknownSize ?? null);
33
+ }
34
+ return scaleOrdinal(config.sizes.map((_, index) => index), config.sizes).unknown(config.unknownSize ?? null);
35
+ }
36
+ export function getSizeScale(config) {
37
+ return config.type === 'ordinal' ? getOrdinalSizeScale(config) : getSequentialSizeScale(config);
38
+ }
package/models/axis.d.mts CHANGED
@@ -6,6 +6,7 @@ import { type DatasetElementType } from "./seriesType/config.mjs";
6
6
  import type { DefaultizedZoomOptions } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs";
7
7
  import { type ChartsAxisClasses } from "../ChartsAxis/axisClasses.mjs";
8
8
  import type { TickParams } from "../hooks/useTicks.mjs";
9
+ import type { AxisLinePropsOverrides, AxisTickPropsOverrides, AxisTickLabelPropsOverrides, AxisLabelPropsOverrides, XAxisPropsOverrides, YAxisPropsOverrides } from "./chartsSlotsComponentsProps.mjs";
9
10
  import type { ChartsTextProps } from "../ChartsText/index.mjs";
10
11
  import type { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from "./colorMapping.mjs";
11
12
  import type { OrdinalTimeTicks } from "./timeTicks.mjs";
@@ -28,40 +29,40 @@ export interface ChartsAxisSlots {
28
29
  * Custom component for the axis main line.
29
30
  * @default 'line'
30
31
  */
31
- axisLine?: React.JSXElementConstructor<React.SVGAttributes<SVGPathElement>>;
32
+ axisLine?: React.JSXElementConstructor<React.SVGAttributes<SVGPathElement> & AxisLinePropsOverrides>;
32
33
  /**
33
34
  * Custom component for the axis tick.
34
35
  * @default 'line'
35
36
  */
36
- axisTick?: React.JSXElementConstructor<React.SVGAttributes<SVGPathElement>>;
37
+ axisTick?: React.JSXElementConstructor<React.SVGAttributes<SVGPathElement> & AxisTickPropsOverrides>;
37
38
  /**
38
39
  * Custom component for tick label.
39
40
  * @default ChartsText
40
41
  */
41
- axisTickLabel?: React.JSXElementConstructor<ChartsTextProps>;
42
+ axisTickLabel?: React.JSXElementConstructor<ChartsTextProps & AxisTickLabelPropsOverrides>;
42
43
  /**
43
44
  * Custom component for axis label.
44
45
  * @default ChartsText
45
46
  */
46
- axisLabel?: React.JSXElementConstructor<ChartsTextProps>;
47
+ axisLabel?: React.JSXElementConstructor<ChartsTextProps & AxisLabelPropsOverrides>;
47
48
  /**
48
49
  * Custom component for the x-axis.
49
50
  * @default ChartsXAxis
50
51
  */
51
- xAxis?: React.JSXElementConstructor<ChartsXAxisProps>;
52
+ xAxis?: React.JSXElementConstructor<ChartsXAxisProps & XAxisPropsOverrides>;
52
53
  /**
53
54
  * Custom component for the y-axis.
54
55
  * @default ChartsYAxis
55
56
  */
56
- yAxis?: React.JSXElementConstructor<ChartsYAxisProps>;
57
+ yAxis?: React.JSXElementConstructor<ChartsYAxisProps & YAxisPropsOverrides>;
57
58
  }
58
59
  export interface ChartsAxisSlotProps {
59
- axisLine?: Partial<React.SVGAttributes<SVGPathElement>>;
60
- axisTick?: Partial<React.SVGAttributes<SVGPathElement>>;
61
- axisTickLabel?: Partial<ChartsTextProps>;
62
- axisLabel?: Partial<ChartsTextProps>;
63
- xAxis?: Partial<ChartsXAxisProps>;
64
- yAxis?: Partial<ChartsYAxisProps>;
60
+ axisLine?: Partial<React.SVGAttributes<SVGPathElement>> & AxisLinePropsOverrides;
61
+ axisTick?: Partial<React.SVGAttributes<SVGPathElement>> & AxisTickPropsOverrides;
62
+ axisTickLabel?: Partial<ChartsTextProps> & AxisTickLabelPropsOverrides;
63
+ axisLabel?: Partial<ChartsTextProps> & AxisLabelPropsOverrides;
64
+ xAxis?: Partial<ChartsXAxisProps> & XAxisPropsOverrides;
65
+ yAxis?: Partial<ChartsYAxisProps> & YAxisPropsOverrides;
65
66
  }
66
67
  export interface ChartsAxisProps extends TickParams {
67
68
  /**
@@ -515,6 +516,11 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
515
516
  min: NumberValue;
516
517
  max: NumberValue;
517
518
  });
519
+ /**
520
+ * Defines the series used to compute the axis domain.
521
+ * @default "all"
522
+ */
523
+ domainSeries?: 'all' | 'visible';
518
524
  /**
519
525
  * If `true`, the axis will be ignored by the tooltip with `trigger='axis'`.
520
526
  */
package/models/axis.d.ts CHANGED
@@ -6,6 +6,7 @@ import { type DatasetElementType } from "./seriesType/config.js";
6
6
  import type { DefaultizedZoomOptions } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
7
7
  import { type ChartsAxisClasses } from "../ChartsAxis/axisClasses.js";
8
8
  import type { TickParams } from "../hooks/useTicks.js";
9
+ import type { AxisLinePropsOverrides, AxisTickPropsOverrides, AxisTickLabelPropsOverrides, AxisLabelPropsOverrides, XAxisPropsOverrides, YAxisPropsOverrides } from "./chartsSlotsComponentsProps.js";
9
10
  import type { ChartsTextProps } from "../ChartsText/index.js";
10
11
  import type { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from "./colorMapping.js";
11
12
  import type { OrdinalTimeTicks } from "./timeTicks.js";
@@ -28,40 +29,40 @@ export interface ChartsAxisSlots {
28
29
  * Custom component for the axis main line.
29
30
  * @default 'line'
30
31
  */
31
- axisLine?: React.JSXElementConstructor<React.SVGAttributes<SVGPathElement>>;
32
+ axisLine?: React.JSXElementConstructor<React.SVGAttributes<SVGPathElement> & AxisLinePropsOverrides>;
32
33
  /**
33
34
  * Custom component for the axis tick.
34
35
  * @default 'line'
35
36
  */
36
- axisTick?: React.JSXElementConstructor<React.SVGAttributes<SVGPathElement>>;
37
+ axisTick?: React.JSXElementConstructor<React.SVGAttributes<SVGPathElement> & AxisTickPropsOverrides>;
37
38
  /**
38
39
  * Custom component for tick label.
39
40
  * @default ChartsText
40
41
  */
41
- axisTickLabel?: React.JSXElementConstructor<ChartsTextProps>;
42
+ axisTickLabel?: React.JSXElementConstructor<ChartsTextProps & AxisTickLabelPropsOverrides>;
42
43
  /**
43
44
  * Custom component for axis label.
44
45
  * @default ChartsText
45
46
  */
46
- axisLabel?: React.JSXElementConstructor<ChartsTextProps>;
47
+ axisLabel?: React.JSXElementConstructor<ChartsTextProps & AxisLabelPropsOverrides>;
47
48
  /**
48
49
  * Custom component for the x-axis.
49
50
  * @default ChartsXAxis
50
51
  */
51
- xAxis?: React.JSXElementConstructor<ChartsXAxisProps>;
52
+ xAxis?: React.JSXElementConstructor<ChartsXAxisProps & XAxisPropsOverrides>;
52
53
  /**
53
54
  * Custom component for the y-axis.
54
55
  * @default ChartsYAxis
55
56
  */
56
- yAxis?: React.JSXElementConstructor<ChartsYAxisProps>;
57
+ yAxis?: React.JSXElementConstructor<ChartsYAxisProps & YAxisPropsOverrides>;
57
58
  }
58
59
  export interface ChartsAxisSlotProps {
59
- axisLine?: Partial<React.SVGAttributes<SVGPathElement>>;
60
- axisTick?: Partial<React.SVGAttributes<SVGPathElement>>;
61
- axisTickLabel?: Partial<ChartsTextProps>;
62
- axisLabel?: Partial<ChartsTextProps>;
63
- xAxis?: Partial<ChartsXAxisProps>;
64
- yAxis?: Partial<ChartsYAxisProps>;
60
+ axisLine?: Partial<React.SVGAttributes<SVGPathElement>> & AxisLinePropsOverrides;
61
+ axisTick?: Partial<React.SVGAttributes<SVGPathElement>> & AxisTickPropsOverrides;
62
+ axisTickLabel?: Partial<ChartsTextProps> & AxisTickLabelPropsOverrides;
63
+ axisLabel?: Partial<ChartsTextProps> & AxisLabelPropsOverrides;
64
+ xAxis?: Partial<ChartsXAxisProps> & XAxisPropsOverrides;
65
+ yAxis?: Partial<ChartsYAxisProps> & YAxisPropsOverrides;
65
66
  }
66
67
  export interface ChartsAxisProps extends TickParams {
67
68
  /**
@@ -515,6 +516,11 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
515
516
  min: NumberValue;
516
517
  max: NumberValue;
517
518
  });
519
+ /**
520
+ * Defines the series used to compute the axis domain.
521
+ * @default "all"
522
+ */
523
+ domainSeries?: 'all' | 'visible';
518
524
  /**
519
525
  * If `true`, the axis will be ignored by the tooltip with `trigger='axis'`.
520
526
  */
@@ -0,0 +1,25 @@
1
+ export interface BaseButtonPropsOverrides {}
2
+ export interface BaseIconButtonPropsOverrides {}
3
+ export interface BaseToggleButtonPropsOverrides {}
4
+ export interface BaseToggleButtonGroupPropsOverrides {}
5
+ export interface AxisLinePropsOverrides {}
6
+ export interface AxisTickPropsOverrides {}
7
+ export interface AxisTickLabelPropsOverrides {}
8
+ export interface AxisLabelPropsOverrides {}
9
+ export interface XAxisPropsOverrides {}
10
+ export interface YAxisPropsOverrides {}
11
+ export interface BarPropsOverrides {}
12
+ export interface BarLabelPropsOverrides {}
13
+ export interface LinePropsOverrides {}
14
+ export interface AreaPropsOverrides {}
15
+ export interface MarkPropsOverrides {}
16
+ export interface LineHighlightPropsOverrides {}
17
+ export interface PieArcPropsOverrides {}
18
+ export interface PieArcLabelPropsOverrides {}
19
+ export interface ScatterPropsOverrides {}
20
+ export interface MarkerPropsOverrides {}
21
+ export interface LegendPropsOverrides {}
22
+ export interface LoadingOverlayPropsOverrides {}
23
+ export interface NoDataOverlayPropsOverrides {}
24
+ export interface ToolbarPropsOverrides {}
25
+ export interface TooltipPropsOverrides {}
@@ -0,0 +1,25 @@
1
+ export interface BaseButtonPropsOverrides {}
2
+ export interface BaseIconButtonPropsOverrides {}
3
+ export interface BaseToggleButtonPropsOverrides {}
4
+ export interface BaseToggleButtonGroupPropsOverrides {}
5
+ export interface AxisLinePropsOverrides {}
6
+ export interface AxisTickPropsOverrides {}
7
+ export interface AxisTickLabelPropsOverrides {}
8
+ export interface AxisLabelPropsOverrides {}
9
+ export interface XAxisPropsOverrides {}
10
+ export interface YAxisPropsOverrides {}
11
+ export interface BarPropsOverrides {}
12
+ export interface BarLabelPropsOverrides {}
13
+ export interface LinePropsOverrides {}
14
+ export interface AreaPropsOverrides {}
15
+ export interface MarkPropsOverrides {}
16
+ export interface LineHighlightPropsOverrides {}
17
+ export interface PieArcPropsOverrides {}
18
+ export interface PieArcLabelPropsOverrides {}
19
+ export interface ScatterPropsOverrides {}
20
+ export interface MarkerPropsOverrides {}
21
+ export interface LegendPropsOverrides {}
22
+ export interface LoadingOverlayPropsOverrides {}
23
+ export interface NoDataOverlayPropsOverrides {}
24
+ export interface ToolbarPropsOverrides {}
25
+ export interface TooltipPropsOverrides {}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -2,6 +2,7 @@ export * from "./seriesType/index.mjs";
2
2
  export * from "./stacking.mjs";
3
3
  export * from "./slots/index.mjs";
4
4
  export * from "./featureFlags.mjs";
5
+ export * from "./chartsSlotsComponentsProps.mjs";
5
6
  export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis, AxisItemIdentifier, AxisValueFormatterContext } from "./axis.mjs";
6
7
  export type { NumberValue } from '@mui/x-charts-vendor/d3-scale';
7
8
  export type { PropsFromSlot } from '@mui/x-internals/slots';
package/models/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./seriesType/index.js";
2
2
  export * from "./stacking.js";
3
3
  export * from "./slots/index.js";
4
4
  export * from "./featureFlags.js";
5
+ export * from "./chartsSlotsComponentsProps.js";
5
6
  export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis, AxisItemIdentifier, AxisValueFormatterContext } from "./axis.js";
6
7
  export type { NumberValue } from '@mui/x-charts-vendor/d3-scale';
7
8
  export type { PropsFromSlot } from '@mui/x-internals/slots';
package/models/index.js CHANGED
@@ -46,4 +46,15 @@ Object.keys(_featureFlags).forEach(function (key) {
46
46
  return _featureFlags[key];
47
47
  }
48
48
  });
49
+ });
50
+ var _chartsSlotsComponentsProps = require("./chartsSlotsComponentsProps");
51
+ Object.keys(_chartsSlotsComponentsProps).forEach(function (key) {
52
+ if (key === "default" || key === "__esModule") return;
53
+ if (key in exports && exports[key] === _chartsSlotsComponentsProps[key]) return;
54
+ Object.defineProperty(exports, key, {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _chartsSlotsComponentsProps[key];
58
+ }
59
+ });
49
60
  });
package/models/index.mjs CHANGED
@@ -2,6 +2,7 @@ export * from "./seriesType/index.mjs";
2
2
  export * from "./stacking.mjs";
3
3
  export * from "./slots/index.mjs";
4
4
  export * from "./featureFlags.mjs";
5
+ export * from "./chartsSlotsComponentsProps.mjs";
5
6
 
6
7
  // Utils shared across the X packages
7
8
  export {};
@@ -52,7 +52,7 @@ export interface CommonBarSeriesType {
52
52
  */
53
53
  barLabel?: 'value' | ((item: BarItem, context: BarLabelContext) => string | null | undefined);
54
54
  }
55
- export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'bar'>, CartesianSeriesType, StackableSeriesType, CommonBarSeriesType {
55
+ export interface BarSeriesType extends CommonSeriesType<'bar'>, CartesianSeriesType, StackableSeriesType, CommonBarSeriesType {
56
56
  type: 'bar';
57
57
  /**
58
58
  * The placement of the bar label. It accepts the following values:
@@ -52,7 +52,7 @@ export interface CommonBarSeriesType {
52
52
  */
53
53
  barLabel?: 'value' | ((item: BarItem, context: BarLabelContext) => string | null | undefined);
54
54
  }
55
- export interface BarSeriesType extends CommonSeriesType<BarValueType | null, 'bar'>, CartesianSeriesType, StackableSeriesType, CommonBarSeriesType {
55
+ export interface BarSeriesType extends CommonSeriesType<'bar'>, CartesianSeriesType, StackableSeriesType, CommonBarSeriesType {
56
56
  type: 'bar';
57
57
  /**
58
58
  * The placement of the bar label. It accepts the following values:
@@ -1,7 +1,7 @@
1
1
  import type { StackOffsetType, StackOrderType } from "../stacking.mjs";
2
2
  import type { ChartsLabelMarkType } from "../../ChartsLabel/ChartsLabelMark.mjs";
3
3
  import type { AxisId } from "../axis.mjs";
4
- import type { ChartSeriesType, HighlightScope } from "./config.mjs";
4
+ import type { ChartSeriesType, ChartsSeriesConfig, HighlightScope } from "./config.mjs";
5
5
  /**
6
6
  * The unique identifier of a series.
7
7
  */
@@ -33,18 +33,18 @@ export interface SeriesColor<TValue> {
33
33
  */
34
34
  colorGetter?: (data: ColorCallbackValue<TValue>) => string;
35
35
  }
36
- export interface CommonSeriesType<TValue, SeriesType extends ChartSeriesType> extends SeriesColor<TValue> {
36
+ export interface CommonSeriesType<SeriesType extends ChartSeriesType> extends SeriesColor<ChartsSeriesConfig[SeriesType]['valueType']> {
37
37
  /**
38
38
  * The id of this series.
39
39
  */
40
40
  id?: SeriesId;
41
41
  /**
42
42
  * Formatter used to render values in tooltip or other data display.
43
- * @param {TValue} value The series' value to render.
43
+ * @param {ChartsSeriesConfig[SeriesType]['valueType']} value The series' value to render.
44
44
  * @param {SeriesValueFormatterContext} context The rendering context of the value.
45
45
  * @returns {string | null} The string to display or null if the value should not be shown.
46
46
  */
47
- valueFormatter?: SeriesValueFormatter<TValue>;
47
+ valueFormatter?: SeriesValueFormatter<ChartsSeriesConfig[SeriesType]['valueType']>;
48
48
  /**
49
49
  * The scope to apply when the series is highlighted.
50
50
  */
@@ -1,7 +1,7 @@
1
1
  import type { StackOffsetType, StackOrderType } from "../stacking.js";
2
2
  import type { ChartsLabelMarkType } from "../../ChartsLabel/ChartsLabelMark.js";
3
3
  import type { AxisId } from "../axis.js";
4
- import type { ChartSeriesType, HighlightScope } from "./config.js";
4
+ import type { ChartSeriesType, ChartsSeriesConfig, HighlightScope } from "./config.js";
5
5
  /**
6
6
  * The unique identifier of a series.
7
7
  */
@@ -33,18 +33,18 @@ export interface SeriesColor<TValue> {
33
33
  */
34
34
  colorGetter?: (data: ColorCallbackValue<TValue>) => string;
35
35
  }
36
- export interface CommonSeriesType<TValue, SeriesType extends ChartSeriesType> extends SeriesColor<TValue> {
36
+ export interface CommonSeriesType<SeriesType extends ChartSeriesType> extends SeriesColor<ChartsSeriesConfig[SeriesType]['valueType']> {
37
37
  /**
38
38
  * The id of this series.
39
39
  */
40
40
  id?: SeriesId;
41
41
  /**
42
42
  * Formatter used to render values in tooltip or other data display.
43
- * @param {TValue} value The series' value to render.
43
+ * @param {ChartsSeriesConfig[SeriesType]['valueType']} value The series' value to render.
44
44
  * @param {SeriesValueFormatterContext} context The rendering context of the value.
45
45
  * @returns {string | null} The string to display or null if the value should not be shown.
46
46
  */
47
- valueFormatter?: SeriesValueFormatter<TValue>;
47
+ valueFormatter?: SeriesValueFormatter<ChartsSeriesConfig[SeriesType]['valueType']>;
48
48
  /**
49
49
  * The scope to apply when the series is highlighted.
50
50
  */
@@ -2,7 +2,7 @@ import type { DefaultizedProps, MakeOptional, MakeRequired } from '@mui/x-intern
2
2
  import type { ScatterSeriesType, DefaultizedScatterSeriesType, ScatterItemIdentifier, ScatterValueType } from "./scatter.mjs";
3
3
  import type { LineSeriesType, DefaultizedLineSeriesType, LineItemIdentifier } from "./line.mjs";
4
4
  import type { BarItemIdentifier, BarSeriesType, DefaultizedBarSeriesType } from "./bar.mjs";
5
- import type { PieSeriesType, DefaultizedPieSeriesType, PieItemIdentifier, PieValueType, DefaultizedPieValueType, PieSeriesLayout } from "./pie.mjs";
5
+ import type { PieSeriesType, DefaultizedPieSeriesType, PieItemIdentifier, PieValueType, PieSeriesLayout } from "./pie.mjs";
6
6
  import type { DefaultizedRadarSeriesType, RadarItemIdentifier, RadarSeriesType } from "./radar.mjs";
7
7
  import type { SeriesColor, SeriesId } from "./common.mjs";
8
8
  import type { ChartsRadiusAxisProps, ChartsRotationAxisProps, ComputedXAxis, ComputedYAxis, PolarAxisDefaultized } from "../axis.mjs";
@@ -74,7 +74,7 @@ export interface ChartsSeriesConfig {
74
74
  };
75
75
  };
76
76
  scatter: {
77
- seriesInput: DefaultizedProps<ScatterSeriesType, 'id'> & MakeRequired<SeriesColor<ScatterValueType | null>, 'color'>;
77
+ seriesInput: DefaultizedProps<ScatterSeriesType, 'id'> & MakeRequired<SeriesColor<ScatterValueType>, 'color'>;
78
78
  series: DefaultizedScatterSeriesType;
79
79
  seriesLayout: {};
80
80
  seriesProp: ScatterSeriesType;
@@ -104,7 +104,7 @@ export interface ChartsSeriesConfig {
104
104
  seriesProp: PieSeriesType<MakeOptional<PieValueType, 'id'>>;
105
105
  itemIdentifier: PieItemIdentifier;
106
106
  itemIdentifierWithData: PieItemIdentifier;
107
- valueType: DefaultizedPieValueType;
107
+ valueType: PieValueType;
108
108
  highlightScope: CommonHighlightScope;
109
109
  descriptionGetterParams: {
110
110
  identifier: PieItemIdentifier;