@mui/x-charts 9.4.0 → 9.6.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/BarChart.js +1 -1
- package/BarChart/BarChart.mjs +1 -1
- package/BarChart/BarElement.js +2 -1
- package/BarChart/BarElement.mjs +2 -1
- package/BarChart/BarLabel/BarLabel.js +1 -1
- package/BarChart/BarLabel/BarLabel.mjs +1 -1
- package/BarChart/BarPlot.js +1 -1
- package/BarChart/BarPlot.mjs +1 -1
- package/CHANGELOG.md +251 -0
- package/ChartsAxis/ChartsAxis.js +1 -1
- package/ChartsAxis/ChartsAxis.mjs +1 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.mjs +1 -1
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.js +2 -2
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.mjs +2 -2
- package/ChartsBrushOverlay/ChartsBrushOverlay.d.mts +5 -1
- package/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +5 -1
- package/ChartsBrushOverlay/ChartsBrushOverlay.js +12 -1
- package/ChartsBrushOverlay/ChartsBrushOverlay.mjs +14 -2
- package/ChartsClipPath/ChartsClipPath.js +1 -1
- package/ChartsClipPath/ChartsClipPath.mjs +1 -1
- package/ChartsContainer/ChartsContainer.js +5 -3
- package/ChartsContainer/ChartsContainer.mjs +5 -3
- package/ChartsDataProvider/ChartsDataProvider.js +5 -1
- package/ChartsDataProvider/ChartsDataProvider.mjs +5 -1
- package/ChartsGrid/ChartsGrid.js +5 -1
- package/ChartsGrid/ChartsGrid.mjs +5 -1
- package/ChartsLayerContainer/ChartsLayerContainer.js +1 -1
- package/ChartsLayerContainer/ChartsLayerContainer.mjs +1 -1
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -1
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.mjs +1 -1
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.js +2 -2
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.mjs +2 -2
- 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 +10 -2
- package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +10 -2
- 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/ChartsRadialGrid.js +5 -1
- package/ChartsRadialGrid/ChartsRadialGrid.mjs +5 -1
- 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/ChartsRadiusAxis.d.mts +8 -2
- package/ChartsRadiusAxis/ChartsRadiusAxis.d.ts +8 -2
- package/ChartsRadiusAxis/ChartsRadiusAxis.js +143 -3
- package/ChartsRadiusAxis/ChartsRadiusAxis.mjs +144 -5
- 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/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsReferenceLine.mjs +1 -1
- package/ChartsRotationAxis/ChartsRotationAxis.d.mts +8 -2
- package/ChartsRotationAxis/ChartsRotationAxis.d.ts +8 -2
- package/ChartsRotationAxis/ChartsRotationAxis.js +140 -3
- package/ChartsRotationAxis/ChartsRotationAxis.mjs +141 -5
- 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/ChartsSurface/ChartsSurface.js +1 -1
- package/ChartsSurface/ChartsSurface.mjs +1 -1
- package/ChartsSvgLayer/ChartsSvgLayer.js +1 -1
- package/ChartsSvgLayer/ChartsSvgLayer.mjs +1 -1
- package/ChartsText/ChartsText.js +2 -2
- package/ChartsText/ChartsText.mjs +2 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +22 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.mjs +22 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +52 -1
- package/ChartsTooltip/ChartsItemTooltipContent.mjs +52 -1
- package/ChartsTooltip/ChartsTooltip.js +13 -33
- package/ChartsTooltip/ChartsTooltip.mjs +13 -33
- package/ChartsTooltip/ChartsTooltipContainer.js +17 -30
- package/ChartsTooltip/ChartsTooltipContainer.mjs +17 -30
- package/ChartsWrapper/ChartsWrapper.js +1 -1
- package/ChartsWrapper/ChartsWrapper.mjs +1 -1
- package/ChartsXAxis/ChartsSingleXAxisTicks.js +1 -1
- package/ChartsXAxis/ChartsSingleXAxisTicks.mjs +1 -1
- package/ChartsXAxis/ChartsXAxis.js +11 -2
- package/ChartsXAxis/ChartsXAxis.mjs +11 -2
- package/ChartsYAxis/ChartsSingleYAxisTicks.js +1 -1
- package/ChartsYAxis/ChartsSingleYAxisTicks.mjs +1 -1
- package/ChartsYAxis/ChartsYAxis.js +11 -2
- package/ChartsYAxis/ChartsYAxis.mjs +11 -2
- package/ChartsYAxis/ChartsYAxisImpl.js +1 -1
- package/ChartsYAxis/ChartsYAxisImpl.mjs +1 -1
- package/Gauge/Gauge.js +1 -1
- package/Gauge/Gauge.mjs +1 -1
- package/Gauge/GaugeContainer.js +1 -1
- package/Gauge/GaugeContainer.mjs +1 -1
- package/Gauge/GaugeValueArc.js +2 -2
- package/Gauge/GaugeValueArc.mjs +2 -2
- package/Gauge/GaugeValueText.js +1 -1
- package/Gauge/GaugeValueText.mjs +1 -1
- package/LineChart/AnimatedArea.js +3 -3
- package/LineChart/AnimatedArea.mjs +3 -3
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AnimatedLine.mjs +1 -1
- package/LineChart/AreaElement.js +2 -2
- package/LineChart/AreaElement.mjs +2 -2
- package/LineChart/AreaPlot.js +1 -1
- package/LineChart/AreaPlot.mjs +1 -1
- package/LineChart/CircleMarkElement.js +1 -1
- package/LineChart/CircleMarkElement.mjs +1 -1
- package/LineChart/LineChart.js +1 -1
- package/LineChart/LineChart.mjs +1 -1
- package/LineChart/LineElement.js +5 -3
- package/LineChart/LineElement.mjs +5 -3
- package/LineChart/LineHighlightElement.js +1 -2
- package/LineChart/LineHighlightElement.mjs +1 -2
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LineHighlightPlot.mjs +1 -1
- package/LineChart/LinePlot.js +1 -1
- package/LineChart/LinePlot.mjs +1 -1
- package/LineChart/MarkElement.js +4 -3
- package/LineChart/MarkElement.mjs +4 -3
- package/LineChart/MarkPlot.js +2 -1
- package/LineChart/MarkPlot.mjs +2 -1
- package/PieChart/FocusedPieArc.d.mts +5 -1
- package/PieChart/FocusedPieArc.d.ts +5 -1
- package/PieChart/FocusedPieArc.js +22 -1
- package/PieChart/FocusedPieArc.mjs +24 -2
- package/PieChart/PieArc.js +1 -1
- package/PieChart/PieArc.mjs +1 -1
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieArcLabel.mjs +1 -1
- package/PieChart/PieArcLabelPlot.js +7 -6
- package/PieChart/PieArcLabelPlot.mjs +7 -6
- package/PieChart/PieArcPlot.js +7 -6
- package/PieChart/PieArcPlot.mjs +7 -6
- package/PieChart/PieChart.js +1 -1
- package/PieChart/PieChart.mjs +1 -1
- package/PieChart/PiePlot.js +2 -1
- package/PieChart/PiePlot.mjs +2 -1
- package/RadarChart/RadarAxis/RadarAxis.js +5 -1
- package/RadarChart/RadarAxis/RadarAxis.mjs +5 -1
- package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +6 -2
- package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.mjs +6 -2
- package/RadarChart/RadarChart.js +1 -1
- package/RadarChart/RadarChart.mjs +1 -1
- package/RadarChart/RadarGrid/RadarGrid.js +1 -5
- package/RadarChart/RadarGrid/RadarGrid.mjs +1 -5
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +5 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.mjs +5 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +5 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.mjs +5 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +5 -1
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.mjs +5 -1
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/Scatter.mjs +1 -1
- package/ScatterChart/ScatterChart.js +12 -6
- package/ScatterChart/ScatterChart.mjs +12 -6
- 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.js +2 -2
- package/ScatterChart/ScatterMarker.mjs +2 -2
- package/ScatterChart/ScatterPlot.d.mts +12 -3
- package/ScatterChart/ScatterPlot.d.ts +12 -3
- package/ScatterChart/ScatterPlot.js +30 -5
- package/ScatterChart/ScatterPlot.mjs +30 -5
- 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/getColor.js +6 -15
- package/ScatterChart/seriesConfig/getColor.mjs +6 -15
- package/SparkLineChart/SparkLineChart.js +3 -2
- package/SparkLineChart/SparkLineChart.mjs +3 -2
- package/Toolbar/Toolbar.js +1 -1
- package/Toolbar/Toolbar.mjs +1 -1
- package/Toolbar/ToolbarButton.js +1 -1
- package/Toolbar/ToolbarButton.mjs +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/colorScale.d.mts +2 -2
- package/internals/colorScale.d.ts +2 -2
- package/internals/colorScale.js +2 -2
- package/internals/colorScale.mjs +2 -2
- package/internals/getSeriesColorFn.d.mts +5 -5
- package/internals/getSeriesColorFn.d.ts +5 -5
- package/internals/index.d.mts +3 -0
- package/internals/index.d.ts +3 -0
- package/internals/index.js +20 -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/corePlugins/useChartInteractionListener/useChartInteractionListener.js +16 -30
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.mjs +17 -31
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.mts +8 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +8 -1
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.mts +1 -1
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipItemPositionGetter.types.d.mts +7 -0
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipItemPositionGetter.types.d.ts +7 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.d.mts +0 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.d.ts +0 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.js +1 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/domain.mjs +2 -2
- 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.js +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.mjs +1 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +6 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +6 -1
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +6 -2
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.mjs +6 -2
- package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.selectors.d.mts +49 -0
- package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.selectors.d.ts +49 -0
- package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.selectors.js +124 -0
- package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.selectors.mjs +117 -0
- package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.types.d.mts +64 -0
- package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.types.d.ts +64 -0
- package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.types.js +5 -0
- package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.types.mjs +1 -0
- 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/resolveColorProcessor.js +4 -7
- package/internals/resolveColorProcessor.mjs +4 -7
- package/internals/scales/scaleBand.js +70 -43
- package/internals/scales/scaleBand.mjs +71 -44
- package/models/axis.d.mts +20 -4
- package/models/axis.d.ts +20 -4
- package/models/colorMapping.d.mts +8 -0
- package/models/colorMapping.d.ts +8 -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 +1 -1
- package/models/seriesType/line.d.ts +1 -1
- 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 +1 -1
- package/models/seriesType/scatter.d.ts +1 -1
- package/package.json +8 -5
- package/hooks/useIsHydrated.d.mts +0 -4
- package/hooks/useIsHydrated.d.ts +0 -4
- package/hooks/useIsHydrated.js +0 -19
- package/hooks/useIsHydrated.mjs +0 -14
|
@@ -8,8 +8,15 @@ export interface ScatterPlotSlotProps extends ScatterSlotProps {
|
|
|
8
8
|
scatter?: Partial<ScatterProps> & ScatterPropsOverrides;
|
|
9
9
|
}
|
|
10
10
|
export type RendererType = 'svg-single' | 'svg-batch';
|
|
11
|
-
export interface ScatterPlotProps extends Pick<ScatterProps, '
|
|
11
|
+
export interface ScatterPlotProps extends Pick<ScatterProps, 'classes'> {
|
|
12
12
|
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Callback fired when a marker is clicked directly.
|
|
15
|
+
* For closest-point clicks (the `ScatterChart` default), pass `onItemClick` to the chart container instead.
|
|
16
|
+
* @param {MouseEvent} event Mouse event recorded on the `<svg/>` element.
|
|
17
|
+
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
18
|
+
*/
|
|
19
|
+
onItemClick?: ScatterProps['onItemClick'];
|
|
13
20
|
/**
|
|
14
21
|
* Overridable component slots.
|
|
15
22
|
* @default {}
|
|
@@ -22,13 +29,15 @@ export interface ScatterPlotProps extends Pick<ScatterProps, 'onItemClick' | 'cl
|
|
|
22
29
|
slotProps?: ScatterPlotSlotProps;
|
|
23
30
|
/**
|
|
24
31
|
* The type of renderer to use for the scatter plot.
|
|
25
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
32
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
33
|
+
* - `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.
|
|
26
34
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
27
35
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
28
36
|
*
|
|
37
|
+
* 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.
|
|
29
38
|
* @default 'svg-single'
|
|
30
39
|
*/
|
|
31
|
-
renderer?: RendererType;
|
|
40
|
+
renderer?: RendererType | 'svg-progressive';
|
|
32
41
|
}
|
|
33
42
|
/**
|
|
34
43
|
* Demos:
|
|
@@ -19,8 +19,13 @@ var _useZAxis = require("../hooks/useZAxis");
|
|
|
19
19
|
var _seriesConfig = require("./seriesConfig");
|
|
20
20
|
var _getMarkerSize = _interopRequireDefault(require("./seriesConfig/getMarkerSize"));
|
|
21
21
|
var _BatchScatter = require("./BatchScatter");
|
|
22
|
+
var _ScatterAsync = require("./async/ScatterAsync");
|
|
22
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");
|
|
23
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
+
const EMPTY_SERIES_IDS = [];
|
|
24
29
|
const ScatterPlotRoot = (0, _styles.styled)('g', {
|
|
25
30
|
name: 'MuiScatterPlot',
|
|
26
31
|
slot: 'Root'
|
|
@@ -61,6 +66,14 @@ function ScatterPlot(props) {
|
|
|
61
66
|
const classes = (0, _scatterClasses.useUtilityClasses)({
|
|
62
67
|
classes: inClasses
|
|
63
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]);
|
|
64
77
|
if (seriesData === undefined) {
|
|
65
78
|
return null;
|
|
66
79
|
}
|
|
@@ -71,7 +84,14 @@ function ScatterPlot(props) {
|
|
|
71
84
|
const defaultXAxisId = xAxisIds[0];
|
|
72
85
|
const defaultYAxisId = yAxisIds[0];
|
|
73
86
|
const defaultZAxisId = zAxisIds[0];
|
|
74
|
-
|
|
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
|
+
}
|
|
75
95
|
const ScatterItems = slots?.scatter ?? DefaultScatterItems;
|
|
76
96
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterPlotRoot, {
|
|
77
97
|
className: (0, _clsx.default)(classes.root, className),
|
|
@@ -107,26 +127,31 @@ function ScatterPlot(props) {
|
|
|
107
127
|
})
|
|
108
128
|
});
|
|
109
129
|
}
|
|
110
|
-
process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes = {
|
|
130
|
+
process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes /* remove-proptypes */ = {
|
|
111
131
|
// ----------------------------- Warning --------------------------------
|
|
112
132
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
113
133
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
114
134
|
// ----------------------------------------------------------------------
|
|
135
|
+
classes: _propTypes.default.object,
|
|
136
|
+
className: _propTypes.default.string,
|
|
115
137
|
/**
|
|
116
|
-
* Callback fired when
|
|
138
|
+
* Callback fired when a marker is clicked directly.
|
|
139
|
+
* For closest-point clicks (the `ScatterChart` default), pass `onItemClick` to the chart container instead.
|
|
117
140
|
* @param {MouseEvent} event Mouse event recorded on the `<svg/>` element.
|
|
118
141
|
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
119
142
|
*/
|
|
120
143
|
onItemClick: _propTypes.default.func,
|
|
121
144
|
/**
|
|
122
145
|
* The type of renderer to use for the scatter plot.
|
|
123
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
146
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
147
|
+
* - `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.
|
|
124
148
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
125
149
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
126
150
|
*
|
|
151
|
+
* 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.
|
|
127
152
|
* @default 'svg-single'
|
|
128
153
|
*/
|
|
129
|
-
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-single']),
|
|
154
|
+
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-progressive', 'svg-single']),
|
|
130
155
|
/**
|
|
131
156
|
* The props used for each component slot.
|
|
132
157
|
* @default {}
|
|
@@ -12,8 +12,13 @@ import { useZAxes } from "../hooks/useZAxis.mjs";
|
|
|
12
12
|
import { scatterSeriesConfig } from "./seriesConfig/index.mjs";
|
|
13
13
|
import getMarkerSize from "./seriesConfig/getMarkerSize.mjs";
|
|
14
14
|
import { BatchScatter } from "./BatchScatter.mjs";
|
|
15
|
+
import { ScatterAsync } from "./async/ScatterAsync.mjs";
|
|
15
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";
|
|
16
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
const EMPTY_SERIES_IDS = [];
|
|
17
22
|
const ScatterPlotRoot = styled('g', {
|
|
18
23
|
name: 'MuiScatterPlot',
|
|
19
24
|
slot: 'Root'
|
|
@@ -54,6 +59,14 @@ function ScatterPlot(props) {
|
|
|
54
59
|
const classes = useUtilityClasses({
|
|
55
60
|
classes: inClasses
|
|
56
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]);
|
|
57
70
|
if (seriesData === undefined) {
|
|
58
71
|
return null;
|
|
59
72
|
}
|
|
@@ -64,7 +77,14 @@ function ScatterPlot(props) {
|
|
|
64
77
|
const defaultXAxisId = xAxisIds[0];
|
|
65
78
|
const defaultYAxisId = yAxisIds[0];
|
|
66
79
|
const defaultZAxisId = zAxisIds[0];
|
|
67
|
-
|
|
80
|
+
let DefaultScatterItems;
|
|
81
|
+
if (renderer === 'svg-batch') {
|
|
82
|
+
DefaultScatterItems = BatchScatter;
|
|
83
|
+
} else if (isProgressive) {
|
|
84
|
+
DefaultScatterItems = ScatterAsync;
|
|
85
|
+
} else {
|
|
86
|
+
DefaultScatterItems = Scatter;
|
|
87
|
+
}
|
|
68
88
|
const ScatterItems = slots?.scatter ?? DefaultScatterItems;
|
|
69
89
|
return /*#__PURE__*/_jsx(ScatterPlotRoot, {
|
|
70
90
|
className: clsx(classes.root, className),
|
|
@@ -100,26 +120,31 @@ function ScatterPlot(props) {
|
|
|
100
120
|
})
|
|
101
121
|
});
|
|
102
122
|
}
|
|
103
|
-
process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes = {
|
|
123
|
+
process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes /* remove-proptypes */ = {
|
|
104
124
|
// ----------------------------- Warning --------------------------------
|
|
105
125
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
106
126
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
107
127
|
// ----------------------------------------------------------------------
|
|
128
|
+
classes: PropTypes.object,
|
|
129
|
+
className: PropTypes.string,
|
|
108
130
|
/**
|
|
109
|
-
* Callback fired when
|
|
131
|
+
* Callback fired when a marker is clicked directly.
|
|
132
|
+
* For closest-point clicks (the `ScatterChart` default), pass `onItemClick` to the chart container instead.
|
|
110
133
|
* @param {MouseEvent} event Mouse event recorded on the `<svg/>` element.
|
|
111
134
|
* @param {ScatterItemIdentifier} scatterItemIdentifier The scatter item identifier.
|
|
112
135
|
*/
|
|
113
136
|
onItemClick: PropTypes.func,
|
|
114
137
|
/**
|
|
115
138
|
* The type of renderer to use for the scatter plot.
|
|
116
|
-
* - `svg-single`: Renders every scatter item in a `<circle />` element.
|
|
139
|
+
* - `svg-single`: Renders every scatter item in a `<circle />` element, synchronously.
|
|
140
|
+
* - `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.
|
|
117
141
|
* - `svg-batch`: Batch renders scatter items in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
118
142
|
* Read more: https://mui.com/x/react-charts/scatter/#performance
|
|
119
143
|
*
|
|
144
|
+
* 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.
|
|
120
145
|
* @default 'svg-single'
|
|
121
146
|
*/
|
|
122
|
-
renderer: PropTypes.oneOf(['svg-batch', 'svg-single']),
|
|
147
|
+
renderer: PropTypes.oneOf(['svg-batch', 'svg-progressive', 'svg-single']),
|
|
123
148
|
/**
|
|
124
149
|
* The props used for each component slot.
|
|
125
150
|
* @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 };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type DefaultizedScatterSeriesType } from "../../models/seriesType/scatter.js";
|
|
3
|
+
import type { ColorGetter } from "../../internals/plugins/corePlugins/useChartSeriesConfig/index.js";
|
|
4
|
+
import { type ScatterProps } from "../Scatter.js";
|
|
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 };
|
|
@@ -0,0 +1,112 @@
|
|
|
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.ScatterAsyncBatch = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
|
+
var _useSlotProps2 = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
15
|
+
var _useInteractionItemProps = require("../../hooks/useInteractionItemProps");
|
|
16
|
+
var _useStore = require("../../internals/store/useStore");
|
|
17
|
+
var _useItemHighlightStateGetter = require("../../hooks/useItemHighlightStateGetter");
|
|
18
|
+
var _useChartClosestPoint = require("../../internals/plugins/featurePlugins/useChartClosestPoint");
|
|
19
|
+
var _ScatterMarker = require("../ScatterMarker");
|
|
20
|
+
var _scatterClasses = require("../scatterClasses");
|
|
21
|
+
var _ChartsProvider = require("../../context/ChartsProvider");
|
|
22
|
+
var _scatterRenderData = require("./scatterRenderData.selectors");
|
|
23
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
+
const _excluded = ["ownerState"];
|
|
25
|
+
/**
|
|
26
|
+
* @ignore - internal component.
|
|
27
|
+
*/
|
|
28
|
+
function ScatterAsyncBatchComponent(props) {
|
|
29
|
+
const {
|
|
30
|
+
series,
|
|
31
|
+
colorGetter,
|
|
32
|
+
onItemClick,
|
|
33
|
+
slots,
|
|
34
|
+
slotProps,
|
|
35
|
+
start,
|
|
36
|
+
end,
|
|
37
|
+
revealed,
|
|
38
|
+
classes: inClasses
|
|
39
|
+
} = props;
|
|
40
|
+
const classes = (0, _scatterClasses.useUtilityClasses)({
|
|
41
|
+
classes: inClasses
|
|
42
|
+
});
|
|
43
|
+
const {
|
|
44
|
+
instance
|
|
45
|
+
} = (0, _ChartsProvider.useChartsContext)();
|
|
46
|
+
const store = (0, _useStore.useStore)();
|
|
47
|
+
const isVoronoiEnabled = store.use(_useChartClosestPoint.selectorChartsIsVoronoiEnabled);
|
|
48
|
+
const skipInteractionHandlers = isVoronoiEnabled;
|
|
49
|
+
const getHighlightState = (0, _useItemHighlightStateGetter.useItemHighlightStateGetter)();
|
|
50
|
+
const renderData = store.use(_scatterRenderData.selectorScatterSeriesRenderData, series.id);
|
|
51
|
+
const Marker = slots?.marker ?? _ScatterMarker.ScatterMarker;
|
|
52
|
+
const _useSlotProps = (0, _useSlotProps2.default)({
|
|
53
|
+
elementType: Marker,
|
|
54
|
+
externalSlotProps: slotProps?.marker,
|
|
55
|
+
additionalProps: {
|
|
56
|
+
seriesId: series.id,
|
|
57
|
+
size: series.markerSize
|
|
58
|
+
},
|
|
59
|
+
ownerState: {}
|
|
60
|
+
}),
|
|
61
|
+
markerProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded);
|
|
62
|
+
if (renderData === undefined || !revealed) {
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
64
|
+
"data-series": series.id,
|
|
65
|
+
className: classes.series
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const view = (0, _scatterRenderData.getScatterBatchView)(renderData, start, end);
|
|
69
|
+
const markers = [];
|
|
70
|
+
const nLocal = view.length / 3;
|
|
71
|
+
for (let local = 0; local < nLocal; local += 1) {
|
|
72
|
+
const x = view[local * 3];
|
|
73
|
+
const y = view[local * 3 + 1];
|
|
74
|
+
const dataIndex = view[local * 3 + 2];
|
|
75
|
+
const dataPoint = {
|
|
76
|
+
x,
|
|
77
|
+
y,
|
|
78
|
+
dataIndex,
|
|
79
|
+
seriesId: series.id,
|
|
80
|
+
type: 'scatter'
|
|
81
|
+
};
|
|
82
|
+
const highlightState = getHighlightState(dataPoint);
|
|
83
|
+
const isItemHighlighted = highlightState === 'highlighted';
|
|
84
|
+
const isItemFaded = highlightState === 'faded';
|
|
85
|
+
markers.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(Marker, (0, _extends2.default)({
|
|
86
|
+
className: (0, _clsx.default)(classes.marker, markerProps.className),
|
|
87
|
+
dataIndex: dataIndex,
|
|
88
|
+
color: colorGetter(dataIndex),
|
|
89
|
+
isHighlighted: isItemHighlighted,
|
|
90
|
+
isFaded: isItemFaded,
|
|
91
|
+
x: x,
|
|
92
|
+
y: y,
|
|
93
|
+
onClick: onItemClick && (event => onItemClick(event, {
|
|
94
|
+
type: 'scatter',
|
|
95
|
+
seriesId: series.id,
|
|
96
|
+
dataIndex
|
|
97
|
+
})),
|
|
98
|
+
"data-highlighted": isItemHighlighted || undefined,
|
|
99
|
+
"data-faded": isItemFaded || undefined
|
|
100
|
+
}, skipInteractionHandlers ? undefined : (0, _useInteractionItemProps.getInteractionItemProps)(instance, dataPoint), markerProps), dataIndex));
|
|
101
|
+
}
|
|
102
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
103
|
+
"data-series": series.id,
|
|
104
|
+
className: classes.series,
|
|
105
|
+
children: markers
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Memoized so a reveal tick (which re-renders every `ScatterAsync`) only
|
|
110
|
+
// re-renders the one batch whose `revealed` prop changed.
|
|
111
|
+
const ScatterAsyncBatch = exports.ScatterAsyncBatch = /*#__PURE__*/React.memo(ScatterAsyncBatchComponent);
|
|
112
|
+
if (process.env.NODE_ENV !== "production") ScatterAsyncBatch.displayName = "ScatterAsyncBatch";
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["ownerState"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import clsx from 'clsx';
|
|
8
|
+
import useSlotProps from '@mui/utils/useSlotProps';
|
|
9
|
+
import { getInteractionItemProps } from "../../hooks/useInteractionItemProps.mjs";
|
|
10
|
+
import { useStore } from "../../internals/store/useStore.mjs";
|
|
11
|
+
import { useItemHighlightStateGetter } from "../../hooks/useItemHighlightStateGetter.mjs";
|
|
12
|
+
import { selectorChartsIsVoronoiEnabled } from "../../internals/plugins/featurePlugins/useChartClosestPoint/index.mjs";
|
|
13
|
+
import { ScatterMarker } from "../ScatterMarker.mjs";
|
|
14
|
+
import { useUtilityClasses } from "../scatterClasses.mjs";
|
|
15
|
+
import { useChartsContext } from "../../context/ChartsProvider/index.mjs";
|
|
16
|
+
import { getScatterBatchView, selectorScatterSeriesRenderData } from "./scatterRenderData.selectors.mjs";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
/**
|
|
19
|
+
* @ignore - internal component.
|
|
20
|
+
*/
|
|
21
|
+
function ScatterAsyncBatchComponent(props) {
|
|
22
|
+
const {
|
|
23
|
+
series,
|
|
24
|
+
colorGetter,
|
|
25
|
+
onItemClick,
|
|
26
|
+
slots,
|
|
27
|
+
slotProps,
|
|
28
|
+
start,
|
|
29
|
+
end,
|
|
30
|
+
revealed,
|
|
31
|
+
classes: inClasses
|
|
32
|
+
} = props;
|
|
33
|
+
const classes = useUtilityClasses({
|
|
34
|
+
classes: inClasses
|
|
35
|
+
});
|
|
36
|
+
const {
|
|
37
|
+
instance
|
|
38
|
+
} = useChartsContext();
|
|
39
|
+
const store = useStore();
|
|
40
|
+
const isVoronoiEnabled = store.use(selectorChartsIsVoronoiEnabled);
|
|
41
|
+
const skipInteractionHandlers = isVoronoiEnabled;
|
|
42
|
+
const getHighlightState = useItemHighlightStateGetter();
|
|
43
|
+
const renderData = store.use(selectorScatterSeriesRenderData, series.id);
|
|
44
|
+
const Marker = slots?.marker ?? ScatterMarker;
|
|
45
|
+
const _useSlotProps = useSlotProps({
|
|
46
|
+
elementType: Marker,
|
|
47
|
+
externalSlotProps: slotProps?.marker,
|
|
48
|
+
additionalProps: {
|
|
49
|
+
seriesId: series.id,
|
|
50
|
+
size: series.markerSize
|
|
51
|
+
},
|
|
52
|
+
ownerState: {}
|
|
53
|
+
}),
|
|
54
|
+
markerProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded);
|
|
55
|
+
if (renderData === undefined || !revealed) {
|
|
56
|
+
return /*#__PURE__*/_jsx("g", {
|
|
57
|
+
"data-series": series.id,
|
|
58
|
+
className: classes.series
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const view = getScatterBatchView(renderData, start, end);
|
|
62
|
+
const markers = [];
|
|
63
|
+
const nLocal = view.length / 3;
|
|
64
|
+
for (let local = 0; local < nLocal; local += 1) {
|
|
65
|
+
const x = view[local * 3];
|
|
66
|
+
const y = view[local * 3 + 1];
|
|
67
|
+
const dataIndex = view[local * 3 + 2];
|
|
68
|
+
const dataPoint = {
|
|
69
|
+
x,
|
|
70
|
+
y,
|
|
71
|
+
dataIndex,
|
|
72
|
+
seriesId: series.id,
|
|
73
|
+
type: 'scatter'
|
|
74
|
+
};
|
|
75
|
+
const highlightState = getHighlightState(dataPoint);
|
|
76
|
+
const isItemHighlighted = highlightState === 'highlighted';
|
|
77
|
+
const isItemFaded = highlightState === 'faded';
|
|
78
|
+
markers.push(/*#__PURE__*/_jsx(Marker, _extends({
|
|
79
|
+
className: clsx(classes.marker, markerProps.className),
|
|
80
|
+
dataIndex: dataIndex,
|
|
81
|
+
color: colorGetter(dataIndex),
|
|
82
|
+
isHighlighted: isItemHighlighted,
|
|
83
|
+
isFaded: isItemFaded,
|
|
84
|
+
x: x,
|
|
85
|
+
y: y,
|
|
86
|
+
onClick: onItemClick && (event => onItemClick(event, {
|
|
87
|
+
type: 'scatter',
|
|
88
|
+
seriesId: series.id,
|
|
89
|
+
dataIndex
|
|
90
|
+
})),
|
|
91
|
+
"data-highlighted": isItemHighlighted || undefined,
|
|
92
|
+
"data-faded": isItemFaded || undefined
|
|
93
|
+
}, skipInteractionHandlers ? undefined : getInteractionItemProps(instance, dataPoint), markerProps), dataIndex));
|
|
94
|
+
}
|
|
95
|
+
return /*#__PURE__*/_jsx("g", {
|
|
96
|
+
"data-series": series.id,
|
|
97
|
+
className: classes.series,
|
|
98
|
+
children: markers
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Memoized so a reveal tick (which re-renders every `ScatterAsync`) only
|
|
103
|
+
// re-renders the one batch whose `revealed` prop changed.
|
|
104
|
+
const ScatterAsyncBatch = /*#__PURE__*/React.memo(ScatterAsyncBatchComponent);
|
|
105
|
+
if (process.env.NODE_ENV !== "production") ScatterAsyncBatch.displayName = "ScatterAsyncBatch";
|
|
106
|
+
export { ScatterAsyncBatch };
|