@mui/x-charts 9.2.0 → 9.4.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 (228) hide show
  1. package/BarChart/BarChart.js +10 -10
  2. package/BarChart/BarChart.mjs +10 -10
  3. package/BarChart/BarElement.d.mts +3 -2
  4. package/BarChart/BarElement.d.ts +3 -2
  5. package/BarChart/BarLabel/BarLabelItem.d.mts +3 -2
  6. package/BarChart/BarLabel/BarLabelItem.d.ts +3 -2
  7. package/BarChart/seriesConfig/bar/extremums.js +7 -2
  8. package/BarChart/seriesConfig/bar/extremums.mjs +7 -2
  9. package/BarChart/seriesConfig/bar/getColor.js +7 -53
  10. package/BarChart/seriesConfig/bar/getColor.mjs +7 -53
  11. package/BarChart/seriesConfig/bar/seriesProcessor.js +3 -1
  12. package/BarChart/seriesConfig/bar/seriesProcessor.mjs +3 -1
  13. package/BarChart/seriesConfig/bar/tooltip.js +4 -27
  14. package/BarChart/seriesConfig/bar/tooltip.mjs +4 -27
  15. package/CHANGELOG.md +314 -0
  16. package/ChartsContainer/ChartsContainer.js +30 -9
  17. package/ChartsContainer/ChartsContainer.mjs +30 -9
  18. package/ChartsLabel/ChartsLabelMark.js +1 -23
  19. package/ChartsLabel/ChartsLabelMark.mjs +0 -22
  20. package/ChartsLabel/labelMarkClasses.d.mts +0 -1
  21. package/ChartsLabel/labelMarkClasses.d.ts +0 -1
  22. package/ChartsLabel/labelMarkClasses.js +1 -2
  23. package/ChartsLabel/labelMarkClasses.mjs +2 -2
  24. package/ChartsLayerContainer/ChartsLayerContainer.js +36 -30
  25. package/ChartsLayerContainer/ChartsLayerContainer.mjs +36 -30
  26. package/ChartsLegend/chartsLegend.types.d.mts +3 -2
  27. package/ChartsLegend/chartsLegend.types.d.ts +3 -2
  28. package/ChartsLegend/piecewiseColorLegendClasses.js +8 -2
  29. package/ChartsLegend/piecewiseColorLegendClasses.mjs +8 -2
  30. package/ChartsOverlay/ChartsOverlay.d.mts +5 -4
  31. package/ChartsOverlay/ChartsOverlay.d.ts +5 -4
  32. package/ChartsReferenceLine/ChartsXReferenceLine.js +6 -1
  33. package/ChartsReferenceLine/ChartsXReferenceLine.mjs +6 -1
  34. package/ChartsReferenceLine/ChartsYReferenceLine.js +5 -0
  35. package/ChartsReferenceLine/ChartsYReferenceLine.mjs +5 -0
  36. package/ChartsTooltip/ChartTooltip.types.d.mts +3 -2
  37. package/ChartsTooltip/ChartTooltip.types.d.ts +3 -2
  38. package/ChartsTooltip/useAxesTooltip.js +2 -2
  39. package/ChartsTooltip/useAxesTooltip.mjs +2 -2
  40. package/ChartsTooltip/useItemTooltip.js +2 -2
  41. package/ChartsTooltip/useItemTooltip.mjs +2 -2
  42. package/ChartsXAxis/ChartsXAxis.js +3 -1
  43. package/ChartsXAxis/ChartsXAxis.mjs +3 -1
  44. package/ChartsXAxis/useAxisTicksProps.d.mts +84 -3
  45. package/ChartsXAxis/useAxisTicksProps.d.ts +84 -3
  46. package/ChartsYAxis/ChartsYAxis.js +3 -1
  47. package/ChartsYAxis/ChartsYAxis.mjs +3 -1
  48. package/ChartsYAxis/useAxisTicksProps.d.mts +84 -3
  49. package/ChartsYAxis/useAxisTicksProps.d.ts +84 -3
  50. package/LineChart/AreaElement.d.mts +3 -2
  51. package/LineChart/AreaElement.d.ts +3 -2
  52. package/LineChart/LineChart.js +6 -6
  53. package/LineChart/LineChart.mjs +6 -6
  54. package/LineChart/LineElement.d.mts +3 -2
  55. package/LineChart/LineElement.d.ts +3 -2
  56. package/LineChart/LineHighlightPlot.d.mts +3 -2
  57. package/LineChart/LineHighlightPlot.d.ts +3 -2
  58. package/LineChart/LineHighlightPlot.js +65 -45
  59. package/LineChart/LineHighlightPlot.mjs +65 -45
  60. package/LineChart/MarkPlot.d.mts +3 -2
  61. package/LineChart/MarkPlot.d.ts +3 -2
  62. package/LineChart/seriesConfig/curveEvaluation.js +40 -15
  63. package/LineChart/seriesConfig/curveEvaluation.mjs +39 -15
  64. package/LineChart/seriesConfig/extremums.js +5 -1
  65. package/LineChart/seriesConfig/extremums.mjs +5 -1
  66. package/LineChart/seriesConfig/getColor.js +7 -54
  67. package/LineChart/seriesConfig/getColor.mjs +7 -54
  68. package/LineChart/seriesConfig/seriesProcessor.d.mts +2 -4
  69. package/LineChart/seriesConfig/seriesProcessor.d.ts +2 -4
  70. package/LineChart/seriesConfig/seriesProcessor.js +2 -139
  71. package/LineChart/seriesConfig/seriesProcessor.mjs +2 -138
  72. package/LineChart/seriesConfig/tooltip.js +4 -25
  73. package/LineChart/seriesConfig/tooltip.mjs +4 -25
  74. package/LineChart/useMarkPlotData.js +3 -1
  75. package/LineChart/useMarkPlotData.mjs +3 -1
  76. package/PieChart/PieArcLabelPlot.d.mts +3 -2
  77. package/PieChart/PieArcLabelPlot.d.ts +3 -2
  78. package/PieChart/PieArcPlot.d.mts +3 -2
  79. package/PieChart/PieArcPlot.d.ts +3 -2
  80. package/PieChart/PieChart.js +6 -6
  81. package/PieChart/PieChart.mjs +6 -6
  82. package/RadarChart/RadarAxis/RadarAxis.utils.d.mts +2 -2
  83. package/RadarChart/RadarAxis/RadarAxis.utils.d.ts +2 -2
  84. package/RadarChart/RadarAxis/useRadarAxis.js +1 -1
  85. package/RadarChart/RadarAxis/useRadarAxis.mjs +1 -1
  86. package/RadarChart/RadarChart.js +8 -8
  87. package/RadarChart/RadarChart.mjs +8 -8
  88. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +3 -1
  89. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.mjs +3 -1
  90. package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +1 -0
  91. package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.mjs +1 -0
  92. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +1 -0
  93. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.mjs +1 -0
  94. package/ScatterChart/BatchScatter.d.mts +2 -8
  95. package/ScatterChart/BatchScatter.d.ts +2 -8
  96. package/ScatterChart/BatchScatter.js +17 -12
  97. package/ScatterChart/BatchScatter.mjs +17 -12
  98. package/ScatterChart/FocusedScatterMark.js +2 -2
  99. package/ScatterChart/FocusedScatterMark.mjs +2 -2
  100. package/ScatterChart/HighlightedScatterMark.js +3 -3
  101. package/ScatterChart/HighlightedScatterMark.mjs +3 -3
  102. package/ScatterChart/Scatter.d.mts +5 -0
  103. package/ScatterChart/Scatter.d.ts +5 -0
  104. package/ScatterChart/Scatter.js +7 -2
  105. package/ScatterChart/Scatter.mjs +7 -2
  106. package/ScatterChart/ScatterChart.d.mts +2 -1
  107. package/ScatterChart/ScatterChart.d.ts +2 -1
  108. package/ScatterChart/ScatterChart.js +32 -11
  109. package/ScatterChart/ScatterChart.mjs +32 -11
  110. package/ScatterChart/ScatterMarker.types.d.mts +3 -2
  111. package/ScatterChart/ScatterMarker.types.d.ts +3 -2
  112. package/ScatterChart/ScatterPlot.d.mts +3 -2
  113. package/ScatterChart/ScatterPlot.d.ts +3 -2
  114. package/ScatterChart/ScatterPlot.js +6 -1
  115. package/ScatterChart/ScatterPlot.mjs +6 -1
  116. package/ScatterChart/seriesConfig/extremums.js +6 -0
  117. package/ScatterChart/seriesConfig/extremums.mjs +6 -0
  118. package/ScatterChart/seriesConfig/getColor.js +1 -1
  119. package/ScatterChart/seriesConfig/getColor.mjs +1 -1
  120. package/ScatterChart/seriesConfig/getMarkerSize.d.mts +18 -0
  121. package/ScatterChart/seriesConfig/getMarkerSize.d.ts +18 -0
  122. package/ScatterChart/seriesConfig/getMarkerSize.js +43 -0
  123. package/ScatterChart/seriesConfig/getMarkerSize.mjs +37 -0
  124. package/ScatterChart/seriesConfig/seriesProcessor.js +23 -8
  125. package/ScatterChart/seriesConfig/seriesProcessor.mjs +23 -8
  126. package/ScatterChart/seriesConfig/tooltip.js +2 -24
  127. package/ScatterChart/seriesConfig/tooltip.mjs +2 -24
  128. package/ScatterChart/useScatterItemPosition.d.mts +4 -0
  129. package/ScatterChart/useScatterItemPosition.d.ts +4 -0
  130. package/ScatterChart/useScatterItemPosition.js +9 -0
  131. package/ScatterChart/useScatterItemPosition.mjs +8 -0
  132. package/SparkLineChart/SparkLineChart.js +27 -27
  133. package/SparkLineChart/SparkLineChart.mjs +27 -27
  134. package/Toolbar/Toolbar.types.d.mts +3 -2
  135. package/Toolbar/Toolbar.types.d.ts +3 -2
  136. package/index.js +1 -1
  137. package/index.mjs +1 -1
  138. package/internals/animation/animation.d.mts +1 -2
  139. package/internals/animation/animation.d.ts +1 -2
  140. package/internals/commonNextFocusItem.d.mts +10 -2
  141. package/internals/commonNextFocusItem.d.ts +10 -2
  142. package/internals/commonNextFocusItem.js +12 -4
  143. package/internals/commonNextFocusItem.mjs +12 -4
  144. package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.js +1 -1
  145. package/internals/components/ChartsAccessibilityProxy/ChartsAccessibilityProxy.mjs +1 -1
  146. package/internals/createCommonKeyboardFocusHandler.d.mts +1 -1
  147. package/internals/createCommonKeyboardFocusHandler.d.ts +1 -1
  148. package/internals/createCommonKeyboardFocusHandler.js +3 -3
  149. package/internals/createCommonKeyboardFocusHandler.mjs +3 -3
  150. package/internals/getLineLikeTooltip.d.mts +9 -0
  151. package/internals/getLineLikeTooltip.d.ts +9 -0
  152. package/internals/getLineLikeTooltip.js +38 -0
  153. package/internals/getLineLikeTooltip.mjs +31 -0
  154. package/internals/incompleteDatasetKeysError.d.mts +1 -0
  155. package/internals/incompleteDatasetKeysError.d.ts +1 -0
  156. package/internals/incompleteDatasetKeysError.js +11 -0
  157. package/internals/incompleteDatasetKeysError.mjs +4 -0
  158. package/internals/index.d.mts +5 -0
  159. package/internals/index.d.ts +5 -0
  160. package/internals/index.js +48 -0
  161. package/internals/index.mjs +5 -0
  162. package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipGetter.types.d.mts +4 -2
  163. package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipGetter.types.d.ts +4 -2
  164. package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
  165. package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.mjs +4 -3
  166. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
  167. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +3 -3
  168. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.mts +10 -1
  169. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +10 -1
  170. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +18 -1
  171. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.mjs +16 -0
  172. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +11 -3
  173. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +11 -3
  174. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +24 -5
  175. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.mjs +24 -5
  176. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.mts +1 -1
  177. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -1
  178. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +46 -2
  179. package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.mjs +47 -2
  180. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +46 -11
  181. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +46 -11
  182. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.mts +2 -1
  183. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.ts +2 -1
  184. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +6 -2
  185. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.mjs +6 -2
  186. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.mts +4 -0
  187. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +4 -0
  188. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +3 -1
  189. package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.mjs +1 -0
  190. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +5 -3
  191. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +7 -5
  192. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +17 -3
  193. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +17 -3
  194. package/internals/processLineLikeSeries.d.mts +6 -0
  195. package/internals/processLineLikeSeries.d.ts +6 -0
  196. package/internals/processLineLikeSeries.js +145 -0
  197. package/internals/processLineLikeSeries.mjs +138 -0
  198. package/internals/resolveColorProcessor.d.mts +11 -0
  199. package/internals/resolveColorProcessor.d.ts +11 -0
  200. package/internals/resolveColorProcessor.js +62 -0
  201. package/internals/resolveColorProcessor.mjs +56 -0
  202. package/internals/sizeScale.d.mts +6 -0
  203. package/internals/sizeScale.d.ts +6 -0
  204. package/internals/sizeScale.js +46 -0
  205. package/internals/sizeScale.mjs +38 -0
  206. package/models/axis.d.mts +18 -12
  207. package/models/axis.d.ts +18 -12
  208. package/models/chartsSlotsComponentsProps.d.mts +25 -0
  209. package/models/chartsSlotsComponentsProps.d.ts +25 -0
  210. package/models/chartsSlotsComponentsProps.js +5 -0
  211. package/models/chartsSlotsComponentsProps.mjs +1 -0
  212. package/models/index.d.mts +1 -0
  213. package/models/index.d.ts +1 -0
  214. package/models/index.js +11 -0
  215. package/models/index.mjs +1 -0
  216. package/models/seriesType/line.d.mts +5 -2
  217. package/models/seriesType/line.d.ts +5 -2
  218. package/models/seriesType/scatter.d.mts +34 -2
  219. package/models/seriesType/scatter.d.ts +34 -2
  220. package/models/sizeMapping.d.mts +64 -0
  221. package/models/sizeMapping.d.ts +64 -0
  222. package/models/sizeMapping.js +5 -0
  223. package/models/sizeMapping.mjs +1 -0
  224. package/models/slots/chartsBaseSlots.d.mts +6 -5
  225. package/models/slots/chartsBaseSlots.d.ts +6 -5
  226. package/models/z-axis.d.mts +10 -1
  227. package/models/z-axis.d.ts +10 -1
  228. package/package.json +6 -6
