@mui/x-charts 9.4.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/CHANGELOG.md +100 -0
- 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/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/ChartsTooltipContainer.js +11 -4
- package/ChartsTooltip/ChartsTooltipContainer.mjs +11 -4
- 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.js +1 -1
- package/LineChart/LineElement.mjs +1 -1
- package/LineChart/MarkElement.js +1 -1
- package/LineChart/MarkElement.mjs +1 -1
- package/ScatterChart/ScatterChart.js +7 -3
- package/ScatterChart/ScatterChart.mjs +7 -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/ScatterPlot.d.mts +4 -2
- package/ScatterChart/ScatterPlot.d.ts +4 -2
- package/ScatterChart/ScatterPlot.js +25 -3
- package/ScatterChart/ScatterPlot.mjs +25 -3
- 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/SparkLineChart/SparkLineChart.js +2 -1
- package/SparkLineChart/SparkLineChart.mjs +2 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/getSeriesColorFn.d.mts +5 -5
- package/internals/getSeriesColorFn.d.ts +5 -5
- package/internals/index.d.mts +1 -0
- package/internals/index.d.ts +1 -0
- package/internals/index.js +12 -0
- package/internals/index.mjs +1 -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/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/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/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 +3 -3
|
@@ -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
|
+
}
|
|
@@ -255,7 +255,8 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
255
255
|
* Options to enable features planned for the next major.
|
|
256
256
|
*/
|
|
257
257
|
experimentalFeatures: _propTypes.default.shape({
|
|
258
|
-
enablePositionBasedPointerInteraction: _propTypes.default.bool
|
|
258
|
+
enablePositionBasedPointerInteraction: _propTypes.default.bool,
|
|
259
|
+
progressiveRendering: _propTypes.default.bool
|
|
259
260
|
}),
|
|
260
261
|
/**
|
|
261
262
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
@@ -248,7 +248,8 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
248
248
|
* Options to enable features planned for the next major.
|
|
249
249
|
*/
|
|
250
250
|
experimentalFeatures: PropTypes.shape({
|
|
251
|
-
enablePositionBasedPointerInteraction: PropTypes.bool
|
|
251
|
+
enablePositionBasedPointerInteraction: PropTypes.bool,
|
|
252
|
+
progressiveRendering: PropTypes.bool
|
|
252
253
|
}),
|
|
253
254
|
/**
|
|
254
255
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type ChartSeriesType } from "../models/seriesType/config.mjs";
|
|
3
|
-
export declare function getSeriesColorFn<TValue>(series: {
|
|
4
|
-
color: NonNullable<
|
|
5
|
-
colorGetter?:
|
|
1
|
+
import { type ColorCallbackValue, type SeriesColor } from "../models/seriesType/common.mjs";
|
|
2
|
+
import { type ChartSeriesType, type ChartsSeriesConfig } from "../models/seriesType/config.mjs";
|
|
3
|
+
export declare function getSeriesColorFn<TValue extends ChartsSeriesConfig[ChartSeriesType]['valueType']>(series: {
|
|
4
|
+
color: NonNullable<SeriesColor<TValue>['color']>;
|
|
5
|
+
colorGetter?: SeriesColor<TValue>['colorGetter'];
|
|
6
6
|
}): (data: ColorCallbackValue<TValue>) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type ChartSeriesType } from "../models/seriesType/config.js";
|
|
3
|
-
export declare function getSeriesColorFn<TValue>(series: {
|
|
4
|
-
color: NonNullable<
|
|
5
|
-
colorGetter?:
|
|
1
|
+
import { type ColorCallbackValue, type SeriesColor } from "../models/seriesType/common.js";
|
|
2
|
+
import { type ChartSeriesType, type ChartsSeriesConfig } from "../models/seriesType/config.js";
|
|
3
|
+
export declare function getSeriesColorFn<TValue extends ChartsSeriesConfig[ChartSeriesType]['valueType']>(series: {
|
|
4
|
+
color: NonNullable<SeriesColor<TValue>['color']>;
|
|
5
|
+
colorGetter?: SeriesColor<TValue>['colorGetter'];
|
|
6
6
|
}): (data: ColorCallbackValue<TValue>) => string;
|
package/internals/index.d.mts
CHANGED
|
@@ -38,6 +38,7 @@ export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.mjs";
|
|
|
38
38
|
export * from "./plugins/featurePlugins/useChartClosestPoint/index.mjs";
|
|
39
39
|
export * from "./plugins/featurePlugins/useChartBrush/index.mjs";
|
|
40
40
|
export * from "./plugins/featurePlugins/useChartItemClick/index.mjs";
|
|
41
|
+
export * from "./plugins/featurePlugins/useProgressiveRendering/index.mjs";
|
|
41
42
|
export * from "./plugins/utils/selectors.mjs";
|
|
42
43
|
export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.mjs";
|
|
43
44
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs";
|
package/internals/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
|
38
38
|
export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
39
39
|
export * from "./plugins/featurePlugins/useChartBrush/index.js";
|
|
40
40
|
export * from "./plugins/featurePlugins/useChartItemClick/index.js";
|
|
41
|
+
export * from "./plugins/featurePlugins/useProgressiveRendering/index.js";
|
|
41
42
|
export * from "./plugins/utils/selectors.js";
|
|
42
43
|
export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js";
|
|
43
44
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
|
package/internals/index.js
CHANGED
|
@@ -541,6 +541,18 @@ Object.keys(_useChartItemClick).forEach(function (key) {
|
|
|
541
541
|
}
|
|
542
542
|
});
|
|
543
543
|
});
|
|
544
|
+
var _useProgressiveRendering = require("./plugins/featurePlugins/useProgressiveRendering");
|
|
545
|
+
Object.keys(_useProgressiveRendering).forEach(function (key) {
|
|
546
|
+
if (key === "default" || key === "__esModule") return;
|
|
547
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
548
|
+
if (key in exports && exports[key] === _useProgressiveRendering[key]) return;
|
|
549
|
+
Object.defineProperty(exports, key, {
|
|
550
|
+
enumerable: true,
|
|
551
|
+
get: function () {
|
|
552
|
+
return _useProgressiveRendering[key];
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
});
|
|
544
556
|
var _selectors = require("./plugins/utils/selectors");
|
|
545
557
|
Object.keys(_selectors).forEach(function (key) {
|
|
546
558
|
if (key === "default" || key === "__esModule") return;
|
package/internals/index.mjs
CHANGED
|
@@ -42,6 +42,7 @@ export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.mjs";
|
|
|
42
42
|
export * from "./plugins/featurePlugins/useChartClosestPoint/index.mjs";
|
|
43
43
|
export * from "./plugins/featurePlugins/useChartBrush/index.mjs";
|
|
44
44
|
export * from "./plugins/featurePlugins/useChartItemClick/index.mjs";
|
|
45
|
+
export * from "./plugins/featurePlugins/useProgressiveRendering/index.mjs";
|
|
45
46
|
export * from "./plugins/utils/selectors.mjs";
|
|
46
47
|
export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.mjs";
|
|
47
48
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs";
|
|
@@ -9,6 +9,7 @@ import { type UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/inde
|
|
|
9
9
|
import { type UseChartBrushSignature } from "./featurePlugins/useChartBrush/index.mjs";
|
|
10
10
|
import { type UseChartVisibilityManagerSignature } from "./featurePlugins/useChartVisibilityManager/index.mjs";
|
|
11
11
|
import { type UseChartTooltipSignature } from "./featurePlugins/useChartTooltip/index.mjs";
|
|
12
|
-
|
|
13
|
-
export type
|
|
14
|
-
export
|
|
12
|
+
import { type UseProgressiveRenderingSignature } from "./featurePlugins/useProgressiveRendering/index.mjs";
|
|
13
|
+
export type AllPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseProgressiveRenderingSignature];
|
|
14
|
+
export type DefaultPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseProgressiveRenderingSignature];
|
|
15
|
+
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.mjs").ChartPlugin<UseChartZAxisSignature>, import("./models/index.mjs").ChartPlugin<UseChartBrushSignature>, import("./models/index.mjs").ChartPlugin<UseChartTooltipSignature<any>>, import("./models/index.mjs").ChartPlugin<UseChartInteractionSignature>, import("./models/index.mjs").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.mjs").ChartPlugin<UseChartHighlightSignature<any>>, import("./models/index.mjs").ChartPlugin<UseChartVisibilityManagerSignature<any>>, import("./models/index.mjs").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.mjs").ChartPlugin<UseChartKeyboardNavigationSignature>, import("./models/index.mjs").ChartPlugin<UseProgressiveRenderingSignature>];
|
|
@@ -9,6 +9,7 @@ import { type UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/inde
|
|
|
9
9
|
import { type UseChartBrushSignature } from "./featurePlugins/useChartBrush/index.js";
|
|
10
10
|
import { type UseChartVisibilityManagerSignature } from "./featurePlugins/useChartVisibilityManager/index.js";
|
|
11
11
|
import { type UseChartTooltipSignature } from "./featurePlugins/useChartTooltip/index.js";
|
|
12
|
-
|
|
13
|
-
export type
|
|
14
|
-
export
|
|
12
|
+
import { type UseProgressiveRenderingSignature } from "./featurePlugins/useProgressiveRendering/index.js";
|
|
13
|
+
export type AllPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseProgressiveRenderingSignature];
|
|
14
|
+
export type DefaultPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseProgressiveRenderingSignature];
|
|
15
|
+
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartBrushSignature>, import("./models/index.js").ChartPlugin<UseChartTooltipSignature<any>>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature<any>>, import("./models/index.js").ChartPlugin<UseChartVisibilityManagerSignature<any>>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>, import("./models/index.js").ChartPlugin<UseProgressiveRenderingSignature>];
|
|
@@ -13,6 +13,7 @@ var _useChartZAxis = require("./featurePlugins/useChartZAxis");
|
|
|
13
13
|
var _useChartBrush = require("./featurePlugins/useChartBrush");
|
|
14
14
|
var _useChartVisibilityManager = require("./featurePlugins/useChartVisibilityManager");
|
|
15
15
|
var _useChartTooltip = require("./featurePlugins/useChartTooltip");
|
|
16
|
+
var _useProgressiveRendering = require("./featurePlugins/useProgressiveRendering");
|
|
16
17
|
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
17
18
|
|
|
18
|
-
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartVisibilityManager.useChartVisibilityManager, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
|
19
|
+
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartVisibilityManager.useChartVisibilityManager, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation, _useProgressiveRendering.useProgressiveRendering];
|
|
@@ -9,4 +9,5 @@ import { useChartZAxis } from "./featurePlugins/useChartZAxis/index.mjs";
|
|
|
9
9
|
import { useChartBrush } from "./featurePlugins/useChartBrush/index.mjs";
|
|
10
10
|
import { useChartVisibilityManager } from "./featurePlugins/useChartVisibilityManager/index.mjs";
|
|
11
11
|
import { useChartTooltip } from "./featurePlugins/useChartTooltip/index.mjs";
|
|
12
|
-
|
|
12
|
+
import { useProgressiveRendering } from "./featurePlugins/useProgressiveRendering/index.mjs";
|
|
13
|
+
export const DEFAULT_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartClosestPoint, useChartKeyboardNavigation, useProgressiveRendering];
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { ChartSeriesType } from "../../../../models/seriesType/config.mjs";
|
|
2
|
-
import { type
|
|
3
|
-
import type { UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature.types.mjs";
|
|
4
|
-
|
|
2
|
+
import { type ChartState } from "../../models/chart.mjs";
|
|
3
|
+
import type { ChartExperimentalFeatures, UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature.types.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Reads the value of a single experimental feature flag from the store.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const enabled = store.use(
|
|
9
|
+
* selectorChartExperimentalFeaturesState,
|
|
10
|
+
* 'progressiveRendering',
|
|
11
|
+
* );
|
|
12
|
+
*/
|
|
13
|
+
export declare const selectorChartExperimentalFeaturesState: <K extends keyof ChartExperimentalFeatures>(state: ChartState<[UseChartExperimentalFeaturesSignature<ChartSeriesType>]>, featureName: K) => ChartExperimentalFeatures[K] | undefined;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
2
|
-
import { type
|
|
3
|
-
import type { UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature.types.js";
|
|
4
|
-
|
|
2
|
+
import { type ChartState } from "../../models/chart.js";
|
|
3
|
+
import type { ChartExperimentalFeatures, UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature.types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Reads the value of a single experimental feature flag from the store.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const enabled = store.use(
|
|
9
|
+
* selectorChartExperimentalFeaturesState,
|
|
10
|
+
* 'progressiveRendering',
|
|
11
|
+
* );
|
|
12
|
+
*/
|
|
13
|
+
export declare const selectorChartExperimentalFeaturesState: <K extends keyof ChartExperimentalFeatures>(state: ChartState<[UseChartExperimentalFeaturesSignature<ChartSeriesType>]>, featureName: K) => ChartExperimentalFeatures[K] | undefined;
|
|
@@ -4,5 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectorChartExperimentalFeaturesState = void 0;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Reads the value of a single experimental feature flag from the store.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const enabled = store.use(
|
|
12
|
+
* selectorChartExperimentalFeaturesState,
|
|
13
|
+
* 'progressiveRendering',
|
|
14
|
+
* );
|
|
15
|
+
*/
|
|
16
|
+
const selectorChartExperimentalFeaturesState = (state, featureName) => state.experimentalFeatures?.[featureName];
|
|
8
17
|
exports.selectorChartExperimentalFeaturesState = selectorChartExperimentalFeaturesState;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Reads the value of a single experimental feature flag from the store.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* const enabled = store.use(
|
|
6
|
+
* selectorChartExperimentalFeaturesState,
|
|
7
|
+
* 'progressiveRendering',
|
|
8
|
+
* );
|
|
9
|
+
*/
|
|
10
|
+
export const selectorChartExperimentalFeaturesState = (state, featureName) => state.experimentalFeatures?.[featureName];
|
|
@@ -13,7 +13,21 @@ interface LineExperimentalFeatures {
|
|
|
13
13
|
*/
|
|
14
14
|
enablePositionBasedPointerInteraction?: boolean;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
interface ScatterExperimentalFeatures {
|
|
17
|
+
/**
|
|
18
|
+
* Enables automatic progressive (batched) rendering for scatter series.
|
|
19
|
+
*
|
|
20
|
+
* When enabled and the `renderer` prop is left unset, the chart switches to
|
|
21
|
+
* the `svg-progressive` renderer above an internal point-count threshold,
|
|
22
|
+
* painting points over several animation frames to keep the main thread
|
|
23
|
+
* responsive. When disabled, the unset `renderer` keeps the synchronous
|
|
24
|
+
* `svg-single` renderer. Setting `renderer` explicitly is unaffected.
|
|
25
|
+
*
|
|
26
|
+
* This behavior will become the default in the next major version.
|
|
27
|
+
*/
|
|
28
|
+
progressiveRendering?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
|
|
17
31
|
export interface UseChartExperimentalFeaturesParameters<SeriesType extends ChartSeriesType = ChartSeriesType> {
|
|
18
32
|
/**
|
|
19
33
|
* Options to enable features planned for the next major.
|