@mui/x-charts-pro 9.7.0 → 9.9.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/BarChartPro/BarChartPro.d.mts +9 -1
- package/BarChartPro/BarChartPro.d.ts +9 -1
- package/BarChartPro/BarChartPro.js +14 -3
- package/BarChartPro/BarChartPro.mjs +14 -3
- package/BarChartPro/BarChartPro.plugins.d.mts +2 -1
- package/BarChartPro/BarChartPro.plugins.d.ts +2 -1
- package/BarChartPro/BarChartPro.plugins.js +2 -1
- package/BarChartPro/BarChartPro.plugins.mjs +2 -1
- package/CHANGELOG.md +249 -1
- package/ChartsContainerPro/useChartsContainerProProps.d.mts +6 -2
- package/ChartsContainerPro/useChartsContainerProProps.d.ts +6 -2
- package/ChartsContainerPro/useChartsContainerProProps.js +9 -1
- package/ChartsContainerPro/useChartsContainerProProps.mjs +8 -1
- package/ChartsDataProviderPro/ChartsDataProviderPro.d.mts +1 -1
- package/ChartsDataProviderPro/ChartsDataProviderPro.d.ts +1 -1
- package/ChartsDataProviderPro/ChartsDataProviderPro.js +14 -3
- package/ChartsDataProviderPro/ChartsDataProviderPro.mjs +14 -3
- package/ChartsToolbarPro/ChartsToolbarPro.d.mts +2 -1
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +2 -1
- package/ChartsToolbarPro/internals/ChartsMenu.d.mts +1 -1
- package/ChartsToolbarPro/internals/ChartsMenu.d.ts +1 -1
- package/ChartsZoomSlider/ChartsZoomSlider.d.mts +2 -1
- package/ChartsZoomSlider/ChartsZoomSlider.d.ts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSlider.d.mts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSlider.d.ts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderActiveTrack.d.mts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderActiveTrack.d.ts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderPreview.d.mts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderPreview.d.ts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderPreviewContent.d.mts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderPreviewContent.d.ts +2 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderTrack.d.mts +1 -1
- package/ChartsZoomSlider/internals/ChartsAxisZoomSliderTrack.d.ts +1 -1
- package/ChartsZoomSlider/internals/ChartsTooltipZoomSliderValue.d.mts +1 -1
- package/ChartsZoomSlider/internals/ChartsTooltipZoomSliderValue.d.ts +1 -1
- package/ChartsZoomSlider/internals/previews/AreaPreviewPlot.d.mts +1 -1
- package/ChartsZoomSlider/internals/previews/AreaPreviewPlot.d.ts +1 -1
- package/ChartsZoomSlider/internals/previews/BarPreviewPlot.d.mts +1 -1
- package/ChartsZoomSlider/internals/previews/BarPreviewPlot.d.ts +1 -1
- package/ChartsZoomSlider/internals/previews/LineAreaPreviewPlot.d.mts +2 -1
- package/ChartsZoomSlider/internals/previews/LineAreaPreviewPlot.d.ts +2 -1
- package/ChartsZoomSlider/internals/previews/LinePreviewPlot.d.mts +1 -1
- package/ChartsZoomSlider/internals/previews/LinePreviewPlot.d.ts +1 -1
- package/ChartsZoomSlider/internals/previews/LinePreviewPlot.js +16 -1
- package/ChartsZoomSlider/internals/previews/LinePreviewPlot.mjs +17 -2
- package/ChartsZoomSlider/internals/previews/ScatterPreviewPlot.d.mts +2 -1
- package/ChartsZoomSlider/internals/previews/ScatterPreviewPlot.d.ts +2 -1
- package/FunnelChart/FocusedFunnelSection.d.mts +1 -1
- package/FunnelChart/FocusedFunnelSection.d.ts +1 -1
- package/FunnelChart/FunnelPlot.d.mts +1 -1
- package/FunnelChart/FunnelPlot.d.ts +1 -1
- package/FunnelChart/seriesConfig/index.js +2 -2
- package/FunnelChart/seriesConfig/index.mjs +2 -2
- package/FunnelChart/seriesConfig/tooltipPosition.d.mts +2 -3
- package/FunnelChart/seriesConfig/tooltipPosition.d.ts +2 -3
- package/FunnelChart/seriesConfig/tooltipPosition.js +11 -15
- package/FunnelChart/seriesConfig/tooltipPosition.mjs +11 -15
- package/Heatmap/FocusedHeatmapCell.d.mts +1 -1
- package/Heatmap/FocusedHeatmapCell.d.ts +1 -1
- package/Heatmap/HeatmapItem.d.mts +1 -1
- package/Heatmap/HeatmapItem.d.ts +1 -1
- package/Heatmap/HeatmapSVGPlot.d.mts +2 -1
- package/Heatmap/HeatmapSVGPlot.d.ts +2 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.mts +1 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +1 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.mts +1 -1
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.d.ts +1 -1
- package/Heatmap/seriesConfig/index.js +2 -2
- package/Heatmap/seriesConfig/index.mjs +2 -2
- package/Heatmap/seriesConfig/tooltipPosition.d.mts +2 -3
- package/Heatmap/seriesConfig/tooltipPosition.d.ts +2 -3
- package/Heatmap/seriesConfig/tooltipPosition.js +12 -16
- package/Heatmap/seriesConfig/tooltipPosition.mjs +12 -16
- package/LineChartPro/LineChartPro.d.mts +11 -1
- package/LineChartPro/LineChartPro.d.ts +11 -1
- package/LineChartPro/LineChartPro.js +16 -3
- package/LineChartPro/LineChartPro.mjs +16 -3
- package/LineChartPro/LineChartPro.plugins.d.mts +2 -1
- package/LineChartPro/LineChartPro.plugins.d.ts +2 -1
- package/LineChartPro/LineChartPro.plugins.js +2 -1
- package/LineChartPro/LineChartPro.plugins.mjs +2 -1
- package/SankeyChart/FocusedSankeyLink.d.mts +1 -1
- package/SankeyChart/FocusedSankeyLink.d.ts +1 -1
- package/SankeyChart/FocusedSankeyNode.d.mts +1 -1
- package/SankeyChart/FocusedSankeyNode.d.ts +1 -1
- package/SankeyChart/SankeyDataProvider.d.mts +1 -1
- package/SankeyChart/SankeyDataProvider.d.ts +1 -1
- package/SankeyChart/SankeyLinkLabelPlot.d.mts +1 -1
- package/SankeyChart/SankeyLinkLabelPlot.d.ts +1 -1
- package/SankeyChart/SankeyLinkPlot.d.mts +1 -1
- package/SankeyChart/SankeyLinkPlot.d.ts +1 -1
- package/SankeyChart/SankeyNodeLabelPlot.d.mts +1 -1
- package/SankeyChart/SankeyNodeLabelPlot.d.ts +1 -1
- package/SankeyChart/SankeyNodePlot.d.mts +1 -1
- package/SankeyChart/SankeyNodePlot.d.ts +1 -1
- package/SankeyChart/SankeyPlot.d.mts +1 -1
- package/SankeyChart/SankeyPlot.d.ts +1 -1
- package/SankeyChart/SankeyTooltip/SankeyTooltip.d.mts +1 -1
- package/SankeyChart/SankeyTooltip/SankeyTooltip.d.ts +1 -1
- package/SankeyChart/SankeyTooltip/SankeyTooltipContent.d.mts +1 -1
- package/SankeyChart/SankeyTooltip/SankeyTooltipContent.d.ts +1 -1
- package/SankeyChart/seriesConfig/index.js +2 -2
- package/SankeyChart/seriesConfig/index.mjs +2 -2
- package/SankeyChart/seriesConfig/tooltipPosition.d.mts +2 -3
- package/SankeyChart/seriesConfig/tooltipPosition.d.ts +2 -3
- package/SankeyChart/seriesConfig/tooltipPosition.js +6 -11
- package/SankeyChart/seriesConfig/tooltipPosition.mjs +5 -10
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/ChartsWatermark.d.mts +2 -1
- package/internals/ChartsWatermark.d.ts +2 -1
- package/internals/index.d.mts +2 -0
- package/internals/index.d.ts +2 -0
- package/internals/index.js +30 -0
- package/internals/index.mjs +2 -0
- package/internals/material/components/BaseMenuItem.d.mts +1 -1
- package/internals/material/components/BaseMenuItem.d.ts +1 -1
- package/internals/material/components/BasePopper.d.mts +2 -1
- package/internals/material/components/BasePopper.d.ts +2 -1
- package/internals/plugins/useChartProSampling/barSampler.d.mts +8 -0
- package/internals/plugins/useChartProSampling/barSampler.d.ts +8 -0
- package/internals/plugins/useChartProSampling/barSampler.js +18 -0
- package/internals/plugins/useChartProSampling/barSampler.mjs +12 -0
- package/internals/plugins/useChartProSampling/index.d.mts +2 -0
- package/internals/plugins/useChartProSampling/index.d.ts +2 -0
- package/internals/plugins/useChartProSampling/index.js +12 -0
- package/internals/plugins/useChartProSampling/index.mjs +1 -0
- package/internals/plugins/useChartProSampling/lineSampler.d.mts +8 -0
- package/internals/plugins/useChartProSampling/lineSampler.d.ts +8 -0
- package/internals/plugins/useChartProSampling/lineSampler.js +47 -0
- package/internals/plugins/useChartProSampling/lineSampler.mjs +41 -0
- package/internals/plugins/useChartProSampling/sampling.d.mts +38 -0
- package/internals/plugins/useChartProSampling/sampling.d.ts +38 -0
- package/internals/plugins/useChartProSampling/sampling.js +175 -0
- package/internals/plugins/useChartProSampling/sampling.line.d.mts +22 -0
- package/internals/plugins/useChartProSampling/sampling.line.d.ts +22 -0
- package/internals/plugins/useChartProSampling/sampling.line.js +172 -0
- package/internals/plugins/useChartProSampling/sampling.line.mjs +164 -0
- package/internals/plugins/useChartProSampling/sampling.mjs +164 -0
- package/internals/plugins/useChartProSampling/sampling.pyramid.types.d.mts +33 -0
- package/internals/plugins/useChartProSampling/sampling.pyramid.types.d.ts +33 -0
- package/internals/plugins/useChartProSampling/sampling.pyramid.types.js +5 -0
- package/internals/plugins/useChartProSampling/sampling.pyramid.types.mjs +1 -0
- package/internals/plugins/useChartProSampling/useChartProSampling.d.mts +4 -0
- package/internals/plugins/useChartProSampling/useChartProSampling.d.ts +4 -0
- package/internals/plugins/useChartProSampling/useChartProSampling.js +59 -0
- package/internals/plugins/useChartProSampling/useChartProSampling.mjs +52 -0
- package/internals/plugins/useChartProSampling/useChartProSampling.types.d.mts +25 -0
- package/internals/plugins/useChartProSampling/useChartProSampling.types.d.ts +25 -0
- package/internals/plugins/useChartProSampling/useChartProSampling.types.js +5 -0
- package/internals/plugins/useChartProSampling/useChartProSampling.types.mjs +1 -0
- package/internals/plugins/useChartProZoom/gestureHooks/useRegisterZoomGestures.d.mts +4 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useRegisterZoomGestures.d.ts +4 -3
- package/internals/plugins/useChartProZoom/gestureHooks/useRegisterZoomGestures.mjs +1 -0
- package/package.json +6 -6
- package/typeOverloads/modules.d.mts +9 -1
- package/typeOverloads/modules.d.ts +9 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { CommercialPackageInfo } from '@mui/x-license/internals';
|
|
2
3
|
interface ChartsWatermarkProps {
|
|
3
4
|
packageInfo: CommercialPackageInfo;
|
|
4
5
|
}
|
|
5
|
-
export declare function ChartsWatermark(props: ChartsWatermarkProps):
|
|
6
|
+
export declare function ChartsWatermark(props: ChartsWatermarkProps): React.JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { CommercialPackageInfo } from '@mui/x-license/internals';
|
|
2
3
|
interface ChartsWatermarkProps {
|
|
3
4
|
packageInfo: CommercialPackageInfo;
|
|
4
5
|
}
|
|
5
|
-
export declare function ChartsWatermark(props: ChartsWatermarkProps):
|
|
6
|
+
export declare function ChartsWatermark(props: ChartsWatermarkProps): React.JSX.Element;
|
|
6
7
|
export {};
|
package/internals/index.d.mts
CHANGED
|
@@ -3,6 +3,8 @@ export type { UseChartsContainerProPropsReturnValue } from "../ChartsContainerPr
|
|
|
3
3
|
export type { ChartsSlotsPro, ChartsSlotPropsPro } from "./material/index.mjs";
|
|
4
4
|
export { seriesPreviewPlotMap } from "../ChartsZoomSlider/internals/seriesPreviewPlotMap.mjs";
|
|
5
5
|
export type { PreviewPlotProps } from "../ChartsZoomSlider/internals/previews/PreviewPlot.types.mjs";
|
|
6
|
+
export { useDragGesture, useWheelGesture, usePinchGesture, type UseDragGestureOptions, type UseWheelGestureOptions, type UsePinchGestureOptions, type GestureInstance, type PanGestureConfig } from "./plugins/zoomGestures/index.mjs";
|
|
7
|
+
export { useRegisterZoomGestures } from "./plugins/useChartProZoom/gestureHooks/useRegisterZoomGestures.mjs";
|
|
6
8
|
export { defaultSeriesConfigPro } from "../ChartsDataProviderPro/ChartsDataProviderPro.mjs";
|
|
7
9
|
export type { ProPluginsPerSeriesType } from "../context/ChartProApi.mjs";
|
|
8
10
|
export { useHeatmapProps } from "../Heatmap/useHeatmapProps.mjs";
|
package/internals/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export type { UseChartsContainerProPropsReturnValue } from "../ChartsContainerPr
|
|
|
3
3
|
export type { ChartsSlotsPro, ChartsSlotPropsPro } from "./material/index.js";
|
|
4
4
|
export { seriesPreviewPlotMap } from "../ChartsZoomSlider/internals/seriesPreviewPlotMap.js";
|
|
5
5
|
export type { PreviewPlotProps } from "../ChartsZoomSlider/internals/previews/PreviewPlot.types.js";
|
|
6
|
+
export { useDragGesture, useWheelGesture, usePinchGesture, type UseDragGestureOptions, type UseWheelGestureOptions, type UsePinchGestureOptions, type GestureInstance, type PanGestureConfig } from "./plugins/zoomGestures/index.js";
|
|
7
|
+
export { useRegisterZoomGestures } from "./plugins/useChartProZoom/gestureHooks/useRegisterZoomGestures.js";
|
|
6
8
|
export { defaultSeriesConfigPro } from "../ChartsDataProviderPro/ChartsDataProviderPro.js";
|
|
7
9
|
export type { ProPluginsPerSeriesType } from "../context/ChartProApi.js";
|
|
8
10
|
export { useHeatmapProps } from "../Heatmap/useHeatmapProps.js";
|
package/internals/index.js
CHANGED
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
useChartsContainerProProps: true,
|
|
8
8
|
seriesPreviewPlotMap: true,
|
|
9
|
+
useDragGesture: true,
|
|
10
|
+
useWheelGesture: true,
|
|
11
|
+
usePinchGesture: true,
|
|
12
|
+
useRegisterZoomGestures: true,
|
|
9
13
|
defaultSeriesConfigPro: true,
|
|
10
14
|
useHeatmapProps: true,
|
|
11
15
|
defaultSlotsMaterial: true,
|
|
@@ -41,14 +45,40 @@ Object.defineProperty(exports, "useChartsContainerProProps", {
|
|
|
41
45
|
return _useChartsContainerProProps.useChartsContainerProProps;
|
|
42
46
|
}
|
|
43
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "useDragGesture", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _zoomGestures.useDragGesture;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
44
54
|
Object.defineProperty(exports, "useHeatmapProps", {
|
|
45
55
|
enumerable: true,
|
|
46
56
|
get: function () {
|
|
47
57
|
return _useHeatmapProps.useHeatmapProps;
|
|
48
58
|
}
|
|
49
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "usePinchGesture", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _zoomGestures.usePinchGesture;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "useRegisterZoomGestures", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _useRegisterZoomGestures.useRegisterZoomGestures;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "useWheelGesture", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _zoomGestures.useWheelGesture;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
50
78
|
var _useChartsContainerProProps = require("../ChartsContainerPro/useChartsContainerProProps");
|
|
51
79
|
var _seriesPreviewPlotMap = require("../ChartsZoomSlider/internals/seriesPreviewPlotMap");
|
|
80
|
+
var _zoomGestures = require("./plugins/zoomGestures");
|
|
81
|
+
var _useRegisterZoomGestures = require("./plugins/useChartProZoom/gestureHooks/useRegisterZoomGestures");
|
|
52
82
|
var _ChartsDataProviderPro = require("../ChartsDataProviderPro/ChartsDataProviderPro");
|
|
53
83
|
var _useHeatmapProps = require("../Heatmap/useHeatmapProps");
|
|
54
84
|
var _material = require("./material");
|
package/internals/index.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { useChartsContainerProProps } from "../ChartsContainerPro/useChartsContainerProProps.mjs";
|
|
2
2
|
export { seriesPreviewPlotMap } from "../ChartsZoomSlider/internals/seriesPreviewPlotMap.mjs";
|
|
3
|
+
export { useDragGesture, useWheelGesture, usePinchGesture } from "./plugins/zoomGestures/index.mjs";
|
|
4
|
+
export { useRegisterZoomGestures } from "./plugins/useChartProZoom/gestureHooks/useRegisterZoomGestures.mjs";
|
|
3
5
|
export { defaultSeriesConfigPro } from "../ChartsDataProviderPro/ChartsDataProviderPro.mjs";
|
|
4
6
|
export { useHeatmapProps } from "../Heatmap/useHeatmapProps.mjs";
|
|
5
7
|
export { defaultSlotsMaterial } from "./material/index.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ChartBaseMenuItemProps } from "../../slots/chartBaseSlotProps.mjs";
|
|
2
|
-
export declare function BaseMenuItem(props: ChartBaseMenuItemProps): import("react
|
|
2
|
+
export declare function BaseMenuItem(props: ChartBaseMenuItemProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ChartBaseMenuItemProps } from "../../slots/chartBaseSlotProps.js";
|
|
2
|
-
export declare function BaseMenuItem(props: ChartBaseMenuItemProps): import("react
|
|
2
|
+
export declare function BaseMenuItem(props: ChartBaseMenuItemProps): import("react").JSX.Element;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { ChartBasePopperProps } from "../../slots/chartBaseSlotProps.mjs";
|
|
2
|
-
export declare function BasePopper(props: ChartBasePopperProps):
|
|
3
|
+
export declare function BasePopper(props: ChartBasePopperProps): React.JSX.Element;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { ChartBasePopperProps } from "../../slots/chartBaseSlotProps.js";
|
|
2
|
-
export declare function BasePopper(props: ChartBasePopperProps):
|
|
3
|
+
export declare function BasePopper(props: ChartBasePopperProps): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SamplingStrategy } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SamplingPyramid } from "./sampling.pyramid.types.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Min/max LOD pyramid over the bar's stacked envelope. Uses `min(base, top)`/`max(base, top)` per
|
|
5
|
+
* point rather than base/top directly, so diverging/negative bars (where the stack emits `[0, -5]`,
|
|
6
|
+
* i.e. base > top) keep their full extent instead of being truncated.
|
|
7
|
+
*/
|
|
8
|
+
export declare const barSampler: SamplingStrategy<'bar', SamplingPyramid>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SamplingStrategy } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SamplingPyramid } from "./sampling.pyramid.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Min/max LOD pyramid over the bar's stacked envelope. Uses `min(base, top)`/`max(base, top)` per
|
|
5
|
+
* point rather than base/top directly, so diverging/negative bars (where the stack emits `[0, -5]`,
|
|
6
|
+
* i.e. base > top) keep their full extent instead of being truncated.
|
|
7
|
+
*/
|
|
8
|
+
export declare const barSampler: SamplingStrategy<'bar', SamplingPyramid>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.barSampler = void 0;
|
|
7
|
+
var _sampling = require("./sampling");
|
|
8
|
+
var _sampling2 = require("./sampling.line");
|
|
9
|
+
/**
|
|
10
|
+
* Min/max LOD pyramid over the bar's stacked envelope. Uses `min(base, top)`/`max(base, top)` per
|
|
11
|
+
* point rather than base/top directly, so diverging/negative bars (where the stack emits `[0, -5]`,
|
|
12
|
+
* i.e. base > top) keep their full extent instead of being truncated.
|
|
13
|
+
*/
|
|
14
|
+
const barSampler = exports.barSampler = {
|
|
15
|
+
build: series => (0, _sampling.buildSamplingPyramid)(Float64Array.from(series.visibleStackedData, point => Math.min(point[0], point[1])), Float64Array.from(series.visibleStackedData, point => Math.max(point[0], point[1]))),
|
|
16
|
+
sample: _sampling2.sample,
|
|
17
|
+
bucketSizeAt: (span, context) => (0, _sampling.getSamplingBucketSize)(span, context.dataLength, context.availableSize, context.minSpan)
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { buildSamplingPyramid, getSamplingBucketSize } from "./sampling.mjs";
|
|
2
|
+
import { sample } from "./sampling.line.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Min/max LOD pyramid over the bar's stacked envelope. Uses `min(base, top)`/`max(base, top)` per
|
|
5
|
+
* point rather than base/top directly, so diverging/negative bars (where the stack emits `[0, -5]`,
|
|
6
|
+
* i.e. base > top) keep their full extent instead of being truncated.
|
|
7
|
+
*/
|
|
8
|
+
export const barSampler = {
|
|
9
|
+
build: series => buildSamplingPyramid(Float64Array.from(series.visibleStackedData, point => Math.min(point[0], point[1])), Float64Array.from(series.visibleStackedData, point => Math.max(point[0], point[1]))),
|
|
10
|
+
sample,
|
|
11
|
+
bucketSizeAt: (span, context) => getSamplingBucketSize(span, context.dataLength, context.availableSize, context.minSpan)
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useChartProSampling", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _useChartProSampling.useChartProSampling;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _useChartProSampling = require("./useChartProSampling");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useChartProSampling } from "./useChartProSampling.mjs";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SamplingStrategy } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SamplingPyramid } from "./sampling.pyramid.types.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Min/max LOD pyramid over the line's y values (single channel when null-free). Nulls get `+Inf`
|
|
5
|
+
* low / `-Inf` high so they never win an extremum, and go into `nullIndices` for the sampler to
|
|
6
|
+
* re-insert as line breaks.
|
|
7
|
+
*/
|
|
8
|
+
export declare const lineSampler: SamplingStrategy<'line', SamplingPyramid>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SamplingStrategy } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SamplingPyramid } from "./sampling.pyramid.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Min/max LOD pyramid over the line's y values (single channel when null-free). Nulls get `+Inf`
|
|
5
|
+
* low / `-Inf` high so they never win an extremum, and go into `nullIndices` for the sampler to
|
|
6
|
+
* re-insert as line breaks.
|
|
7
|
+
*/
|
|
8
|
+
export declare const lineSampler: SamplingStrategy<'line', SamplingPyramid>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.lineSampler = void 0;
|
|
7
|
+
var _sampling = require("./sampling");
|
|
8
|
+
var _sampling2 = require("./sampling.line");
|
|
9
|
+
/**
|
|
10
|
+
* Min/max LOD pyramid over the line's y values (single channel when null-free). Nulls get `+Inf`
|
|
11
|
+
* low / `-Inf` high so they never win an extremum, and go into `nullIndices` for the sampler to
|
|
12
|
+
* re-insert as line breaks.
|
|
13
|
+
*/
|
|
14
|
+
const lineSampler = exports.lineSampler = {
|
|
15
|
+
build: series => {
|
|
16
|
+
const {
|
|
17
|
+
data,
|
|
18
|
+
visibleStackedData
|
|
19
|
+
} = series;
|
|
20
|
+
const length = visibleStackedData.length;
|
|
21
|
+
const values = new Float64Array(length);
|
|
22
|
+
let nullIndices = null;
|
|
23
|
+
for (let i = 0; i < length; i += 1) {
|
|
24
|
+
if (data[i] == null) {
|
|
25
|
+
(nullIndices ?? (nullIndices = [])).push(i);
|
|
26
|
+
} else {
|
|
27
|
+
values[i] = visibleStackedData[i][1];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!nullIndices) {
|
|
31
|
+
return (0, _sampling.buildSamplingPyramid)(values, values);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Two channels only when gaps exist: nulls lose both extrema comparisons.
|
|
35
|
+
const low = values;
|
|
36
|
+
const high = Float64Array.from(values);
|
|
37
|
+
for (let i = 0; i < nullIndices.length; i += 1) {
|
|
38
|
+
low[nullIndices[i]] = Infinity;
|
|
39
|
+
high[nullIndices[i]] = -Infinity;
|
|
40
|
+
}
|
|
41
|
+
const pyramid = (0, _sampling.buildSamplingPyramid)(low, high);
|
|
42
|
+
pyramid.nullIndices = Int32Array.from(nullIndices);
|
|
43
|
+
return pyramid;
|
|
44
|
+
},
|
|
45
|
+
sample: _sampling2.sample,
|
|
46
|
+
bucketSizeAt: (span, context) => (0, _sampling.getSamplingBucketSize)(span, context.dataLength, context.availableSize, context.minSpan)
|
|
47
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { buildSamplingPyramid, getSamplingBucketSize } from "./sampling.mjs";
|
|
2
|
+
import { sample } from "./sampling.line.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Min/max LOD pyramid over the line's y values (single channel when null-free). Nulls get `+Inf`
|
|
5
|
+
* low / `-Inf` high so they never win an extremum, and go into `nullIndices` for the sampler to
|
|
6
|
+
* re-insert as line breaks.
|
|
7
|
+
*/
|
|
8
|
+
export const lineSampler = {
|
|
9
|
+
build: series => {
|
|
10
|
+
const {
|
|
11
|
+
data,
|
|
12
|
+
visibleStackedData
|
|
13
|
+
} = series;
|
|
14
|
+
const length = visibleStackedData.length;
|
|
15
|
+
const values = new Float64Array(length);
|
|
16
|
+
let nullIndices = null;
|
|
17
|
+
for (let i = 0; i < length; i += 1) {
|
|
18
|
+
if (data[i] == null) {
|
|
19
|
+
(nullIndices ??= []).push(i);
|
|
20
|
+
} else {
|
|
21
|
+
values[i] = visibleStackedData[i][1];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (!nullIndices) {
|
|
25
|
+
return buildSamplingPyramid(values, values);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Two channels only when gaps exist: nulls lose both extrema comparisons.
|
|
29
|
+
const low = values;
|
|
30
|
+
const high = Float64Array.from(values);
|
|
31
|
+
for (let i = 0; i < nullIndices.length; i += 1) {
|
|
32
|
+
low[nullIndices[i]] = Infinity;
|
|
33
|
+
high[nullIndices[i]] = -Infinity;
|
|
34
|
+
}
|
|
35
|
+
const pyramid = buildSamplingPyramid(low, high);
|
|
36
|
+
pyramid.nullIndices = Int32Array.from(nullIndices);
|
|
37
|
+
return pyramid;
|
|
38
|
+
},
|
|
39
|
+
sample,
|
|
40
|
+
bucketSizeAt: (span, context) => getSamplingBucketSize(span, context.dataLength, context.availableSize, context.minSpan)
|
|
41
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ActiveSamplingLevel, SamplingPyramid } from "./sampling.pyramid.types.mjs";
|
|
2
|
+
/** Smallest element size (px) allowed before sampling kicks in. */
|
|
3
|
+
export declare const MIN_ELEMENT_SIZE_PX = 6;
|
|
4
|
+
/**
|
|
5
|
+
* Min zoom span (%) at which the data fills the view with `MIN_ELEMENT_SIZE_PX`-wide elements.
|
|
6
|
+
* Screen-derived, so elements never get thinner and the level count adapts to screen + data.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSamplingMinSpan(dataLength: number, availableSizePx: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Hard ceiling on rendered elements, independent of zoom. Even at the deepest zoom (where elements
|
|
11
|
+
* would be wide enough to skip screen sampling), a view with more than this many points is still
|
|
12
|
+
* sampled enough levels to get under the cap — too many elements hurts performance whatever the size.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MAX_RENDERED_POINTS = 2000;
|
|
15
|
+
/**
|
|
16
|
+
* Builds the LOD pyramid for one series from its low/high value channels (for bars: the stacked
|
|
17
|
+
* `[base, top]` channels; for lines: the displayed `y` for both). Each bucket keeps the original
|
|
18
|
+
* index of its min (over `low`) and max (over `high`) — a min/max envelope, so spikes and troughs
|
|
19
|
+
* survive. Consumers read the values back from their own series data by index.
|
|
20
|
+
*
|
|
21
|
+
* Stored flat: all levels concatenated into `argMin`/`argMax`, with `offsets` marking level
|
|
22
|
+
* boundaries. Level 0 (no merge) is implicit; bucket indices are derived (`j * bucketSize`).
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildSamplingPyramid(low: ArrayLike<number>, high: ArrayLike<number>): SamplingPyramid;
|
|
25
|
+
/** Number of stored levels (finest `bucketSize 2` to coarsest). */
|
|
26
|
+
export declare function getSamplingLevelCount(pyramid: SamplingPyramid): number;
|
|
27
|
+
/**
|
|
28
|
+
* Picks the active level from the zoom span: level 0 (deepest zoom, `span <= minSpan`, or elements
|
|
29
|
+
* still wide enough) → no sampling (`null`, raw 1:1); each level up → bucket size ×2, chosen so
|
|
30
|
+
* sampled elements stay at least `MIN_ELEMENT_SIZE_PX` wide. Clamped to the pyramid depth.
|
|
31
|
+
* `bucketSize === 2 ** clampedLevel`, level buckets `offsets[clampedLevel - 1 .. clampedLevel]`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function selectSamplingLevel(pyramid: SamplingPyramid, currentSpan: number, availableSizePx: number, minSpan: number): ActiveSamplingLevel | null;
|
|
34
|
+
/**
|
|
35
|
+
* Active bucket size (`1` = no sampling) for an axis with no built pyramid (the axis highlight).
|
|
36
|
+
* Matches `selectSamplingLevel`'s `bucketSize`, derived from `dataLength` + screen + `minSpan`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getSamplingBucketSize(currentSpan: number, dataLength: number, availableSizePx: number, minSpan: number): number;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ActiveSamplingLevel, SamplingPyramid } from "./sampling.pyramid.types.js";
|
|
2
|
+
/** Smallest element size (px) allowed before sampling kicks in. */
|
|
3
|
+
export declare const MIN_ELEMENT_SIZE_PX = 6;
|
|
4
|
+
/**
|
|
5
|
+
* Min zoom span (%) at which the data fills the view with `MIN_ELEMENT_SIZE_PX`-wide elements.
|
|
6
|
+
* Screen-derived, so elements never get thinner and the level count adapts to screen + data.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSamplingMinSpan(dataLength: number, availableSizePx: number): number;
|
|
9
|
+
/**
|
|
10
|
+
* Hard ceiling on rendered elements, independent of zoom. Even at the deepest zoom (where elements
|
|
11
|
+
* would be wide enough to skip screen sampling), a view with more than this many points is still
|
|
12
|
+
* sampled enough levels to get under the cap — too many elements hurts performance whatever the size.
|
|
13
|
+
*/
|
|
14
|
+
export declare const MAX_RENDERED_POINTS = 2000;
|
|
15
|
+
/**
|
|
16
|
+
* Builds the LOD pyramid for one series from its low/high value channels (for bars: the stacked
|
|
17
|
+
* `[base, top]` channels; for lines: the displayed `y` for both). Each bucket keeps the original
|
|
18
|
+
* index of its min (over `low`) and max (over `high`) — a min/max envelope, so spikes and troughs
|
|
19
|
+
* survive. Consumers read the values back from their own series data by index.
|
|
20
|
+
*
|
|
21
|
+
* Stored flat: all levels concatenated into `argMin`/`argMax`, with `offsets` marking level
|
|
22
|
+
* boundaries. Level 0 (no merge) is implicit; bucket indices are derived (`j * bucketSize`).
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildSamplingPyramid(low: ArrayLike<number>, high: ArrayLike<number>): SamplingPyramid;
|
|
25
|
+
/** Number of stored levels (finest `bucketSize 2` to coarsest). */
|
|
26
|
+
export declare function getSamplingLevelCount(pyramid: SamplingPyramid): number;
|
|
27
|
+
/**
|
|
28
|
+
* Picks the active level from the zoom span: level 0 (deepest zoom, `span <= minSpan`, or elements
|
|
29
|
+
* still wide enough) → no sampling (`null`, raw 1:1); each level up → bucket size ×2, chosen so
|
|
30
|
+
* sampled elements stay at least `MIN_ELEMENT_SIZE_PX` wide. Clamped to the pyramid depth.
|
|
31
|
+
* `bucketSize === 2 ** clampedLevel`, level buckets `offsets[clampedLevel - 1 .. clampedLevel]`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function selectSamplingLevel(pyramid: SamplingPyramid, currentSpan: number, availableSizePx: number, minSpan: number): ActiveSamplingLevel | null;
|
|
34
|
+
/**
|
|
35
|
+
* Active bucket size (`1` = no sampling) for an axis with no built pyramid (the axis highlight).
|
|
36
|
+
* Matches `selectSamplingLevel`'s `bucketSize`, derived from `dataLength` + screen + `minSpan`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getSamplingBucketSize(currentSpan: number, dataLength: number, availableSizePx: number, minSpan: number): number;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MIN_ELEMENT_SIZE_PX = exports.MAX_RENDERED_POINTS = void 0;
|
|
7
|
+
exports.buildSamplingPyramid = buildSamplingPyramid;
|
|
8
|
+
exports.getSamplingBucketSize = getSamplingBucketSize;
|
|
9
|
+
exports.getSamplingLevelCount = getSamplingLevelCount;
|
|
10
|
+
exports.getSamplingMinSpan = getSamplingMinSpan;
|
|
11
|
+
exports.selectSamplingLevel = selectSamplingLevel;
|
|
12
|
+
/** Smallest element size (px) allowed before sampling kicks in. */
|
|
13
|
+
const MIN_ELEMENT_SIZE_PX = exports.MIN_ELEMENT_SIZE_PX = 6;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Min zoom span (%) at which the data fills the view with `MIN_ELEMENT_SIZE_PX`-wide elements.
|
|
17
|
+
* Screen-derived, so elements never get thinner and the level count adapts to screen + data.
|
|
18
|
+
*/
|
|
19
|
+
function getSamplingMinSpan(dataLength, availableSizePx) {
|
|
20
|
+
return 100 * availableSizePx / (MIN_ELEMENT_SIZE_PX * dataLength);
|
|
21
|
+
}
|
|
22
|
+
const EMPTY_PYRAMID_OFFSETS = new Int32Array(1);
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Level 0 (raw) extends this factor above `minSpan` before the first sampled level kicks in — a
|
|
26
|
+
* half-octave of wiggle room so the deepest zoom stays unsampled without a knife-edge transition.
|
|
27
|
+
*/
|
|
28
|
+
const RAW_LEVEL_SPAN_FACTOR = Math.SQRT2;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Hard ceiling on rendered elements, independent of zoom. Even at the deepest zoom (where elements
|
|
32
|
+
* would be wide enough to skip screen sampling), a view with more than this many points is still
|
|
33
|
+
* sampled enough levels to get under the cap — too many elements hurts performance whatever the size.
|
|
34
|
+
*/
|
|
35
|
+
const MAX_RENDERED_POINTS = exports.MAX_RENDERED_POINTS = 2000;
|
|
36
|
+
|
|
37
|
+
/** Levels of sampling needed to bring `visiblePoints` under `MAX_RENDERED_POINTS` (0 if under). */
|
|
38
|
+
function pointCapLevel(visiblePoints) {
|
|
39
|
+
return visiblePoints > MAX_RENDERED_POINTS ? Math.ceil(Math.log2(visiblePoints / MAX_RENDERED_POINTS)) : 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Builds the LOD pyramid for one series from its low/high value channels (for bars: the stacked
|
|
44
|
+
* `[base, top]` channels; for lines: the displayed `y` for both). Each bucket keeps the original
|
|
45
|
+
* index of its min (over `low`) and max (over `high`) — a min/max envelope, so spikes and troughs
|
|
46
|
+
* survive. Consumers read the values back from their own series data by index.
|
|
47
|
+
*
|
|
48
|
+
* Stored flat: all levels concatenated into `argMin`/`argMax`, with `offsets` marking level
|
|
49
|
+
* boundaries. Level 0 (no merge) is implicit; bucket indices are derived (`j * bucketSize`).
|
|
50
|
+
*/
|
|
51
|
+
function buildSamplingPyramid(low, high) {
|
|
52
|
+
const dataLength = low.length;
|
|
53
|
+
if (dataLength <= 1) {
|
|
54
|
+
return {
|
|
55
|
+
dataLength,
|
|
56
|
+
argMin: new Int32Array(0),
|
|
57
|
+
argMax: new Int32Array(0),
|
|
58
|
+
offsets: EMPTY_PYRAMID_OFFSETS
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const levelCount = Math.ceil(Math.log2(dataLength));
|
|
62
|
+
|
|
63
|
+
// Level start offsets into the shared buffers; each level halves the previous count (round up).
|
|
64
|
+
const offsets = new Int32Array(levelCount + 1);
|
|
65
|
+
for (let levelIndex = 0, count = dataLength; levelIndex < levelCount; levelIndex += 1) {
|
|
66
|
+
count = Math.ceil(count / 2);
|
|
67
|
+
offsets[levelIndex + 1] = offsets[levelIndex] + count;
|
|
68
|
+
}
|
|
69
|
+
const argMin = new Int32Array(offsets[levelCount]);
|
|
70
|
+
const argMax = new Int32Array(offsets[levelCount]);
|
|
71
|
+
|
|
72
|
+
// Level 0 (bucketSize 2) merges adjacent raw points; the only level that scans raw data.
|
|
73
|
+
for (let j = 0, i = 0; i < dataLength; j += 1, i += 2) {
|
|
74
|
+
const next = i + 1;
|
|
75
|
+
let lo = i;
|
|
76
|
+
let hi = i;
|
|
77
|
+
if (next < dataLength) {
|
|
78
|
+
if (low[next] < low[i]) {
|
|
79
|
+
lo = next;
|
|
80
|
+
}
|
|
81
|
+
if (high[next] > high[i]) {
|
|
82
|
+
hi = next;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
argMin[j] = lo;
|
|
86
|
+
argMax[j] = hi;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Higher levels merge pairs of buckets from the level below (argMin/argMax are associative via
|
|
90
|
+
// value compare, so the result equals re-scanning raw data). n/2 + n/4 + ... → O(n) build.
|
|
91
|
+
for (let levelIndex = 1; levelIndex < levelCount; levelIndex += 1) {
|
|
92
|
+
const prevStart = offsets[levelIndex - 1];
|
|
93
|
+
const prevCount = offsets[levelIndex] - prevStart;
|
|
94
|
+
const start = offsets[levelIndex];
|
|
95
|
+
for (let i = 0, j = 0; i < prevCount; i += 2, j += 1) {
|
|
96
|
+
const a = prevStart + i;
|
|
97
|
+
const w = start + j;
|
|
98
|
+
if (i + 1 >= prevCount) {
|
|
99
|
+
argMin[w] = argMin[a];
|
|
100
|
+
argMax[w] = argMax[a];
|
|
101
|
+
} else {
|
|
102
|
+
const b = a + 1;
|
|
103
|
+
argMin[w] = low[argMin[a]] <= low[argMin[b]] ? argMin[a] : argMin[b];
|
|
104
|
+
argMax[w] = high[argMax[a]] >= high[argMax[b]] ? argMax[a] : argMax[b];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
dataLength,
|
|
110
|
+
argMin,
|
|
111
|
+
argMax,
|
|
112
|
+
offsets
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Number of stored levels (finest `bucketSize 2` to coarsest). */
|
|
117
|
+
function getSamplingLevelCount(pyramid) {
|
|
118
|
+
return pyramid.offsets.length - 1;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Level-of-detail index for the current zoom:
|
|
123
|
+
* - Level 0 (no sampling, raw) at the deepest zoom (`currentSpan <= minSpan * RAW_LEVEL_SPAN_FACTOR`),
|
|
124
|
+
* whatever the bar size — fully zoomed in shows every point, up to `MAX_RENDERED_POINTS`.
|
|
125
|
+
* - Above that, the level is screen-defined: bucket size keeps elements at least
|
|
126
|
+
* `MIN_ELEMENT_SIZE_PX` wide (+1 per span doubling past that pixel threshold).
|
|
127
|
+
* - The `MAX_RENDERED_POINTS` cap applies at every zoom: a view with too many points is always
|
|
128
|
+
* sampled, even in the raw zone where the screen rule alone would render it untouched.
|
|
129
|
+
*/
|
|
130
|
+
function levelIndexFor(currentSpan, dataLength, availableSizePx, minSpan) {
|
|
131
|
+
if (!(currentSpan > 0)) {
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
const capLevel = pointCapLevel(dataLength * Math.min(currentSpan, 100) / 100);
|
|
135
|
+
if (currentSpan <= minSpan * RAW_LEVEL_SPAN_FACTOR) {
|
|
136
|
+
return capLevel; // raw zone, but still bounded by the point cap
|
|
137
|
+
}
|
|
138
|
+
const screenMinSpan = getSamplingMinSpan(dataLength, availableSizePx);
|
|
139
|
+
if (!(screenMinSpan > 0)) {
|
|
140
|
+
return capLevel;
|
|
141
|
+
}
|
|
142
|
+
return Math.max(capLevel, Math.round(Math.log2(currentSpan / screenMinSpan)));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Picks the active level from the zoom span: level 0 (deepest zoom, `span <= minSpan`, or elements
|
|
147
|
+
* still wide enough) → no sampling (`null`, raw 1:1); each level up → bucket size ×2, chosen so
|
|
148
|
+
* sampled elements stay at least `MIN_ELEMENT_SIZE_PX` wide. Clamped to the pyramid depth.
|
|
149
|
+
* `bucketSize === 2 ** clampedLevel`, level buckets `offsets[clampedLevel - 1 .. clampedLevel]`.
|
|
150
|
+
*/
|
|
151
|
+
function selectSamplingLevel(pyramid, currentSpan, availableSizePx, minSpan) {
|
|
152
|
+
const levelCount = pyramid.offsets.length - 1;
|
|
153
|
+
const levelIndex = levelIndexFor(currentSpan, pyramid.dataLength, availableSizePx, minSpan);
|
|
154
|
+
if (levelIndex <= 0 || levelCount === 0) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
const clampedLevel = Math.min(levelIndex, levelCount);
|
|
158
|
+
return {
|
|
159
|
+
bucketSize: 2 ** clampedLevel,
|
|
160
|
+
start: pyramid.offsets[clampedLevel - 1],
|
|
161
|
+
end: pyramid.offsets[clampedLevel]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Active bucket size (`1` = no sampling) for an axis with no built pyramid (the axis highlight).
|
|
167
|
+
* Matches `selectSamplingLevel`'s `bucketSize`, derived from `dataLength` + screen + `minSpan`.
|
|
168
|
+
*/
|
|
169
|
+
function getSamplingBucketSize(currentSpan, dataLength, availableSizePx, minSpan) {
|
|
170
|
+
const levelIndex = levelIndexFor(currentSpan, dataLength, availableSizePx, minSpan);
|
|
171
|
+
if (levelIndex <= 0 || dataLength <= 1) {
|
|
172
|
+
return 1;
|
|
173
|
+
}
|
|
174
|
+
return 2 ** Math.min(levelIndex, Math.ceil(Math.log2(dataLength)));
|
|
175
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LineSamplingAlgorithm, SampleContext, SampledBucket } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SamplingPyramid } from "./sampling.pyramid.types.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* The active level of detail as buckets for the current zoom, or `null` for no sampling. Each bucket
|
|
5
|
+
* carries its original-index span plus the ascending indices to render. The same output feeds both
|
|
6
|
+
* series types: lines flatten the indices into a polyline, bars draw one merged rect per bucket.
|
|
7
|
+
*
|
|
8
|
+
* `minmax` (default; bars use it) keeps {min, max} per bucket; `m4` also brackets them with the
|
|
9
|
+
* bucket's first/last (pixel-accurate); both read the shared `SamplingPyramid`. `lttb` ignores
|
|
10
|
+
* the pyramid and reduces on demand, reading raw values from `getValues` (called only for `lttb`)
|
|
11
|
+
* as a single whole-range bucket. Its budget matches the envelope methods' point density so it
|
|
12
|
+
* isn't visually sparser at the same zoom.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sampleBuckets(pyramid: SamplingPyramid, currentSpan: number, availableSizePx: number, minSpan: number, algorithm?: LineSamplingAlgorithm, getValues?: () => ArrayLike<number>): SampledBucket[] | null;
|
|
15
|
+
/** Shared `sample` for every series type; the per-type build feeds the channels into the pyramid. */
|
|
16
|
+
export declare function sample(context: SampleContext): SampledBucket[] | null;
|
|
17
|
+
/**
|
|
18
|
+
* Largest-Triangle-Three-Buckets downsampling. Returns `threshold` original indices (including the
|
|
19
|
+
* first and last) chosen to preserve the line's visual shape. Uses the data index as the x channel.
|
|
20
|
+
* @see https://skemman.is/handle/1946/15343 (Sveinn Steinarsson, 2013)
|
|
21
|
+
*/
|
|
22
|
+
export declare function largestTriangleThreeBuckets(values: ArrayLike<number>, threshold: number): Int32Array;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LineSamplingAlgorithm, SampleContext, SampledBucket } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SamplingPyramid } from "./sampling.pyramid.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The active level of detail as buckets for the current zoom, or `null` for no sampling. Each bucket
|
|
5
|
+
* carries its original-index span plus the ascending indices to render. The same output feeds both
|
|
6
|
+
* series types: lines flatten the indices into a polyline, bars draw one merged rect per bucket.
|
|
7
|
+
*
|
|
8
|
+
* `minmax` (default; bars use it) keeps {min, max} per bucket; `m4` also brackets them with the
|
|
9
|
+
* bucket's first/last (pixel-accurate); both read the shared `SamplingPyramid`. `lttb` ignores
|
|
10
|
+
* the pyramid and reduces on demand, reading raw values from `getValues` (called only for `lttb`)
|
|
11
|
+
* as a single whole-range bucket. Its budget matches the envelope methods' point density so it
|
|
12
|
+
* isn't visually sparser at the same zoom.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sampleBuckets(pyramid: SamplingPyramid, currentSpan: number, availableSizePx: number, minSpan: number, algorithm?: LineSamplingAlgorithm, getValues?: () => ArrayLike<number>): SampledBucket[] | null;
|
|
15
|
+
/** Shared `sample` for every series type; the per-type build feeds the channels into the pyramid. */
|
|
16
|
+
export declare function sample(context: SampleContext): SampledBucket[] | null;
|
|
17
|
+
/**
|
|
18
|
+
* Largest-Triangle-Three-Buckets downsampling. Returns `threshold` original indices (including the
|
|
19
|
+
* first and last) chosen to preserve the line's visual shape. Uses the data index as the x channel.
|
|
20
|
+
* @see https://skemman.is/handle/1946/15343 (Sveinn Steinarsson, 2013)
|
|
21
|
+
*/
|
|
22
|
+
export declare function largestTriangleThreeBuckets(values: ArrayLike<number>, threshold: number): Int32Array;
|