@@ -46,6 +46,7 @@ function Scatter(props) {
46
46
  xScale,
47
47
  yScale,
48
48
  colorGetter,
49
+ sizeGetter,
49
50
  onItemClick,
50
51
  classes: inClasses,
51
52
  slots,
@@ -64,8 +65,7 @@ function Scatter(props) {
64
65
  elementType: Marker,
65
66
  externalSlotProps: slotProps?.marker,
66
67
  additionalProps: {
67
- seriesId: series.id,
68
- size: series.markerSize
68
+ seriesId: series.id
69
69
  },
70
70
  ownerState: {}
71
71
  }),
@@ -84,6 +84,7 @@ function Scatter(props) {
84
84
  className: clsx(classes.marker, markerProps.className),
85
85
  dataIndex: dataPoint.dataIndex,
86
86
  color: colorGetter(dataPoint.dataIndex),
87
+ size: sizeGetter(dataPoint.dataIndex),
87
88
  isHighlighted: isItemHighlighted,
88
89
  isFaded: isItemFaded,
89
90
  x: dataPoint.x,
@@ -119,6 +120,10 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
119
120
  */
120
121
  onItemClick: PropTypes.func,
121
122
  series: PropTypes.object.isRequired,
123
+ /**
124
+ * Function to get the marker size of a scatter item given its data index.
125
+ */
126
+ sizeGetter: PropTypes.func.isRequired,
122
127
  slotProps: PropTypes.object,
123
128
  slots: PropTypes.object,
124
129
  xScale: PropTypes.func.isRequired,
@@ -7,6 +7,7 @@ import { type ChartsContainerProps } from "../ChartsContainer/index.mjs";
7
7
  import { type ScatterSeriesType } from "../models/seriesType/scatter.mjs";
8
8
  import { type ChartsTooltipProps } from "../ChartsTooltip/index.mjs";
9
9
  import { type ChartsTooltipSlots, type ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.mjs";
10
+ import type { TooltipPropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
10
11
  import { type ChartsLegendSlotProps, type ChartsLegendSlots } from "../ChartsLegend/index.mjs";
11
12
  import { type ChartsOverlayProps, type ChartsOverlaySlotProps, type ChartsOverlaySlots } from "../ChartsOverlay/index.mjs";
12
13
  import { type ChartsAxisHighlightProps } from "../ChartsAxisHighlight/index.mjs";
@@ -20,7 +21,7 @@ export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotS
20
21
  * Slot props for the tooltip component.
21
22
  * @default {}
22
23
  */
23
- tooltip?: Partial<ChartsTooltipProps<'item' | 'none'>>;
24
+ tooltip?: Partial<ChartsTooltipProps<'item' | 'none'>> & TooltipPropsOverrides;
24
25
  }
25
26
  export type ScatterSeries = MakeOptional<ScatterSeriesType, 'type'>;
26
27
  export interface ScatterChartProps extends Omit<ChartsContainerProps<'scatter', ScatterChartPluginSignatures>, 'series' | 'plugins' | 'onItemClick' | 'highlightedAxis' | 'onHighlightedAxisChange'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ScatterPlotProps, 'renderer'> {
@@ -7,6 +7,7 @@ import { type ChartsContainerProps } from "../ChartsContainer/index.js";
7
7
  import { type ScatterSeriesType } from "../models/seriesType/scatter.js";
8
8
  import { type ChartsTooltipProps } from "../ChartsTooltip/index.js";
9
9
  import { type ChartsTooltipSlots, type ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.js";
10
+ import type { TooltipPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
10
11
  import { type ChartsLegendSlotProps, type ChartsLegendSlots } from "../ChartsLegend/index.js";
11
12
  import { type ChartsOverlayProps, type ChartsOverlaySlotProps, type ChartsOverlaySlots } from "../ChartsOverlay/index.js";
12
13
  import { type ChartsAxisHighlightProps } from "../ChartsAxisHighlight/index.js";
@@ -20,7 +21,7 @@ export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotS
20
21
  * Slot props for the tooltip component.
21
22
  * @default {}
22
23
  */
23
- tooltip?: Partial<ChartsTooltipProps<'item' | 'none'>>;
24
+ tooltip?: Partial<ChartsTooltipProps<'item' | 'none'>> & TooltipPropsOverrides;
24
25
  }
25
26
  export type ScatterSeries = MakeOptional<ScatterSeriesType, 'type'>;
26
27
  export interface ScatterChartProps extends Omit<ChartsContainerProps<'scatter', ScatterChartPluginSignatures>, 'series' | 'plugins' | 'onItemClick' | 'highlightedAxis' | 'onHighlightedAxisChange'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ScatterPlotProps, 'renderer'> {
@@ -199,11 +199,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
199
199
  */
200
200
  highlightedItem: _propTypes.default.oneOfType([_propTypes.default.shape({
201
201
  dataIndex: _propTypes.default.number,
202
- seriesId: _propTypes.default.string.isRequired,
203
- type: _propTypes.default.oneOf(['scatter']).isRequired
202
+ seriesId: _propTypes.default.string.isRequired
204
203
  }), _propTypes.default.shape({
205
204
  dataIndex: _propTypes.default.number,
206
- seriesId: _propTypes.default.string.isRequired
205
+ seriesId: _propTypes.default.string.isRequired,
206
+ type: _propTypes.default.oneOf(['scatter']).isRequired
207
207
  })]),
208
208
  /**
209
209
  * Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
@@ -360,11 +360,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
360
360
  */
361
361
  tooltipItem: _propTypes.default.oneOfType([_propTypes.default.shape({
362
362
  dataIndex: _propTypes.default.number.isRequired,
363
- seriesId: _propTypes.default.string.isRequired,
364
- type: _propTypes.default.oneOf(['scatter']).isRequired
363
+ seriesId: _propTypes.default.string.isRequired
365
364
  }), _propTypes.default.shape({
366
365
  dataIndex: _propTypes.default.number.isRequired,
367
- seriesId: _propTypes.default.string.isRequired
366
+ seriesId: _propTypes.default.string.isRequired,
367
+ type: _propTypes.default.oneOf(['scatter']).isRequired
368
368
  })]),
369
369
  /**
370
370
  * The width of the chart in px. If not defined, it takes the width of the parent element.
@@ -387,11 +387,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
387
387
  */
388
388
  zAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
389
389
  colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
390
- colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
391
- type: _propTypes.default.oneOf(['ordinal']).isRequired,
392
- unknownColor: _propTypes.default.string,
393
- values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
394
- }), _propTypes.default.shape({
395
390
  color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
396
391
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
397
392
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
@@ -400,12 +395,38 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
400
395
  colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
401
396
  thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
402
397
  type: _propTypes.default.oneOf(['piecewise']).isRequired
398
+ }), _propTypes.default.shape({
399
+ colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
400
+ type: _propTypes.default.oneOf(['ordinal']).isRequired,
401
+ unknownColor: _propTypes.default.string,
402
+ values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
403
403
  })]),
404
404
  data: _propTypes.default.array,
405
405
  dataKey: _propTypes.default.string,
406
406
  id: _propTypes.default.string,
407
407
  max: _propTypes.default.number,
408
408
  min: _propTypes.default.number,
409
+ sizeMap: _propTypes.default.oneOfType([_propTypes.default.shape({
410
+ interpolator: _propTypes.default.oneOf(['linear', 'log', 'sqrt']),
411
+ max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
412
+ min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
413
+ size: _propTypes.default.arrayOf(_propTypes.default.number.isRequired).isRequired,
414
+ type: _propTypes.default.oneOf(['continuous']).isRequired
415
+ }), _propTypes.default.shape({
416
+ max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
417
+ min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
418
+ size: _propTypes.default.func.isRequired,
419
+ type: _propTypes.default.oneOf(['continuous']).isRequired
420
+ }), _propTypes.default.shape({
421
+ sizes: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
422
+ thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
423
+ type: _propTypes.default.oneOf(['piecewise']).isRequired
424
+ }), _propTypes.default.shape({
425
+ sizes: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
426
+ type: _propTypes.default.oneOf(['ordinal']).isRequired,
427
+ unknownSize: _propTypes.default.number,
428
+ values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
429
+ })]),
409
430
  valueGetter: _propTypes.default.func
410
431
  }))
