@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
|
@@ -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 };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-computed render data for a single scatter series.
|
|
3
|
+
*
|
|
4
|
+
* Coordinates are stored in a packed `Float64Array` (stride 3: `[x0, y0, i0,
|
|
5
|
+
* x1, y1, i1, ...]`, where `iN` is the original `dataIndex`). Only points that
|
|
6
|
+
* project inside the drawing area are kept, so the progressive renderer can
|
|
7
|
+
* size its batches by the number of *visible* points — when zoomed in tightly
|
|
8
|
+
* the wave finishes in a single tick. Batches are contiguous slices of this
|
|
9
|
+
* array, so a batch's data is obtained with a zero-copy `subarray` view (see
|
|
10
|
+
* {@link getScatterBatchView}).
|
|
11
|
+
*/
|
|
12
|
+
export interface ScatterSeriesRenderData {
|
|
13
|
+
/** Packed projected pixel coordinates + dataIndex, stride 3. */
|
|
14
|
+
coords: Float64Array;
|
|
15
|
+
/** Number of visible points (i.e. `coords.length / 3`). */
|
|
16
|
+
count: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Packed projected coordinates for every scatter series, filtered to the
|
|
20
|
+
* drawing area. Recomputes when the processed series, axis scales, or drawing
|
|
21
|
+
* area change.
|
|
22
|
+
*/
|
|
23
|
+
export declare const selectorScatterRenderData: (args_0: import("../../internals/plugins/corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../internals/index.mjs").ChartsSeriesConfig> & import("../../internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../internals/plugins/corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../internals/index.mjs").ChartsSeriesConfig> & import("../../internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../internals/index.mjs").UseChartInteractionListenerState & Partial<{}> & {
|
|
24
|
+
cacheKey: import("../../internals/index.mjs").ChartStateCacheKey;
|
|
25
|
+
}) => Map<string, ScatterSeriesRenderData>;
|
|
26
|
+
/**
|
|
27
|
+
* Render data for a single scatter series, or `undefined` while it is not
|
|
28
|
+
* available yet (processors/axes still pending).
|
|
29
|
+
*/
|
|
30
|
+
export declare const selectorScatterSeriesRenderData: (args_0: import("../../internals/plugins/corePlugins/useChartId/useChartId.types.mjs").UseChartIdState & import("../../internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.mjs").UseChartSeriesConfigState<keyof import("../../internals/index.mjs").ChartsSeriesConfig> & import("../../internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.mjs").UseChartExperimentalFeaturesState & import("../../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.mjs").UseChartDimensionsState & import("../../internals/plugins/corePlugins/useChartSeries/useChartSeries.types.mjs").UseChartSeriesState<keyof import("../../internals/index.mjs").ChartsSeriesConfig> & import("../../internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types.mjs").UseChartAnimationState & import("../../internals/index.mjs").UseChartInteractionListenerState & Partial<{}> & {
|
|
31
|
+
cacheKey: import("../../internals/index.mjs").ChartStateCacheKey;
|
|
32
|
+
}, seriesId: string) => ScatterSeriesRenderData | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Zero-copy view of one batch's coordinates. `start`/`end` are visible-point
|
|
35
|
+
* indices (not original `dataIndex` values). The returned `Float64Array` shares
|
|
36
|
+
* the buffer with `renderData.coords`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getScatterBatchView(renderData: ScatterSeriesRenderData, start: number, end: number): Float64Array;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-computed render data for a single scatter series.
|
|
3
|
+
*
|
|
4
|
+
* Coordinates are stored in a packed `Float64Array` (stride 3: `[x0, y0, i0,
|
|
5
|
+
* x1, y1, i1, ...]`, where `iN` is the original `dataIndex`). Only points that
|
|
6
|
+
* project inside the drawing area are kept, so the progressive renderer can
|
|
7
|
+
* size its batches by the number of *visible* points — when zoomed in tightly
|
|
8
|
+
* the wave finishes in a single tick. Batches are contiguous slices of this
|
|
9
|
+
* array, so a batch's data is obtained with a zero-copy `subarray` view (see
|
|
10
|
+
* {@link getScatterBatchView}).
|
|
11
|
+
*/
|
|
12
|
+
export interface ScatterSeriesRenderData {
|
|
13
|
+
/** Packed projected pixel coordinates + dataIndex, stride 3. */
|
|
14
|
+
coords: Float64Array;
|
|
15
|
+
/** Number of visible points (i.e. `coords.length / 3`). */
|
|
16
|
+
count: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Packed projected coordinates for every scatter series, filtered to the
|
|
20
|
+
* drawing area. Recomputes when the processed series, axis scales, or drawing
|
|
21
|
+
* area change.
|
|
22
|
+
*/
|
|
23
|
+
export declare const selectorScatterRenderData: (args_0: import("../../internals/plugins/corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../internals/index.js").ChartsSeriesConfig> & import("../../internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../internals/plugins/corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../internals/index.js").ChartsSeriesConfig> & import("../../internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../internals/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
24
|
+
cacheKey: import("../../internals/index.js").ChartStateCacheKey;
|
|
25
|
+
}) => Map<string, ScatterSeriesRenderData>;
|
|
26
|
+
/**
|
|
27
|
+
* Render data for a single scatter series, or `undefined` while it is not
|
|
28
|
+
* available yet (processors/axes still pending).
|
|
29
|
+
*/
|
|
30
|
+
export declare const selectorScatterSeriesRenderData: (args_0: import("../../internals/plugins/corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../internals/plugins/corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../internals/index.js").ChartsSeriesConfig> & import("../../internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../internals/plugins/corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../internals/index.js").ChartsSeriesConfig> & import("../../internals/plugins/corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../internals/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
31
|
+
cacheKey: import("../../internals/index.js").ChartStateCacheKey;
|
|
32
|
+
}, seriesId: string) => ScatterSeriesRenderData | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Zero-copy view of one batch's coordinates. `start`/`end` are visible-point
|
|
35
|
+
* indices (not original `dataIndex` values). The returned `Float64Array` shares
|
|
36
|
+
* the buffer with `renderData.coords`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getScatterBatchView(renderData: ScatterSeriesRenderData, start: number, end: number): Float64Array;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getScatterBatchView = getScatterBatchView;
|
|
7
|
+
exports.selectorScatterSeriesRenderData = exports.selectorScatterRenderData = void 0;
|
|
8
|
+
var _store = require("@mui/x-internals/store");
|
|
9
|
+
var _getValueToPositionMapper = require("../../hooks/getValueToPositionMapper");
|
|
10
|
+
var _useChartSeries = require("../../internals/plugins/corePlugins/useChartSeries");
|
|
11
|
+
var _useChartDimensions = require("../../internals/plugins/corePlugins/useChartDimensions");
|
|
12
|
+
var _useChartCartesianAxis = require("../../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
13
|
+
/**
|
|
14
|
+
* Pre-computed render data for a single scatter series.
|
|
15
|
+
*
|
|
16
|
+
* Coordinates are stored in a packed `Float64Array` (stride 3: `[x0, y0, i0,
|
|
17
|
+
* x1, y1, i1, ...]`, where `iN` is the original `dataIndex`). Only points that
|
|
18
|
+
* project inside the drawing area are kept, so the progressive renderer can
|
|
19
|
+
* size its batches by the number of *visible* points — when zoomed in tightly
|
|
20
|
+
* the wave finishes in a single tick. Batches are contiguous slices of this
|
|
21
|
+
* array, so a batch's data is obtained with a zero-copy `subarray` view (see
|
|
22
|
+
* {@link getScatterBatchView}).
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const EMPTY_RENDER_DATA = new Map();
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Packed projected coordinates for every scatter series, filtered to the
|
|
29
|
+
* drawing area. Recomputes when the processed series, axis scales, or drawing
|
|
30
|
+
* area change.
|
|
31
|
+
*/
|
|
32
|
+
const selectorScatterRenderData = exports.selectorScatterRenderData = (0, _store.createSelectorMemoized)(_useChartSeries.selectorChartSeriesProcessed, _useChartCartesianAxis.selectorChartXAxis, _useChartCartesianAxis.selectorChartYAxis, _useChartDimensions.selectorChartDrawingArea, function selectorScatterRenderData(processedSeries, xAxes, yAxes, drawingArea) {
|
|
33
|
+
const scatter = processedSeries.scatter;
|
|
34
|
+
if (scatter === undefined) {
|
|
35
|
+
return EMPTY_RENDER_DATA;
|
|
36
|
+
}
|
|
37
|
+
const defaultXAxisId = xAxes.axisIds[0];
|
|
38
|
+
const defaultYAxisId = yAxes.axisIds[0];
|
|
39
|
+
const result = new Map();
|
|
40
|
+
const xMin = drawingArea.left - 1;
|
|
41
|
+
const xMax = drawingArea.left + drawingArea.width;
|
|
42
|
+
const yMin = drawingArea.top - 1;
|
|
43
|
+
const yMax = drawingArea.top + drawingArea.height;
|
|
44
|
+
for (const seriesId of scatter.seriesOrder) {
|
|
45
|
+
const series = scatter.series[seriesId];
|
|
46
|
+
const xAxis = xAxes.axis[series.xAxisId ?? defaultXAxisId];
|
|
47
|
+
const yAxis = yAxes.axis[series.yAxisId ?? defaultYAxisId];
|
|
48
|
+
if (xAxis === undefined || yAxis === undefined) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const getXPosition = (0, _getValueToPositionMapper.getValueToPositionMapper)(xAxis.scale);
|
|
52
|
+
const getYPosition = (0, _getValueToPositionMapper.getValueToPositionMapper)(yAxis.scale);
|
|
53
|
+
const data = series.data;
|
|
54
|
+
const n = data.length;
|
|
55
|
+
const packed = new Float64Array(n * 3);
|
|
56
|
+
let j = 0;
|
|
57
|
+
for (let i = 0; i < n; i += 1) {
|
|
58
|
+
const x = getXPosition(data[i].x);
|
|
59
|
+
if (!(x >= xMin && x <= xMax)) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const y = getYPosition(data[i].y);
|
|
63
|
+
if (!(y >= yMin && y <= yMax)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
packed[j] = x;
|
|
67
|
+
packed[j + 1] = y;
|
|
68
|
+
packed[j + 2] = i;
|
|
69
|
+
j += 3;
|
|
70
|
+
}
|
|
71
|
+
const coords = packed.slice(0, j);
|
|
72
|
+
result.set(seriesId, {
|
|
73
|
+
coords,
|
|
74
|
+
count: j / 3
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Render data for a single scatter series, or `undefined` while it is not
|
|
82
|
+
* available yet (processors/axes still pending).
|
|
83
|
+
*/
|
|
84
|
+
const selectorScatterSeriesRenderData = exports.selectorScatterSeriesRenderData = (0, _store.createSelector)(selectorScatterRenderData, (renderData, seriesId) => renderData.get(seriesId));
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Zero-copy view of one batch's coordinates. `start`/`end` are visible-point
|
|
88
|
+
* indices (not original `dataIndex` values). The returned `Float64Array` shares
|
|
89
|
+
* the buffer with `renderData.coords`.
|
|
90
|
+
*/
|
|
91
|
+
function getScatterBatchView(renderData, start, end) {
|
|
92
|
+
return renderData.coords.subarray(start * 3, end * 3);
|
|
93
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createSelector, createSelectorMemoized } from '@mui/x-internals/store';
|
|
2
|
+
import { getValueToPositionMapper } from "../../hooks/getValueToPositionMapper.mjs";
|
|
3
|
+
import { selectorChartSeriesProcessed } from "../../internals/plugins/corePlugins/useChartSeries/index.mjs";
|
|
4
|
+
import { selectorChartDrawingArea } from "../../internals/plugins/corePlugins/useChartDimensions/index.mjs";
|
|
5
|
+
import { selectorChartXAxis, selectorChartYAxis } from "../../internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Pre-computed render data for a single scatter series.
|
|
9
|
+
*
|
|
10
|
+
* Coordinates are stored in a packed `Float64Array` (stride 3: `[x0, y0, i0,
|
|
11
|
+
* x1, y1, i1, ...]`, where `iN` is the original `dataIndex`). Only points that
|
|
12
|
+
* project inside the drawing area are kept, so the progressive renderer can
|
|
13
|
+
* size its batches by the number of *visible* points — when zoomed in tightly
|
|
14
|
+
* the wave finishes in a single tick. Batches are contiguous slices of this
|
|
15
|
+
* array, so a batch's data is obtained with a zero-copy `subarray` view (see
|
|
16
|
+
* {@link getScatterBatchView}).
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const EMPTY_RENDER_DATA = new Map();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Packed projected coordinates for every scatter series, filtered to the
|
|
23
|
+
* drawing area. Recomputes when the processed series, axis scales, or drawing
|
|
24
|
+
* area change.
|
|
25
|
+
*/
|
|
26
|
+
export const selectorScatterRenderData = createSelectorMemoized(selectorChartSeriesProcessed, selectorChartXAxis, selectorChartYAxis, selectorChartDrawingArea, function selectorScatterRenderData(processedSeries, xAxes, yAxes, drawingArea) {
|
|
27
|
+
const scatter = processedSeries.scatter;
|
|
28
|
+
if (scatter === undefined) {
|
|
29
|
+
return EMPTY_RENDER_DATA;
|
|
30
|
+
}
|
|
31
|
+
const defaultXAxisId = xAxes.axisIds[0];
|
|
32
|
+
const defaultYAxisId = yAxes.axisIds[0];
|
|
33
|
+
const result = new Map();
|
|
34
|
+
const xMin = drawingArea.left - 1;
|
|
35
|
+
const xMax = drawingArea.left + drawingArea.width;
|
|
36
|
+
const yMin = drawingArea.top - 1;
|
|
37
|
+
const yMax = drawingArea.top + drawingArea.height;
|
|
38
|
+
for (const seriesId of scatter.seriesOrder) {
|
|
39
|
+
const series = scatter.series[seriesId];
|
|
40
|
+
const xAxis = xAxes.axis[series.xAxisId ?? defaultXAxisId];
|
|
41
|
+
const yAxis = yAxes.axis[series.yAxisId ?? defaultYAxisId];
|
|
42
|
+
if (xAxis === undefined || yAxis === undefined) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const getXPosition = getValueToPositionMapper(xAxis.scale);
|
|
46
|
+
const getYPosition = getValueToPositionMapper(yAxis.scale);
|
|
47
|
+
const data = series.data;
|
|
48
|
+
const n = data.length;
|
|
49
|
+
const packed = new Float64Array(n * 3);
|
|
50
|
+
let j = 0;
|
|
51
|
+
for (let i = 0; i < n; i += 1) {
|
|
52
|
+
const x = getXPosition(data[i].x);
|
|
53
|
+
if (!(x >= xMin && x <= xMax)) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const y = getYPosition(data[i].y);
|
|
57
|
+
if (!(y >= yMin && y <= yMax)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
packed[j] = x;
|
|
61
|
+
packed[j + 1] = y;
|
|
62
|
+
packed[j + 2] = i;
|
|
63
|
+
j += 3;
|
|
64
|
+
}
|
|
65
|
+
const coords = packed.slice(0, j);
|
|
66
|
+
result.set(seriesId, {
|
|
67
|
+
coords,
|
|
68
|
+
count: j / 3
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Render data for a single scatter series, or `undefined` while it is not
|
|
76
|
+
* available yet (processors/axes still pending).
|
|
77
|
+
*/
|
|
78
|
+
export const selectorScatterSeriesRenderData = createSelector(selectorScatterRenderData, (renderData, seriesId) => renderData.get(seriesId));
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Zero-copy view of one batch's coordinates. `start`/`end` are visible-point
|
|
82
|
+
* indices (not original `dataIndex` values). The returned `Float64Array` shares
|
|
83
|
+
* the buffer with `renderData.coords`.
|
|
84
|
+
*/
|
|
85
|
+
export function getScatterBatchView(renderData, start, end) {
|
|
86
|
+
return renderData.coords.subarray(start * 3, end * 3);
|
|
87
|
+
}
|
|
@@ -17,6 +17,9 @@ const getExtremumX = params => {
|
|
|
17
17
|
if (!Object.hasOwn(series, seriesId)) {
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
20
23
|
const axisId = series[seriesId].xAxisId;
|
|
21
24
|
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
22
25
|
continue;
|
|
@@ -59,6 +62,9 @@ const getExtremumY = params => {
|
|
|
59
62
|
if (!Object.hasOwn(series, seriesId)) {
|
|
60
63
|
continue;
|
|
61
64
|
}
|
|
65
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
62
68
|
const axisId = series[seriesId].yAxisId;
|
|
63
69
|
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
64
70
|
continue;
|
|
@@ -11,6 +11,9 @@ export const getExtremumX = params => {
|
|
|
11
11
|
if (!Object.hasOwn(series, seriesId)) {
|
|
12
12
|
continue;
|
|
13
13
|
}
|
|
14
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
14
17
|
const axisId = series[seriesId].xAxisId;
|
|
15
18
|
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
16
19
|
continue;
|
|
@@ -52,6 +55,9 @@ export const getExtremumY = params => {
|
|
|
52
55
|
if (!Object.hasOwn(series, seriesId)) {
|
|
53
56
|
continue;
|
|
54
57
|
}
|
|
58
|
+
if (axis.domainSeries === 'visible' && series[seriesId].hidden) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
55
61
|
const axisId = series[seriesId].yAxisId;
|
|
56
62
|
if (!(axisId === axis.id || axisId === undefined && isDefaultAxis)) {
|
|
57
63
|
continue;
|
|
@@ -25,7 +25,7 @@ const getColor = (series, xAxis, yAxis, zAxis) => {
|
|
|
25
25
|
const color = value === null ? getSeriesColor({
|
|
26
26
|
value,
|
|
27
27
|
dataIndex
|
|
28
|
-
}) : zColorScale(value.z);
|
|
28
|
+
}) : zColorScale(value.colorValue ?? value.z);
|
|
29
29
|
if (color === null) {
|
|
30
30
|
return getSeriesColor({
|
|
31
31
|
value,
|
|
@@ -19,7 +19,7 @@ const getColor = (series, xAxis, yAxis, zAxis) => {
|
|
|
19
19
|
const color = value === null ? getSeriesColor({
|
|
20
20
|
value,
|
|
21
21
|
dataIndex
|
|
22
|
-
}) : zColorScale(value.z);
|
|
22
|
+
}) : zColorScale(value.colorValue ?? value.z);
|
|
23
23
|
if (color === null) {
|
|
24
24
|
return getSeriesColor({
|
|
25
25
|
value,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type DefaultizedScatterSeriesType } from "../../models/seriesType/scatter.mjs";
|
|
2
|
+
import { type ZAxisDefaultized } from "../../models/z-axis.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the marker size of a scatter item given its data index.
|
|
5
|
+
* @param {number} dataIndex The index of the scatter item.
|
|
6
|
+
* @returns {number} The marker size in pixels.
|
|
7
|
+
*/
|
|
8
|
+
export type ScatterSizeGetter = (dataIndex: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a getter returning the marker size of each scatter item.
|
|
11
|
+
*
|
|
12
|
+
* When the size axis defines a `sizeMap`, the size is computed by mapping a value
|
|
13
|
+
* through the resulting `sizeScale`. The mapped value is taken from the size axis
|
|
14
|
+
* `data` when available, otherwise from the `sizeValue` of the scatter point.
|
|
15
|
+
* It falls back to the series `markerSize` when no size can be computed.
|
|
16
|
+
*/
|
|
17
|
+
declare const getMarkerSize: (series: DefaultizedScatterSeriesType, sizeZAxis?: ZAxisDefaultized) => ScatterSizeGetter;
|
|
18
|
+
export default getMarkerSize;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type DefaultizedScatterSeriesType } from "../../models/seriesType/scatter.js";
|
|
2
|
+
import { type ZAxisDefaultized } from "../../models/z-axis.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the marker size of a scatter item given its data index.
|
|
5
|
+
* @param {number} dataIndex The index of the scatter item.
|
|
6
|
+
* @returns {number} The marker size in pixels.
|
|
7
|
+
*/
|
|
8
|
+
export type ScatterSizeGetter = (dataIndex: number) => number;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a getter returning the marker size of each scatter item.
|
|
11
|
+
*
|
|
12
|
+
* When the size axis defines a `sizeMap`, the size is computed by mapping a value
|
|
13
|
+
* through the resulting `sizeScale`. The mapped value is taken from the size axis
|
|
14
|
+
* `data` when available, otherwise from the `sizeValue` of the scatter point.
|
|
15
|
+
* It falls back to the series `markerSize` when no size can be computed.
|
|
16
|
+
*/
|
|
17
|
+
declare const getMarkerSize: (series: DefaultizedScatterSeriesType, sizeZAxis?: ZAxisDefaultized) => ScatterSizeGetter;
|
|
18
|
+
export default getMarkerSize;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the marker size of a scatter item given its data index.
|
|
9
|
+
* @param {number} dataIndex The index of the scatter item.
|
|
10
|
+
* @returns {number} The marker size in pixels.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Builds a getter returning the marker size of each scatter item.
|
|
15
|
+
*
|
|
16
|
+
* When the size axis defines a `sizeMap`, the size is computed by mapping a value
|
|
17
|
+
* through the resulting `sizeScale`. The mapped value is taken from the size axis
|
|
18
|
+
* `data` when available, otherwise from the `sizeValue` of the scatter point.
|
|
19
|
+
* It falls back to the series `markerSize` when no size can be computed.
|
|
20
|
+
*/
|
|
21
|
+
const getMarkerSize = (series, sizeZAxis) => {
|
|
22
|
+
const sizeScale = sizeZAxis?.sizeScale;
|
|
23
|
+
if (!sizeScale) {
|
|
24
|
+
return () => series.markerSize;
|
|
25
|
+
}
|
|
26
|
+
return dataIndex => {
|
|
27
|
+
if (sizeZAxis?.data?.[dataIndex] !== undefined) {
|
|
28
|
+
const size = sizeScale(sizeZAxis.data[dataIndex]);
|
|
29
|
+
if (size != null && !Number.isNaN(size)) {
|
|
30
|
+
return size;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const value = series.data[dataIndex];
|
|
34
|
+
if (value != null) {
|
|
35
|
+
const size = sizeScale(value.sizeValue);
|
|
36
|
+
if (size != null && !Number.isNaN(size)) {
|
|
37
|
+
return size;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return series.markerSize;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
var _default = exports.default = getMarkerSize;
|