@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.
- package/BarChart/BarElement.d.mts +3 -2
- package/BarChart/BarElement.d.ts +3 -2
- package/BarChart/BarLabel/BarLabelItem.d.mts +3 -2
- package/BarChart/BarLabel/BarLabelItem.d.ts +3 -2
- package/BarChart/seriesConfig/bar/extremums.js +7 -2
- package/BarChart/seriesConfig/bar/extremums.mjs +7 -2
- package/CHANGELOG.md +296 -0
- package/ChartsContainer/ChartsContainer.js +21 -0
- package/ChartsContainer/ChartsContainer.mjs +21 -0
- package/ChartsLabel/ChartsLabelMark.js +1 -21
- package/ChartsLabel/ChartsLabelMark.mjs +0 -20
- package/ChartsLegend/chartsLegend.types.d.mts +3 -2
- package/ChartsLegend/chartsLegend.types.d.ts +3 -2
- package/ChartsLegend/piecewiseColorLegendClasses.js +8 -2
- package/ChartsLegend/piecewiseColorLegendClasses.mjs +8 -2
- package/ChartsOverlay/ChartsOverlay.d.mts +5 -4
- package/ChartsOverlay/ChartsOverlay.d.ts +5 -4
- package/ChartsRadialAxisHighlight/index.d.mts +6 -1
- package/ChartsRadialAxisHighlight/index.d.ts +6 -1
- package/ChartsRadialAxisHighlight/index.js +9 -2
- package/ChartsRadialAxisHighlight/index.mjs +8 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.mts +1 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.d.ts +1 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +1 -1
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +1 -1
- package/ChartsRadialDataProvider/index.d.mts +5 -0
- package/ChartsRadialDataProvider/index.d.ts +5 -0
- package/ChartsRadialDataProvider/index.js +12 -1
- package/ChartsRadialDataProvider/index.mjs +7 -0
- package/ChartsRadialGrid/index.d.mts +6 -1
- package/ChartsRadialGrid/index.d.ts +6 -1
- package/ChartsRadialGrid/index.js +8 -2
- package/ChartsRadialGrid/index.mjs +8 -1
- package/ChartsRadiusAxis/index.d.mts +6 -1
- package/ChartsRadiusAxis/index.d.ts +6 -1
- package/ChartsRadiusAxis/index.js +10 -2
- package/ChartsRadiusAxis/index.mjs +7 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.js +6 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.mjs +6 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +5 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.mjs +5 -0
- package/ChartsRotationAxis/index.d.mts +6 -1
- package/ChartsRotationAxis/index.d.ts +6 -1
- package/ChartsRotationAxis/index.js +10 -2
- package/ChartsRotationAxis/index.mjs +7 -1
- package/ChartsTooltip/ChartTooltip.types.d.mts +3 -2
- package/ChartsTooltip/ChartTooltip.types.d.ts +3 -2
- package/ChartsTooltip/ChartsTooltipContainer.js +11 -4
- package/ChartsTooltip/ChartsTooltipContainer.mjs +11 -4
- package/ChartsTooltip/useAxesTooltip.js +2 -2
- package/ChartsTooltip/useAxesTooltip.mjs +2 -2
- package/ChartsTooltip/useItemTooltip.js +2 -2
- package/ChartsTooltip/useItemTooltip.mjs +2 -2
- package/ChartsXAxis/useAxisTicksProps.d.mts +84 -3
- package/ChartsXAxis/useAxisTicksProps.d.ts +84 -3
- package/ChartsYAxis/useAxisTicksProps.d.mts +84 -3
- package/ChartsYAxis/useAxisTicksProps.d.ts +84 -3
- package/LineChart/AreaElement.d.mts +3 -2
- package/LineChart/AreaElement.d.ts +3 -2
- package/LineChart/AreaElement.js +1 -1
- package/LineChart/AreaElement.mjs +1 -1
- package/LineChart/CircleMarkElement.js +1 -1
- package/LineChart/CircleMarkElement.mjs +1 -1
- package/LineChart/LineElement.d.mts +3 -2
- package/LineChart/LineElement.d.ts +3 -2
- package/LineChart/LineElement.js +1 -1
- package/LineChart/LineElement.mjs +1 -1
- package/LineChart/LineHighlightPlot.d.mts +3 -2
- package/LineChart/LineHighlightPlot.d.ts +3 -2
- package/LineChart/LineHighlightPlot.js +65 -45
- package/LineChart/LineHighlightPlot.mjs +65 -45
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkElement.mjs +1 -1
- package/LineChart/MarkPlot.d.mts +3 -2
- package/LineChart/MarkPlot.d.ts +3 -2
- package/LineChart/seriesConfig/curveEvaluation.js +28 -14
- package/LineChart/seriesConfig/curveEvaluation.mjs +27 -14
- package/LineChart/seriesConfig/extremums.js +5 -1
- package/LineChart/seriesConfig/extremums.mjs +5 -1
- package/LineChart/useMarkPlotData.js +3 -1
- package/LineChart/useMarkPlotData.mjs +3 -1
- package/PieChart/PieArcLabelPlot.d.mts +3 -2
- package/PieChart/PieArcLabelPlot.d.ts +3 -2
- package/PieChart/PieArcPlot.d.mts +3 -2
- package/PieChart/PieArcPlot.d.ts +3 -2
- package/RadarChart/RadarAxis/RadarAxis.utils.d.mts +2 -2
- package/RadarChart/RadarAxis/RadarAxis.utils.d.ts +2 -2
- package/ScatterChart/BatchScatter.d.mts +2 -8
- package/ScatterChart/BatchScatter.d.ts +2 -8
- package/ScatterChart/BatchScatter.js +17 -12
- package/ScatterChart/BatchScatter.mjs +17 -12
- package/ScatterChart/FocusedScatterMark.js +2 -2
- package/ScatterChart/FocusedScatterMark.mjs +2 -2
- package/ScatterChart/HighlightedScatterMark.js +3 -3
- package/ScatterChart/HighlightedScatterMark.mjs +3 -3
- package/ScatterChart/Scatter.d.mts +5 -0
- package/ScatterChart/Scatter.d.ts +5 -0
- package/ScatterChart/Scatter.js +7 -2
- package/ScatterChart/Scatter.mjs +7 -2
- package/ScatterChart/ScatterChart.d.mts +2 -1
- package/ScatterChart/ScatterChart.d.ts +2 -1
- package/ScatterChart/ScatterChart.js +28 -3
- package/ScatterChart/ScatterChart.mjs +28 -3
- package/ScatterChart/ScatterChart.plugins.d.mts +2 -1
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/ScatterChart.plugins.mjs +2 -1
- package/ScatterChart/ScatterMarker.types.d.mts +3 -2
- package/ScatterChart/ScatterMarker.types.d.ts +3 -2
- package/ScatterChart/ScatterPlot.d.mts +7 -4
- package/ScatterChart/ScatterPlot.d.ts +7 -4
- package/ScatterChart/ScatterPlot.js +31 -4
- package/ScatterChart/ScatterPlot.mjs +31 -4
- package/ScatterChart/async/ScatterAsync.d.mts +9 -0
- package/ScatterChart/async/ScatterAsync.d.ts +9 -0
- package/ScatterChart/async/ScatterAsync.js +71 -0
- package/ScatterChart/async/ScatterAsync.mjs +67 -0
- package/ScatterChart/async/ScatterAsyncBatch.d.mts +24 -0
- package/ScatterChart/async/ScatterAsyncBatch.d.ts +24 -0
- package/ScatterChart/async/ScatterAsyncBatch.js +112 -0
- package/ScatterChart/async/ScatterAsyncBatch.mjs +106 -0
- package/ScatterChart/async/scatterRenderData.selectors.d.mts +38 -0
- package/ScatterChart/async/scatterRenderData.selectors.d.ts +38 -0
- package/ScatterChart/async/scatterRenderData.selectors.js +93 -0
- package/ScatterChart/async/scatterRenderData.selectors.mjs +87 -0
- package/ScatterChart/seriesConfig/extremums.js +6 -0
- package/ScatterChart/seriesConfig/extremums.mjs +6 -0
- package/ScatterChart/seriesConfig/getColor.js +1 -1
- package/ScatterChart/seriesConfig/getColor.mjs +1 -1
- package/ScatterChart/seriesConfig/getMarkerSize.d.mts +18 -0
- package/ScatterChart/seriesConfig/getMarkerSize.d.ts +18 -0
- package/ScatterChart/seriesConfig/getMarkerSize.js +43 -0
- package/ScatterChart/seriesConfig/getMarkerSize.mjs +37 -0
- package/ScatterChart/seriesConfig/seriesProcessor.js +23 -8
- package/ScatterChart/seriesConfig/seriesProcessor.mjs +23 -8
- package/ScatterChart/useScatterItemPosition.d.mts +4 -0
- package/ScatterChart/useScatterItemPosition.d.ts +4 -0
- package/ScatterChart/useScatterItemPosition.js +9 -0
- package/ScatterChart/useScatterItemPosition.mjs +8 -0
- package/SparkLineChart/SparkLineChart.js +2 -1
- package/SparkLineChart/SparkLineChart.mjs +2 -1
- package/Toolbar/Toolbar.types.d.mts +3 -2
- package/Toolbar/Toolbar.types.d.ts +3 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/animation/animation.d.mts +1 -2
- package/internals/animation/animation.d.ts +1 -2
- package/internals/commonNextFocusItem.d.mts +10 -2
- package/internals/commonNextFocusItem.d.ts +10 -2
- package/internals/commonNextFocusItem.js +12 -4
- package/internals/commonNextFocusItem.mjs +12 -4
- package/internals/createCommonKeyboardFocusHandler.d.mts +1 -1
- package/internals/createCommonKeyboardFocusHandler.d.ts +1 -1
- package/internals/createCommonKeyboardFocusHandler.js +3 -3
- package/internals/createCommonKeyboardFocusHandler.mjs +3 -3
- package/internals/getSeriesColorFn.d.mts +5 -5
- package/internals/getSeriesColorFn.d.ts +5 -5
- package/internals/incompleteDatasetKeysError.d.mts +1 -0
- package/internals/incompleteDatasetKeysError.d.ts +1 -0
- package/internals/incompleteDatasetKeysError.js +11 -0
- package/internals/incompleteDatasetKeysError.mjs +4 -0
- package/internals/index.d.mts +3 -0
- package/internals/index.d.ts +3 -0
- package/internals/index.js +36 -0
- package/internals/index.mjs +3 -0
- package/internals/plugins/allPlugins.d.mts +4 -3
- package/internals/plugins/allPlugins.d.ts +4 -3
- package/internals/plugins/allPlugins.js +2 -1
- package/internals/plugins/allPlugins.mjs +2 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.mts +12 -3
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +12 -3
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +10 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.mjs +10 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.mts +15 -1
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +15 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.mjs +4 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.mjs +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.mts +10 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +10 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +18 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.mjs +16 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +27 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.mjs +27 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.mjs +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +11 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +11 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +24 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.mjs +24 -5
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.mts +1 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +46 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.mjs +47 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +46 -11
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +46 -11
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.mts +2 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +3 -2
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.mjs +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.mts +4 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +3 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.mjs +1 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +5 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +7 -5
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.js +17 -3
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.mjs +17 -3
- package/internals/plugins/featurePlugins/useProgressiveRendering/index.d.mts +3 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/index.js +27 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/index.mjs +2 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.d.mts +13 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.d.ts +13 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.js +136 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.mjs +128 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.d.mts +42 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.d.ts +42 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.js +166 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.selectors.mjs +159 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.d.mts +34 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.d.ts +34 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.js +5 -0
- package/internals/plugins/featurePlugins/useProgressiveRendering/useProgressiveRendering.types.mjs +1 -0
- package/internals/scales/scaleBand.js +70 -43
- package/internals/scales/scaleBand.mjs +71 -44
- package/internals/sizeScale.d.mts +6 -0
- package/internals/sizeScale.d.ts +6 -0
- package/internals/sizeScale.js +46 -0
- package/internals/sizeScale.mjs +38 -0
- package/models/axis.d.mts +18 -12
- package/models/axis.d.ts +18 -12
- package/models/chartsSlotsComponentsProps.d.mts +25 -0
- package/models/chartsSlotsComponentsProps.d.ts +25 -0
- package/models/chartsSlotsComponentsProps.js +5 -0
- package/models/chartsSlotsComponentsProps.mjs +1 -0
- package/models/index.d.mts +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/index.mjs +1 -0
- package/models/seriesType/bar.d.mts +1 -1
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.mts +4 -4
- package/models/seriesType/common.d.ts +4 -4
- package/models/seriesType/config.d.mts +3 -3
- package/models/seriesType/config.d.ts +3 -3
- package/models/seriesType/line.d.mts +6 -3
- package/models/seriesType/line.d.ts +6 -3
- package/models/seriesType/pie.d.mts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/radar.d.mts +1 -1
- package/models/seriesType/radar.d.ts +1 -1
- package/models/seriesType/scatter.d.mts +35 -3
- package/models/seriesType/scatter.d.ts +35 -3
- package/models/sizeMapping.d.mts +64 -0
- package/models/sizeMapping.d.ts +64 -0
- package/models/sizeMapping.js +5 -0
- package/models/sizeMapping.mjs +1 -0
- package/models/slots/chartsBaseSlots.d.mts +6 -5
- package/models/slots/chartsBaseSlots.d.ts +6 -5
- package/models/z-axis.d.mts +10 -1
- package/models/z-axis.d.ts +10 -1
- package/package.json +5 -5
|
@@ -148,7 +148,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
148
148
|
/**
|
|
149
149
|
* Options to enable features planned for the next major.
|
|
150
150
|
*/
|
|
151
|
-
experimentalFeatures: _propTypes.default.
|
|
151
|
+
experimentalFeatures: _propTypes.default.shape({
|
|
152
|
+
progressiveRendering: _propTypes.default.bool
|
|
153
|
+
}),
|
|
152
154
|
/**
|
|
153
155
|
* Option to display a cartesian grid in the background.
|
|
154
156
|
*/
|
|
@@ -307,13 +309,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
307
309
|
onTooltipItemChange: _propTypes.default.func,
|
|
308
310
|
/**
|
|
309
311
|
* The type of renderer to use for the scatter plot.
|
|
310
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
312
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
313
|
+
* - `svg-progressive`: Renders every scatter item in a `<circle />` element, in progressive batches that paint over several animation frames to keep the main thread responsive.
|
|
311
314
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
312
315
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
313
316
|
*
|
|
317
|
+
* When not set, defaults to `svg-single`. Enable the `progressiveRendering` experimental feature to auto-select `svg-progressive` above an internal point-count threshold; this will become the default in the next major version.
|
|
314
318
|
* @default 'svg-single'
|
|
315
319
|
*/
|
|
316
|
-
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-single']),
|
|
320
|
+
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-progressive', 'svg-single']),
|
|
317
321
|
/**
|
|
318
322
|
* The series to display in the scatter chart.
|
|
319
323
|
* An array of [[ScatterSeries]] objects.
|
|
@@ -406,6 +410,27 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
406
410
|
id: _propTypes.default.string,
|
|
407
411
|
max: _propTypes.default.number,
|
|
408
412
|
min: _propTypes.default.number,
|
|
413
|
+
sizeMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
414
|
+
interpolator: _propTypes.default.oneOf(['linear', 'log', 'sqrt']),
|
|
415
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
416
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
417
|
+
size: _propTypes.default.arrayOf(_propTypes.default.number.isRequired).isRequired,
|
|
418
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
419
|
+
}), _propTypes.default.shape({
|
|
420
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
421
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
422
|
+
size: _propTypes.default.func.isRequired,
|
|
423
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
424
|
+
}), _propTypes.default.shape({
|
|
425
|
+
sizes: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
|
|
426
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
427
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
428
|
+
}), _propTypes.default.shape({
|
|
429
|
+
sizes: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
|
|
430
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
431
|
+
unknownSize: _propTypes.default.number,
|
|
432
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
433
|
+
})]),
|
|
409
434
|
valueGetter: _propTypes.default.func
|
|
410
435
|
}))
|
|
411
436
|
} : void 0;
|
|
@@ -141,7 +141,9 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
141
141
|
/**
|
|
142
142
|
* Options to enable features planned for the next major.
|
|
143
143
|
*/
|
|
144
|
-
experimentalFeatures: PropTypes.
|
|
144
|
+
experimentalFeatures: PropTypes.shape({
|
|
145
|
+
progressiveRendering: PropTypes.bool
|
|
146
|
+
}),
|
|
145
147
|
/**
|
|
146
148
|
* Option to display a cartesian grid in the background.
|
|
147
149
|
*/
|
|
@@ -300,13 +302,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
300
302
|
onTooltipItemChange: PropTypes.func,
|
|
301
303
|
/**
|
|
302
304
|
* The type of renderer to use for the scatter plot.
|
|
303
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
305
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
306
|
+
* - `svg-progressive`: Renders every scatter item in a `<circle />` element, in progressive batches that paint over several animation frames to keep the main thread responsive.
|
|
304
307
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
305
308
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
306
309
|
*
|
|
310
|
+
* When not set, defaults to `svg-single`. Enable the `progressiveRendering` experimental feature to auto-select `svg-progressive` above an internal point-count threshold; this will become the default in the next major version.
|
|
307
311
|
* @default 'svg-single'
|
|
308
312
|
*/
|
|
309
|
-
renderer: PropTypes.oneOf(['svg-batch', 'svg-single']),
|
|
313
|
+
renderer: PropTypes.oneOf(['svg-batch', 'svg-progressive', 'svg-single']),
|
|
310
314
|
/**
|
|
311
315
|
* The series to display in the scatter chart.
|
|
312
316
|
* An array of [[ScatterSeries]] objects.
|
|
@@ -399,6 +403,27 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
399
403
|
id: PropTypes.string,
|
|
400
404
|
max: PropTypes.number,
|
|
401
405
|
min: PropTypes.number,
|
|
406
|
+
sizeMap: PropTypes.oneOfType([PropTypes.shape({
|
|
407
|
+
interpolator: PropTypes.oneOf(['linear', 'log', 'sqrt']),
|
|
408
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
409
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
410
|
+
size: PropTypes.arrayOf(PropTypes.number.isRequired).isRequired,
|
|
411
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
412
|
+
}), PropTypes.shape({
|
|
413
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
414
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
415
|
+
size: PropTypes.func.isRequired,
|
|
416
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
417
|
+
}), PropTypes.shape({
|
|
418
|
+
sizes: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
419
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
420
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
421
|
+
}), PropTypes.shape({
|
|
422
|
+
sizes: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
423
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
424
|
+
unknownSize: PropTypes.number,
|
|
425
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
426
|
+
})]),
|
|
402
427
|
valueGetter: PropTypes.func
|
|
403
428
|
}))
|
|
404
429
|
} : void 0;
|
|
@@ -8,5 +8,6 @@ import { type UseChartClosestPointSignature } from "../internals/plugins/feature
|
|
|
8
8
|
import { type UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.mjs";
|
|
9
9
|
import { type UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.mjs";
|
|
10
10
|
import { type UseChartVisibilityManagerSignature } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.mjs";
|
|
11
|
-
|
|
11
|
+
import { type UseProgressiveRenderingSignature } from "../internals/plugins/featurePlugins/useProgressiveRendering/index.mjs";
|
|
12
|
+
export type ScatterChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<'scatter'>, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature<'scatter'>, UseChartVisibilityManagerSignature<'scatter'>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseProgressiveRenderingSignature];
|
|
12
13
|
export declare const SCATTER_CHART_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartPluginSignatures>;
|
|
@@ -8,5 +8,6 @@ import { type UseChartClosestPointSignature } from "../internals/plugins/feature
|
|
|
8
8
|
import { type UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
9
9
|
import { type UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
10
10
|
import { type UseChartVisibilityManagerSignature } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
11
|
-
|
|
11
|
+
import { type UseProgressiveRenderingSignature } from "../internals/plugins/featurePlugins/useProgressiveRendering/index.js";
|
|
12
|
+
export type ScatterChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<'scatter'>, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature<'scatter'>, UseChartVisibilityManagerSignature<'scatter'>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseProgressiveRenderingSignature];
|
|
12
13
|
export declare const SCATTER_CHART_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartPluginSignatures>;
|
|
@@ -13,4 +13,5 @@ var _useChartClosestPoint = require("../internals/plugins/featurePlugins/useChar
|
|
|
13
13
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
14
14
|
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
15
15
|
var _useChartVisibilityManager = require("../internals/plugins/featurePlugins/useChartVisibilityManager");
|
|
16
|
-
|
|
16
|
+
var _useProgressiveRendering = require("../internals/plugins/featurePlugins/useProgressiveRendering");
|
|
17
|
+
const SCATTER_CHART_PLUGINS = exports.SCATTER_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartVisibilityManager.useChartVisibilityManager, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation, _useProgressiveRendering.useProgressiveRendering];
|
|
@@ -7,4 +7,5 @@ import { useChartClosestPoint } from "../internals/plugins/featurePlugins/useCha
|
|
|
7
7
|
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.mjs";
|
|
8
8
|
import { useChartBrush } from "../internals/plugins/featurePlugins/useChartBrush/index.mjs";
|
|
9
9
|
import { useChartVisibilityManager } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.mjs";
|
|
10
|
-
|
|
10
|
+
import { useProgressiveRendering } from "../internals/plugins/featurePlugins/useProgressiveRendering/index.mjs";
|
|
11
|
+
export const SCATTER_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartClosestPoint, useChartKeyboardNavigation, useProgressiveRendering];
|
|
@@ -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'> {
|
|
@@ -21,13 +22,15 @@ export interface ScatterPlotProps extends Pick<ScatterProps, 'onItemClick' | 'cl
|
|
|
21
22
|
slotProps?: ScatterPlotSlotProps;
|
|
22
23
|
/**
|
|
23
24
|
* The type of renderer to use for the scatter plot.
|
|
24
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
25
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
26
|
+
* - `svg-progressive`: Renders every scatter item in a `<circle />` element, in progressive batches that paint over several animation frames to keep the main thread responsive.
|
|
25
27
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
26
28
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
27
29
|
*
|
|
30
|
+
* When not set, defaults to `svg-single`. Enable the `progressiveRendering` experimental feature to auto-select `svg-progressive` above an internal point-count threshold; this will become the default in the next major version.
|
|
28
31
|
* @default 'svg-single'
|
|
29
32
|
*/
|
|
30
|
-
renderer?: RendererType;
|
|
33
|
+
renderer?: RendererType | 'svg-progressive';
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
33
36
|
* Demos:
|
|
@@ -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'> {
|
|
@@ -21,13 +22,15 @@ export interface ScatterPlotProps extends Pick<ScatterProps, 'onItemClick' | 'cl
|
|
|
21
22
|
slotProps?: ScatterPlotSlotProps;
|
|
22
23
|
/**
|
|
23
24
|
* The type of renderer to use for the scatter plot.
|
|
24
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
25
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
26
|
+
* - `svg-progressive`: Renders every scatter item in a `<circle />` element, in progressive batches that paint over several animation frames to keep the main thread responsive.
|
|
25
27
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
26
28
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
27
29
|
*
|
|
30
|
+
* When not set, defaults to `svg-single`. Enable the `progressiveRendering` experimental feature to auto-select `svg-progressive` above an internal point-count threshold; this will become the default in the next major version.
|
|
28
31
|
* @default 'svg-single'
|
|
29
32
|
*/
|
|
30
|
-
renderer?: RendererType;
|
|
33
|
+
renderer?: RendererType | 'svg-progressive';
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
33
36
|
* Demos:
|
|
@@ -17,9 +17,15 @@ 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");
|
|
22
|
+
var _ScatterAsync = require("./async/ScatterAsync");
|
|
21
23
|
var _scatterClasses = require("./scatterClasses");
|
|
24
|
+
var _ChartsProvider = require("../context/ChartsProvider");
|
|
25
|
+
var _useStore = require("../internals/store/useStore");
|
|
26
|
+
var _useProgressiveRendering = require("../internals/plugins/featurePlugins/useProgressiveRendering");
|
|
22
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const EMPTY_SERIES_IDS = [];
|
|
23
29
|
const ScatterPlotRoot = (0, _styles.styled)('g', {
|
|
24
30
|
name: 'MuiScatterPlot',
|
|
25
31
|
slot: 'Root'
|
|
@@ -60,6 +66,14 @@ function ScatterPlot(props) {
|
|
|
60
66
|
const classes = (0, _scatterClasses.useUtilityClasses)({
|
|
61
67
|
classes: inClasses
|
|
62
68
|
});
|
|
69
|
+
const {
|
|
70
|
+
instance
|
|
71
|
+
} = (0, _ChartsProvider.useChartsContext)();
|
|
72
|
+
const store = (0, _useStore.useStore)();
|
|
73
|
+
const plotId = React.useId();
|
|
74
|
+
const seriesIds = seriesData?.seriesOrder ?? EMPTY_SERIES_IDS;
|
|
75
|
+
const isProgressive = store.use(_useProgressiveRendering.selectorShouldUseProgressiveRenderer, seriesIds, renderer);
|
|
76
|
+
React.useEffect(() => instance.registerProgressivePlan(plotId, seriesIds, renderer), [instance, plotId, seriesIds, renderer]);
|
|
63
77
|
if (seriesData === undefined) {
|
|
64
78
|
return null;
|
|
65
79
|
}
|
|
@@ -70,7 +84,14 @@ function ScatterPlot(props) {
|
|
|
70
84
|
const defaultXAxisId = xAxisIds[0];
|
|
71
85
|
const defaultYAxisId = yAxisIds[0];
|
|
72
86
|
const defaultZAxisId = zAxisIds[0];
|
|
73
|
-
|
|
87
|
+
let DefaultScatterItems;
|
|
88
|
+
if (renderer === 'svg-batch') {
|
|
89
|
+
DefaultScatterItems = _BatchScatter.BatchScatter;
|
|
90
|
+
} else if (isProgressive) {
|
|
91
|
+
DefaultScatterItems = _ScatterAsync.ScatterAsync;
|
|
92
|
+
} else {
|
|
93
|
+
DefaultScatterItems = _Scatter.Scatter;
|
|
94
|
+
}
|
|
74
95
|
const ScatterItems = slots?.scatter ?? DefaultScatterItems;
|
|
75
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterPlotRoot, {
|
|
76
97
|
className: (0, _clsx.default)(classes.root, className),
|
|
@@ -79,14 +100,17 @@ function ScatterPlot(props) {
|
|
|
79
100
|
id,
|
|
80
101
|
xAxisId,
|
|
81
102
|
yAxisId,
|
|
103
|
+
colorAxisId,
|
|
82
104
|
zAxisId,
|
|
105
|
+
sizeAxisId,
|
|
83
106
|
color,
|
|
84
107
|
hidden
|
|
85
108
|
} = series[seriesId];
|
|
86
109
|
if (hidden) {
|
|
87
110
|
return null;
|
|
88
111
|
}
|
|
89
|
-
const colorGetter = _seriesConfig.scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
|
|
112
|
+
const colorGetter = _seriesConfig.scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[colorAxisId ?? zAxisId ?? defaultZAxisId]);
|
|
113
|
+
const sizeGetter = (0, _getMarkerSize.default)(series[seriesId], zAxis[sizeAxisId ?? defaultZAxisId]);
|
|
90
114
|
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
91
115
|
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
92
116
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterItems, (0, _extends2.default)({
|
|
@@ -94,6 +118,7 @@ function ScatterPlot(props) {
|
|
|
94
118
|
yScale: yScale,
|
|
95
119
|
color: color,
|
|
96
120
|
colorGetter: colorGetter,
|
|
121
|
+
sizeGetter: sizeGetter,
|
|
97
122
|
series: series[seriesId],
|
|
98
123
|
onItemClick: onItemClick,
|
|
99
124
|
slots: slots,
|
|
@@ -115,13 +140,15 @@ process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes = {
|
|
|
115
140
|
onItemClick: _propTypes.default.func,
|
|
116
141
|
/**
|
|
117
142
|
* The type of renderer to use for the scatter plot.
|
|
118
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
143
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
144
|
+
* - `svg-progressive`: Renders every scatter item in a `<circle />` element, in progressive batches that paint over several animation frames to keep the main thread responsive.
|
|
119
145
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
120
146
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
121
147
|
*
|
|
148
|
+
* When not set, defaults to `svg-single`. Enable the `progressiveRendering` experimental feature to auto-select `svg-progressive` above an internal point-count threshold; this will become the default in the next major version.
|
|
122
149
|
* @default 'svg-single'
|
|
123
150
|
*/
|
|
124
|
-
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-single']),
|
|
151
|
+
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-progressive', 'svg-single']),
|
|
125
152
|
/**
|
|
126
153
|
* The props used for each component slot.
|
|
127
154
|
* @default {}
|
|
@@ -10,9 +10,15 @@ 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";
|
|
15
|
+
import { ScatterAsync } from "./async/ScatterAsync.mjs";
|
|
14
16
|
import { useUtilityClasses } from "./scatterClasses.mjs";
|
|
17
|
+
import { useChartsContext } from "../context/ChartsProvider/index.mjs";
|
|
18
|
+
import { useStore } from "../internals/store/useStore.mjs";
|
|
19
|
+
import { selectorShouldUseProgressiveRenderer } from "../internals/plugins/featurePlugins/useProgressiveRendering/index.mjs";
|
|
15
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const EMPTY_SERIES_IDS = [];
|
|
16
22
|
const ScatterPlotRoot = styled('g', {
|
|
17
23
|
name: 'MuiScatterPlot',
|
|
18
24
|
slot: 'Root'
|
|
@@ -53,6 +59,14 @@ function ScatterPlot(props) {
|
|
|
53
59
|
const classes = useUtilityClasses({
|
|
54
60
|
classes: inClasses
|
|
55
61
|
});
|
|
62
|
+
const {
|
|
63
|
+
instance
|
|
64
|
+
} = useChartsContext();
|
|
65
|
+
const store = useStore();
|
|
66
|
+
const plotId = React.useId();
|
|
67
|
+
const seriesIds = seriesData?.seriesOrder ?? EMPTY_SERIES_IDS;
|
|
68
|
+
const isProgressive = store.use(selectorShouldUseProgressiveRenderer, seriesIds, renderer);
|
|
69
|
+
React.useEffect(() => instance.registerProgressivePlan(plotId, seriesIds, renderer), [instance, plotId, seriesIds, renderer]);
|
|
56
70
|
if (seriesData === undefined) {
|
|
57
71
|
return null;
|
|
58
72
|
}
|
|
@@ -63,7 +77,14 @@ function ScatterPlot(props) {
|
|
|
63
77
|
const defaultXAxisId = xAxisIds[0];
|
|
64
78
|
const defaultYAxisId = yAxisIds[0];
|
|
65
79
|
const defaultZAxisId = zAxisIds[0];
|
|
66
|
-
|
|
80
|
+
let DefaultScatterItems;
|
|
81
|
+
if (renderer === 'svg-batch') {
|
|
82
|
+
DefaultScatterItems = BatchScatter;
|
|
83
|
+
} else if (isProgressive) {
|
|
84
|
+
DefaultScatterItems = ScatterAsync;
|
|
85
|
+
} else {
|
|
86
|
+
DefaultScatterItems = Scatter;
|
|
87
|
+
}
|
|
67
88
|
const ScatterItems = slots?.scatter ?? DefaultScatterItems;
|
|
68
89
|
return /*#__PURE__*/_jsx(ScatterPlotRoot, {
|
|
69
90
|
className: clsx(classes.root, className),
|
|
@@ -72,14 +93,17 @@ function ScatterPlot(props) {
|
|
|
72
93
|
id,
|
|
73
94
|
xAxisId,
|
|
74
95
|
yAxisId,
|
|
96
|
+
colorAxisId,
|
|
75
97
|
zAxisId,
|
|
98
|
+
sizeAxisId,
|
|
76
99
|
color,
|
|
77
100
|
hidden
|
|
78
101
|
} = series[seriesId];
|
|
79
102
|
if (hidden) {
|
|
80
103
|
return null;
|
|
81
104
|
}
|
|
82
|
-
const colorGetter = scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[zAxisId ?? defaultZAxisId]);
|
|
105
|
+
const colorGetter = scatterSeriesConfig.colorProcessor(series[seriesId], xAxis[xAxisId ?? defaultXAxisId], yAxis[yAxisId ?? defaultYAxisId], zAxis[colorAxisId ?? zAxisId ?? defaultZAxisId]);
|
|
106
|
+
const sizeGetter = getMarkerSize(series[seriesId], zAxis[sizeAxisId ?? defaultZAxisId]);
|
|
83
107
|
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
84
108
|
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
85
109
|
return /*#__PURE__*/_jsx(ScatterItems, _extends({
|
|
@@ -87,6 +111,7 @@ function ScatterPlot(props) {
|
|
|
87
111
|
yScale: yScale,
|
|
88
112
|
color: color,
|
|
89
113
|
colorGetter: colorGetter,
|
|
114
|
+
sizeGetter: sizeGetter,
|
|
90
115
|
series: series[seriesId],
|
|
91
116
|
onItemClick: onItemClick,
|
|
92
117
|
slots: slots,
|
|
@@ -108,13 +133,15 @@ process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes = {
|
|
|
108
133
|
onItemClick: PropTypes.func,
|
|
109
134
|
/**
|
|
110
135
|
* The type of renderer to use for the scatter plot.
|
|
111
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
136
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
137
|
+
* - `svg-progressive`: Renders every scatter item in a `<circle />` element, in progressive batches that paint over several animation frames to keep the main thread responsive.
|
|
112
138
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
113
139
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
114
140
|
*
|
|
141
|
+
* When not set, defaults to `svg-single`. Enable the `progressiveRendering` experimental feature to auto-select `svg-progressive` above an internal point-count threshold; this will become the default in the next major version.
|
|
115
142
|
* @default 'svg-single'
|
|
116
143
|
*/
|
|
117
|
-
renderer: PropTypes.oneOf(['svg-batch', 'svg-single']),
|
|
144
|
+
renderer: PropTypes.oneOf(['svg-batch', 'svg-progressive', 'svg-single']),
|
|
118
145
|
/**
|
|
119
146
|
* The props used for each component slot.
|
|
120
147
|
* @default {}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ScatterProps } from "../Scatter.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @ignore - internal component.
|
|
4
|
+
*/
|
|
5
|
+
declare function ScatterAsync(props: ScatterProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare namespace ScatterAsync {
|
|
7
|
+
var propTypes: any;
|
|
8
|
+
}
|
|
9
|
+
export { ScatterAsync };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ScatterProps } from "../Scatter.js";
|
|
2
|
+
/**
|
|
3
|
+
* @ignore - internal component.
|
|
4
|
+
*/
|
|
5
|
+
declare function ScatterAsync(props: ScatterProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare namespace ScatterAsync {
|
|
7
|
+
var propTypes: any;
|
|
8
|
+
}
|
|
9
|
+
export { ScatterAsync };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ScatterAsync = ScatterAsync;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _ScatterAsyncBatch = require("./ScatterAsyncBatch");
|
|
13
|
+
var _useStore = require("../../internals/store/useStore");
|
|
14
|
+
var _useProgressiveRendering = require("../../internals/plugins/featurePlugins/useProgressiveRendering");
|
|
15
|
+
var _scatterRenderData = require("./scatterRenderData.selectors");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* @ignore - internal component.
|
|
19
|
+
*/function ScatterAsync(props) {
|
|
20
|
+
const {
|
|
21
|
+
series,
|
|
22
|
+
colorGetter,
|
|
23
|
+
onItemClick,
|
|
24
|
+
slots,
|
|
25
|
+
slotProps,
|
|
26
|
+
classes
|
|
27
|
+
} = props;
|
|
28
|
+
const store = (0, _useStore.useStore)();
|
|
29
|
+
const batchSize = store.use(_useProgressiveRendering.selectorProgressiveBatchSize);
|
|
30
|
+
const revealedBatches = store.use(_useProgressiveRendering.selectorProgressiveSeriesRevealedBatches, series.id);
|
|
31
|
+
// Size batches by the number of *visible* points so that zooming in (which
|
|
32
|
+
// shrinks the filtered set in the selector) collapses the progressive wave
|
|
33
|
+
// into a single tick once everything fits in one batch.
|
|
34
|
+
const renderData = store.use(_scatterRenderData.selectorScatterSeriesRenderData, series.id);
|
|
35
|
+
const count = renderData?.count ?? 0;
|
|
36
|
+
const nBatches = count === 0 ? 0 : Math.ceil(count / Math.max(1, batchSize));
|
|
37
|
+
const batches = [];
|
|
38
|
+
for (let b = 0; b < nBatches; b += 1) {
|
|
39
|
+
const start = b * batchSize;
|
|
40
|
+
const end = Math.min(count, start + batchSize);
|
|
41
|
+
batches.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterAsyncBatch.ScatterAsyncBatch, {
|
|
42
|
+
series: series,
|
|
43
|
+
colorGetter: colorGetter,
|
|
44
|
+
onItemClick: onItemClick,
|
|
45
|
+
slots: slots,
|
|
46
|
+
slotProps: slotProps,
|
|
47
|
+
start: start,
|
|
48
|
+
end: end,
|
|
49
|
+
classes: classes,
|
|
50
|
+
revealed: b < revealedBatches
|
|
51
|
+
}, b));
|
|
52
|
+
}
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
54
|
+
children: batches
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
process.env.NODE_ENV !== "production" ? ScatterAsync.propTypes = {
|
|
58
|
+
// ----------------------------- Warning --------------------------------
|
|
59
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
60
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
61
|
+
// ----------------------------------------------------------------------
|
|
62
|
+
classes: _propTypes.default.object,
|
|
63
|
+
color: _propTypes.default.string.isRequired,
|
|
64
|
+
colorGetter: _propTypes.default.func.isRequired,
|
|
65
|
+
onItemClick: _propTypes.default.func,
|
|
66
|
+
series: _propTypes.default.object.isRequired,
|
|
67
|
+
slotProps: _propTypes.default.object,
|
|
68
|
+
slots: _propTypes.default.object,
|
|
69
|
+
xScale: _propTypes.default.func.isRequired,
|
|
70
|
+
yScale: _propTypes.default.func.isRequired
|
|
71
|
+
} : void 0;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { ScatterAsyncBatch } from "./ScatterAsyncBatch.mjs";
|
|
6
|
+
import { useStore } from "../../internals/store/useStore.mjs";
|
|
7
|
+
import { selectorProgressiveBatchSize, selectorProgressiveSeriesRevealedBatches } from "../../internals/plugins/featurePlugins/useProgressiveRendering/index.mjs";
|
|
8
|
+
import { selectorScatterSeriesRenderData } from "./scatterRenderData.selectors.mjs";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @ignore - internal component.
|
|
12
|
+
*/
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
function ScatterAsync(props) {
|
|
15
|
+
const {
|
|
16
|
+
series,
|
|
17
|
+
colorGetter,
|
|
18
|
+
onItemClick,
|
|
19
|
+
slots,
|
|
20
|
+
slotProps,
|
|
21
|
+
classes
|
|
22
|
+
} = props;
|
|
23
|
+
const store = useStore();
|
|
24
|
+
const batchSize = store.use(selectorProgressiveBatchSize);
|
|
25
|
+
const revealedBatches = store.use(selectorProgressiveSeriesRevealedBatches, series.id);
|
|
26
|
+
// Size batches by the number of *visible* points so that zooming in (which
|
|
27
|
+
// shrinks the filtered set in the selector) collapses the progressive wave
|
|
28
|
+
// into a single tick once everything fits in one batch.
|
|
29
|
+
const renderData = store.use(selectorScatterSeriesRenderData, series.id);
|
|
30
|
+
const count = renderData?.count ?? 0;
|
|
31
|
+
const nBatches = count === 0 ? 0 : Math.ceil(count / Math.max(1, batchSize));
|
|
32
|
+
const batches = [];
|
|
33
|
+
for (let b = 0; b < nBatches; b += 1) {
|
|
34
|
+
const start = b * batchSize;
|
|
35
|
+
const end = Math.min(count, start + batchSize);
|
|
36
|
+
batches.push(/*#__PURE__*/_jsx(ScatterAsyncBatch, {
|
|
37
|
+
series: series,
|
|
38
|
+
colorGetter: colorGetter,
|
|
39
|
+
onItemClick: onItemClick,
|
|
40
|
+
slots: slots,
|
|
41
|
+
slotProps: slotProps,
|
|
42
|
+
start: start,
|
|
43
|
+
end: end,
|
|
44
|
+
classes: classes,
|
|
45
|
+
revealed: b < revealedBatches
|
|
46
|
+
}, b));
|
|
47
|
+
}
|
|
48
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
49
|
+
children: batches
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
process.env.NODE_ENV !== "production" ? ScatterAsync.propTypes = {
|
|
53
|
+
// ----------------------------- Warning --------------------------------
|
|
54
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
55
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
56
|
+
// ----------------------------------------------------------------------
|
|
57
|
+
classes: PropTypes.object,
|
|
58
|
+
color: PropTypes.string.isRequired,
|
|
59
|
+
colorGetter: PropTypes.func.isRequired,
|
|
60
|
+
onItemClick: PropTypes.func,
|
|
61
|
+
series: PropTypes.object.isRequired,
|
|
62
|
+
slotProps: PropTypes.object,
|
|
63
|
+
slots: PropTypes.object,
|
|
64
|
+
xScale: PropTypes.func.isRequired,
|
|
65
|
+
yScale: PropTypes.func.isRequired
|
|
66
|
+
} : void 0;
|
|
67
|
+
export { ScatterAsync };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type DefaultizedScatterSeriesType } from "../../models/seriesType/scatter.mjs";
|
|
3
|
+
import type { ColorGetter } from "../../internals/plugins/corePlugins/useChartSeriesConfig/index.mjs";
|
|
4
|
+
import { type ScatterProps } from "../Scatter.mjs";
|
|
5
|
+
export interface ScatterAsyncBatchProps extends Pick<ScatterProps, 'series' | 'colorGetter' | 'onItemClick' | 'slots' | 'slotProps' | 'classes'> {
|
|
6
|
+
series: DefaultizedScatterSeriesType;
|
|
7
|
+
colorGetter: ColorGetter<'scatter'>;
|
|
8
|
+
/** First point index of this batch (inclusive). */
|
|
9
|
+
start: number;
|
|
10
|
+
/** Last point index of this batch (exclusive). */
|
|
11
|
+
end: number;
|
|
12
|
+
/**
|
|
13
|
+
* Whether this batch is allowed to render its markers yet. `ScatterAsync`
|
|
14
|
+
* ramps this up batch by batch across animation frames for a progressive
|
|
15
|
+
* paint. When `false` the `<g>` still mounts but stays empty.
|
|
16
|
+
*/
|
|
17
|
+
revealed: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @ignore - internal component.
|
|
21
|
+
*/
|
|
22
|
+
declare function ScatterAsyncBatchComponent(props: ScatterAsyncBatchProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare const ScatterAsyncBatch: React.MemoExoticComponent<typeof ScatterAsyncBatchComponent>;
|
|
24
|
+
export { ScatterAsyncBatch };
|