411
432
  } : void 0;
@@ -192,11 +192,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
192
192
  */
193
193
  highlightedItem: PropTypes.oneOfType([PropTypes.shape({
194
194
  dataIndex: PropTypes.number,
195
- seriesId: PropTypes.string.isRequired,
196
- type: PropTypes.oneOf(['scatter']).isRequired
195
+ seriesId: PropTypes.string.isRequired
197
196
  }), PropTypes.shape({
198
197
  dataIndex: PropTypes.number,
199
- seriesId: PropTypes.string.isRequired
198
+ seriesId: PropTypes.string.isRequired,
199
+ type: PropTypes.oneOf(['scatter']).isRequired
200
200
  })]),
201
201
  /**
202
202
  * Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
@@ -353,11 +353,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
353
353
  */
354
354
  tooltipItem: PropTypes.oneOfType([PropTypes.shape({
355
355
  dataIndex: PropTypes.number.isRequired,
356
- seriesId: PropTypes.string.isRequired,
357
- type: PropTypes.oneOf(['scatter']).isRequired
356
+ seriesId: PropTypes.string.isRequired
358
357
  }), PropTypes.shape({
359
358
  dataIndex: PropTypes.number.isRequired,
360
- seriesId: PropTypes.string.isRequired
359
+ seriesId: PropTypes.string.isRequired,
360
+ type: PropTypes.oneOf(['scatter']).isRequired
361
361
  })]),
362
362
  /**
363
363
  * The width of the chart in px. If not defined, it takes the width of the parent element.
@@ -380,11 +380,6 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
380
380
  */
381
381
  zAxis: PropTypes.arrayOf(PropTypes.shape({
382
382
  colorMap: PropTypes.oneOfType([PropTypes.shape({
383
- colors: PropTypes.arrayOf(PropTypes.string).isRequired,
384
- type: PropTypes.oneOf(['ordinal']).isRequired,
385
- unknownColor: PropTypes.string,
386
- values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
387
- }), PropTypes.shape({
388
383
  color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
389
384
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
390
385
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
@@ -393,12 +388,38 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
393
388
  colors: PropTypes.arrayOf(PropTypes.string).isRequired,
394
389
  thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
395
390
  type: PropTypes.oneOf(['piecewise']).isRequired
391
+ }), PropTypes.shape({
392
+ colors: PropTypes.arrayOf(PropTypes.string).isRequired,
393
+ type: PropTypes.oneOf(['ordinal']).isRequired,
394
+ unknownColor: PropTypes.string,
395
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
396
396
  })]),
397
397
  data: PropTypes.array,
398
398
  dataKey: PropTypes.string,
399
399
  id: PropTypes.string,
400
400
  max: PropTypes.number,
401
401
  min: PropTypes.number,
402
+ sizeMap: PropTypes.oneOfType([PropTypes.shape({
403
+ interpolator: PropTypes.oneOf(['linear', 'log', 'sqrt']),
404
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
405
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
406
+ size: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired,
407
+ type: PropTypes.oneOf(['continuous']).isRequired
408
+ }), PropTypes.shape({
409
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
410
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
411
+ size: PropTypes.func.isRequired,
412
+ type: PropTypes.oneOf(['continuous']).isRequired
413
+ }), PropTypes.shape({
414
+ sizes: PropTypes.arrayOf(PropTypes.number).isRequired,
415
+ thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
416
+ type: PropTypes.oneOf(['piecewise']).isRequired
417
+ }), PropTypes.shape({
418
+ sizes: PropTypes.arrayOf(PropTypes.number).isRequired,
419
+ type: PropTypes.oneOf(['ordinal']).isRequired,
420
+ unknownSize: PropTypes.number,
421
+ values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
422
+ })]),
402
423
  valueGetter: PropTypes.func
403
424
  }))
404
425
  } : void 0;
@@ -1,14 +1,15 @@
1
1
  import type * as React from 'react';
2
2
  import type { ScatterMarkerProps } from "./ScatterMarker.mjs";
3
+ import type { MarkerPropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
3
4
  export interface ScatterMarkerSlots {
4
5
  /**
5
6
  * The component that renders the marker for a scatter point.
6
7
  * @default ScatterMarker
7
8
  */
8
- marker?: React.JSXElementConstructor<ScatterMarkerProps>;
9
+ marker?: React.JSXElementConstructor<ScatterMarkerProps & MarkerPropsOverrides>;
9
10
  }
10
11
  export interface ScatterMarkerSlotProps {
11
- marker?: ScatterMarkerProps;
12
+ marker?: Partial<ScatterMarkerProps> & MarkerPropsOverrides;
12
13
  }
13
14
  export interface ScatterMarkerSlotExtension {
14
15
  /**
@@ -1,14 +1,15 @@
1
1
  import type * as React from 'react';
2
2
  import type { ScatterMarkerProps } from "./ScatterMarker.js";
3
+ import type { MarkerPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
3
4
  export interface ScatterMarkerSlots {
4
5
  /**
5
6
  * The component that renders the marker for a scatter point.
6
7
  * @default ScatterMarker
7
8
  */
8
- marker?: React.JSXElementConstructor<ScatterMarkerProps>;
9
+ marker?: React.JSXElementConstructor<ScatterMarkerProps & MarkerPropsOverrides>;
9
10
  }
10
11
  export interface ScatterMarkerSlotProps {
11
- marker?: ScatterMarkerProps;
12
+ marker?: Partial<ScatterMarkerProps> & MarkerPropsOverrides;
12
13
  }
13
14
  export interface ScatterMarkerSlotExtension {
14
15
  /**
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { type ScatterProps, type ScatterSlotProps, type ScatterSlots } from "./Scatter.mjs";
3
+ import type { ScatterPropsOverrides } from "../models/chartsSlotsComponentsProps.mjs";
3
4
  export interface ScatterPlotSlots extends ScatterSlots {
4
- scatter?: React.JSXElementConstructor<ScatterProps>;
5
+ scatter?: React.JSXElementConstructor<ScatterProps & ScatterPropsOverrides>;
5
6
  }
6
7
  export interface ScatterPlotSlotProps extends ScatterSlotProps {
7
- scatter?: Partial<ScatterProps>;
8
+ scatter?: Partial<ScatterProps> & ScatterPropsOverrides;
8
9
  }
9
10
  export type RendererType = 'svg-single' | 'svg-batch';
10
11
  export interface ScatterPlotProps extends Pick<ScatterProps, 'onItemClick' | 'classes'> {
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { type ScatterProps, type ScatterSlotProps, type ScatterSlots } from "./Scatter.js";
3
+ import type { ScatterPropsOverrides } from "../models/chartsSlotsComponentsProps.js";
3
4
  export interface ScatterPlotSlots extends ScatterSlots {
4
- scatter?: React.JSXElementConstructor<ScatterProps>;
5
+ scatter?: React.JSXElementConstructor<ScatterProps & ScatterPropsOverrides>;
5
6
  }
6
7
  export interface ScatterPlotSlotProps extends ScatterSlotProps {
7
- scatter?: Partial<ScatterProps>;
8
+ scatter?: Partial<ScatterProps> & ScatterPropsOverrides;
8
9
  }
9
10
  export type RendererType = 'svg-single' | 'svg-batch';
10
11
  export interface ScatterPlotProps extends Pick<ScatterProps, 'onItemClick' | 'classes'> {
@@ -17,6 +17,7 @@ var _useScatterSeries = require("../hooks/useScatterSeries");
17
17
  var _hooks = require("../hooks");
18
18
  var _useZAxis = require("../hooks/useZAxis");
19
19
  var _seriesConfig = require("./seriesConfig");
20
+ var _getMarkerSize = _interopRequireDefault(require("./seriesConfig/getMarkerSize"));
20
21
  var _BatchScatter = require("./BatchScatter");
21
22
  var _scatterClasses = require("./scatterClasses");
22
23
  var _jsxRuntime = require("react/jsx-runtime");
@@ -79,14 +80,17 @@ function ScatterPlot(props) {
79
80
  id,
80
81
  xAxisId,
81
82
  yAxisId,
83
+ colorAxisId,
82
84
  zAxisId,
85
+ sizeAxisId,
83
86
  color,
84
87
  hidden
85
88
  } = series[seriesId];
86
89
  if (hidden) {
87
90
  return null;
88
91
  }
89
- const colorGetter = _seriesConfig.scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
92
+ const colorGetter = _seriesConfig.scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[colorAxisId ?? zAxisId ?? defaultZAxisId]);
93
+ const sizeGetter = (0, _getMarkerSize.default)(series[seriesId], zAxis[sizeAxisId ?? defaultZAxisId]);
90
94
  const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
91
95
  const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
92
96
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterItems, (0, _extends2.default)({
@@ -94,6 +98,7 @@ function ScatterPlot(props) {
94
98
  yScale: yScale,
95
99
  color: color,
96
100
  colorGetter: colorGetter,
101
+ sizeGetter: sizeGetter,
97
102
  series: series[seriesId],
98
103
  onItemClick: onItemClick,
99
104
  slots: slots,
@@ -10,6 +10,7 @@ import { useScatterSeriesContext } from "../hooks/useScatterSeries.mjs";
10
10
  import { useXAxes, useYAxes } from "../hooks/index.mjs";
11
11
  import { useZAxes } from "../hooks/useZAxis.mjs";
12
12
  import { scatterSeriesConfig } from "./seriesConfig/index.mjs";
13
+ import getMarkerSize from "./seriesConfig/getMarkerSize.mjs";
13
14
  import { BatchScatter } from "./BatchScatter.mjs";
14
15
  import { useUtilityClasses } from "./scatterClasses.mjs";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -72,14 +73,17 @@ function ScatterPlot(props) {
72
73
  id,
73
74
  xAxisId,
74
75
  yAxisId,
76
+ colorAxisId,
75
77
  zAxisId,
78
+ sizeAxisId,
76
79
  color,
77
80
  hidden
78
81
  } = series[seriesId];
79
82
  if (hidden) {
80
83
  return null;
81
84
  }
82
- const colorGetter = scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
85
+ const colorGetter = scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[colorAxisId ?? zAxisId ?? defaultZAxisId]);
86
+ const sizeGetter = getMarkerSize(series[seriesId], zAxis[sizeAxisId ?? defaultZAxisId]);
83
87
  const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
84
88
  const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
85
89
  return /*#__PURE__*/_jsx(ScatterItems, _extends({
@@ -87,6 +91,7 @@ function ScatterPlot(props) {
87
91
  yScale: yScale,
88
92
  color: color,
89
93
  colorGetter: colorGetter,
94
+ sizeGetter: sizeGetter,
90
95
  series: series[seriesId],
91
96
  onItemClick: onItemClick,
92
97
  slots: slots,
@@ -17,6 +17,9 @@ const getExtremumX = params => {
17
17
  if (!Object.hasOwn(series, seriesId)) {
18
18
  continue;
19
19
  }
20
+ if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
21
+ continue;
22
+ }
20
23
  const axisId = series[seriesId].xAxisId;
21
24
  if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
22
25
  continue;
@@ -59,6 +62,9 @@ const getExtremumY = params => {
59
62
  if (!Object.hasOwn(series, seriesId)) {
60
63
  continue;
61
64
  }
65
+ if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
66
+ continue;
67
+ }
62
68
  const axisId = series[seriesId].yAxisId;
63
69
  if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
64
70
  continue;
@@ -11,6 +11,9 @@ export const getExtremumX = params => {
11
11
  if (!Object.hasOwn(series, seriesId)) {
12
12
  continue;
13
13
  }
14
+ if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
15
+ continue;
16
+ }
14
17
  const axisId = series[seriesId].xAxisId;
15
18
  if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
16
19
  continue;
@@ -52,6 +55,9 @@ export const getExtremumY = params => {
52
55
  if (!Object.hasOwn(series, seriesId)) {
53
56
  continue;
54
57
  }
58
+ if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
59
+ continue;
60
+ }
55
61
  const axisId = series[seriesId].yAxisId;
56
62
  if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
57
63
  continue;
@@ -25,7 +25,7 @@ const getColor = (series, xAxis, yAxis, zAxis) => {
25
25
  const color = value === null ? getSeriesColor({
26
26
  value,
27
27
  dataIndex
28
- }) : zColorScale(value.z);
28
+ }) : zColorScale(value.colorValue ?? value.z);
29
29
  if (color === null) {
30
30
  return getSeriesColor({
31
31
  value,
@@ -19,7 +19,7 @@ const getColor = (series, xAxis, yAxis, zAxis) => {
19
19
  const color = value === null ? getSeriesColor({
20
20
  value,
21
21
  dataIndex
22
- }) : zColorScale(value.z);
22
+ }) : zColorScale(value.colorValue ?? value.z);
23
23
  if (color === null) {
24
24
  return getSeriesColor({
25
25
  value,
@@ -0,0 +1,18 @@
1
+ import { type DefaultizedScatterSeriesType } from "../../models/seriesType/scatter.mjs";
2
+ import { type ZAxisDefaultized } from "../../models/z-axis.mjs";
3
+ /**
4
+ * Returns the marker size of a scatter item given its data index.
5
+ * @param {number} dataIndex The index of the scatter item.
6
+ * @returns {number} The marker size in pixels.
7
+ */
8
+ export type ScatterSizeGetter = (dataIndex: number) => number;
9
+ /**
10
+ * Builds a getter returning the marker size of each scatter item.
11
+ *
12
+ * When the size axis defines a `sizeMap`, the size is computed by mapping a value
13
+ * through the resulting `sizeScale`. The mapped value is taken from the size axis
14
+ * `data` when available, otherwise from the `sizeValue` of the scatter point.
15
+ * It falls back to the series `markerSize` when no size can be computed.
16
+ */
17
+ declare const getMarkerSize: (series: DefaultizedScatterSeriesType, sizeZAxis?: ZAxisDefaultized) => ScatterSizeGetter;
18
+ export default getMarkerSize;
@@ -0,0 +1,18 @@
1
+ import { type DefaultizedScatterSeriesType } from "../../models/seriesType/scatter.js";
2
+ import { type ZAxisDefaultized } from "../../models/z-axis.js";
3
+ /**
4
+ * Returns the marker size of a scatter item given its data index.
5
+ * @param {number} dataIndex The index of the scatter item.
6
+ * @returns {number} The marker size in pixels.
7
+ */
8
+ export type ScatterSizeGetter = (dataIndex: number) => number;
9
+ /**
10
+ * Builds a getter returning the marker size of each scatter item.
11
+ *
12
+ * When the size axis defines a `sizeMap`, the size is computed by mapping a value
13
+ * through the resulting `sizeScale`. The mapped value is taken from the size axis
14
+ * `data` when available, otherwise from the `sizeValue` of the scatter point.
15
+ * It falls back to the series `markerSize` when no size can be computed.
16
+ */
17
+ declare const getMarkerSize: (series: DefaultizedScatterSeriesType, sizeZAxis?: ZAxisDefaultized) => ScatterSizeGetter;
18
+ export default getMarkerSize;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ * Returns the marker size of a scatter item given its data index.
9
+ * @param {number} dataIndex The index of the scatter item.
10
+ * @returns {number} The marker size in pixels.
11
+ */
12
+
13
+ /**
14
+ * Builds a getter returning the marker size of each scatter item.
15
+ *
16
+ * When the size axis defines a `sizeMap`, the size is computed by mapping a value
17
+ * through the resulting `sizeScale`. The mapped value is taken from the size axis
18
+ * `data` when available, otherwise from the `sizeValue` of the scatter point.
19
+ * It falls back to the series `markerSize` when no size can be computed.
20
+ */
21
+ const getMarkerSize = (series, sizeZAxis) => {
22
+ const sizeScale = sizeZAxis?.sizeScale;
23
+ if (!sizeScale) {
24
+ return () => series.markerSize;
25
+ }
26
+ return dataIndex => {
27
+ if (sizeZAxis?.data?.[dataIndex] !== undefined) {
28
+ const size = sizeScale(sizeZAxis.data[dataIndex]);
29
+ if (size != null && !Number.isNaN(size)) {
30
+ return size;
31
+ }
32
+ }
33
+ const value = series.data[dataIndex];
34
+ if (value != null) {
35
+ const size = sizeScale(value.sizeValue);
36
+ if (size != null && !Number.isNaN(size)) {
37
+ return size;
38
+ }
39
+ }
40
+ return series.markerSize;
41
+ };
42
+ };
43
+ var _default = exports.default = getMarkerSize;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Returns the marker size of a scatter item given its data index.
3
+ * @param {number} dataIndex The index of the scatter item.
4
+ * @returns {number} The marker size in pixels.
5
+ */
6
+
7
+ /**
8
+ * Builds a getter returning the marker size of each scatter item.
9
+ *
10
+ * When the size axis defines a `sizeMap`, the size is computed by mapping a value
11
+ * through the resulting `sizeScale`. The mapped value is taken from the size axis
12
+ * `data` when available, otherwise from the `sizeValue` of the scatter point.
13
+ * It falls back to the series `markerSize` when no size can be computed.
14
+ */
15
+ const getMarkerSize = (series, sizeZAxis) => {
16
+ const sizeScale = sizeZAxis?.sizeScale;
17
+ if (!sizeScale) {
18
+ return () => series.markerSize;
19
+ }
20
+ return dataIndex => {
21
+ if (sizeZAxis?.data?.[dataIndex] !== undefined) {
22
+ const size = sizeScale(sizeZAxis.data[dataIndex]);
23
+ if (size != null && !Number.isNaN(size)) {
24
+ return size;
25
+ }
26
+ }
27
+ const value = series.data[dataIndex];
28
+ if (value != null) {
29
+ const size = sizeScale(value.sizeValue);
30
+ if (size != null && !Number.isNaN(size)) {
31
+ return size;
32
+ }
33
+ }
34
+ return series.markerSize;
35
+ };
36
+ };
37
+ export default getMarkerSize;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
9
+ var _incompleteDatasetKeysError = require("../../internals/incompleteDatasetKeysError");
10
10
  const seriesProcessor = ({
11
11
  series,
12
12
  seriesOrder
@@ -15,18 +15,33 @@ const seriesProcessor = ({
15
15
  const datasetKeys = seriesData?.datasetKeys;
16
16
  const missingKeys = ['x', 'y'].filter(key => typeof datasetKeys?.[key] !== 'string');
17
17
  if (seriesData?.datasetKeys && missingKeys.length > 0) {
18
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Scatter series with id="${seriesId}" has incomplete datasetKeys. ` + `Properties ${missingKeys.map(key => `"${key}"`).join(', ')} are missing. ` + 'Scatter plots require both "x" and "y" keys to map dataset values to coordinates. ' + 'Add the missing datasetKeys to the series configuration.' : (0, _formatErrorMessage2.default)(29, seriesId, missingKeys.map(key => `"${key}"`).join(', ')));
18
+ (0, _incompleteDatasetKeysError.incompleteDatasetKeysError)('Scatter', seriesId, missingKeys);
19
19
  }
20
20
  let data;
21
21
  if (seriesData.valueGetter) {
22
22
  data = dataset?.map(seriesData.valueGetter) ?? [];
23
23
  } else if (datasetKeys) {
24
- data = dataset?.map(d => ({
25
- x: d[datasetKeys.x] ?? null,
26
- y: d[datasetKeys.y] ?? null,
27
- z: datasetKeys.z && d[datasetKeys.z],
28
- id: datasetKeys.id && d[datasetKeys.id]
29
- })) ?? [];
24
+ data = dataset?.map(d => {
25
+ const x = d[datasetKeys.x];
26
+ const y = d[datasetKeys.y];
27
+ const rep = {
28
+ x,
29
+ y
30
+ };
31
+ if (datasetKeys.colorValue !== undefined) {
32
+ rep.colorValue = d[datasetKeys.colorValue];
33
+ }
34
+ if (datasetKeys.sizeValue !== undefined) {
35
+ rep.sizeValue = d[datasetKeys.sizeValue];
36
+ }
37
+ if (datasetKeys.z !== undefined) {
38
+ rep.z = d[datasetKeys.z];
39
+ }
40
+ if (datasetKeys.id !== undefined) {
41
+ rep.id = d[datasetKeys.id];
42
+ }
43
+ return rep;
44
+ }) ?? [];
30
45
  } else {
31
46
  data = seriesData.data ?? [];
32
47
  }
@@ -1,5 +1,5 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
2
+ import { incompleteDatasetKeysError } from "../../internals/incompleteDatasetKeysError.mjs";
3
3
  const seriesProcessor = ({
4
4
  series,
5
5
  seriesOrder
@@ -8,18 +8,33 @@ const seriesProcessor = ({
8
8
  const datasetKeys = seriesData?.datasetKeys;
9
9
  const missingKeys = ['x', 'y'].filter(key => typeof datasetKeys?.[key] !== 'string');
10
10
  if (seriesData?.datasetKeys && missingKeys.length > 0) {
11
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Scatter series with id="${seriesId}" has incomplete datasetKeys. ` + `Properties ${missingKeys.map(key => `"${key}"`).join(', ')} are missing. ` + 'Scatter plots require both "x" and "y" keys to map dataset values to coordinates. ' + 'Add the missing datasetKeys to the series configuration.' : _formatErrorMessage(29, seriesId, missingKeys.map(key => `"${key}"`).join(', ')));
11
+ incompleteDatasetKeysError('Scatter', seriesId, missingKeys);
12
12
  }
13
13
  let data;
14
14
  if (seriesData.valueGetter) {
15
15
  data = dataset?.map(seriesData.valueGetter) ?? [];
16
16
  } else if (datasetKeys) {
17
- data = dataset?.map(d => ({
18
- x: d[datasetKeys.x] ?? null,
19
- y: d[datasetKeys.y] ?? null,
20
- z: datasetKeys.z && d[datasetKeys.z],
21
- id: datasetKeys.id && d[datasetKeys.id]
22
- })) ?? [];
17
+ data = dataset?.map(d => {
18
+ const x = d[datasetKeys.x];
19
+ const y = d[datasetKeys.y];
20
+ const rep = {
21
+ x,
22
+ y
23
+ };
24
+ if (datasetKeys.colorValue !== undefined) {
25
+ rep.colorValue = d[datasetKeys.colorValue];
26
+ }
27
+ if (datasetKeys.sizeValue !== undefined) {
28
+ rep.sizeValue = d[datasetKeys.sizeValue];
29
+ }
30
+ if (datasetKeys.z !== undefined) {
31
+ rep.z = d[datasetKeys.z];
32
+ }
33
+ if (datasetKeys.id !== undefined) {
34
+ rep.id = d[datasetKeys.id];
35
+ }
36
+ return rep;
37
+ }) ?? [];
23
38
  } else {
24
39
  data = seriesData.data ?? [];
25
40
  }