@mui/x-charts-premium 9.0.4 → 9.1.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/BarChartPremium/BarChartPremium.js +2 -1183
- package/BarChartPremium/BarChartPremium.mjs +2 -1183
- package/BarChartPremium/RangeBar/seriesConfig/seriesProcessor.js +2 -0
- package/BarChartPremium/RangeBar/seriesConfig/seriesProcessor.mjs +2 -0
- package/CHANGELOG.md +133 -0
- package/CandlestickChart/CandlestickChart.d.mts +2 -2
- package/CandlestickChart/CandlestickChart.d.ts +2 -2
- package/CandlestickChart/CandlestickChart.js +2 -1183
- package/CandlestickChart/CandlestickChart.mjs +2 -1183
- package/CandlestickChart/CandlestickWebGLProgram.d.mts +6 -11
- package/CandlestickChart/CandlestickWebGLProgram.d.ts +6 -11
- package/CandlestickChart/CandlestickWebGLProgram.js +136 -121
- package/CandlestickChart/CandlestickWebGLProgram.mjs +137 -122
- package/CandlestickChart/useCandlestickPlotData.d.mts +2 -2
- package/CandlestickChart/useCandlestickPlotData.d.ts +2 -2
- package/CandlestickChart/useCandlestickPlotData.js +121 -61
- package/CandlestickChart/useCandlestickPlotData.mjs +122 -61
- package/ChartsAxisHighlightValue/index.d.mts +1 -0
- package/ChartsAxisHighlightValue/index.d.ts +1 -0
- package/ChartsAxisHighlightValue/index.js +16 -0
- package/ChartsAxisHighlightValue/index.mjs +2 -0
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.js +2 -2
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.mjs +2 -2
- package/ChartsRadialAxisHighlight/index.d.mts +1 -0
- package/ChartsRadialAxisHighlight/index.d.ts +1 -0
- package/ChartsRadialAxisHighlight/index.js +16 -0
- package/ChartsRadialAxisHighlight/index.mjs +2 -0
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.js +2 -2
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.mjs +2 -2
- package/HeatmapPremium/HeatmapPremium.js +2 -155
- package/HeatmapPremium/HeatmapPremium.mjs +2 -155
- package/HeatmapPremium/webgl/HeatmapWebGLPlot.js +19 -112
- package/HeatmapPremium/webgl/HeatmapWebGLPlot.mjs +19 -111
- package/HeatmapPremium/webgl/HeatmapWebGLProgram.d.mts +24 -0
- package/HeatmapPremium/webgl/HeatmapWebGLProgram.d.ts +24 -0
- package/HeatmapPremium/webgl/HeatmapWebGLProgram.js +132 -0
- package/HeatmapPremium/webgl/HeatmapWebGLProgram.mjs +125 -0
- package/HeatmapPremium/webgl/useHeatmapPlotData.d.mts +3 -3
- package/HeatmapPremium/webgl/useHeatmapPlotData.d.ts +3 -3
- package/HeatmapPremium/webgl/useHeatmapPlotData.js +78 -26
- package/HeatmapPremium/webgl/useHeatmapPlotData.mjs +80 -26
- package/LICENSE +3 -1
- package/RadialBarChart/RadialBarChart.d.mts +60 -0
- package/RadialBarChart/RadialBarChart.d.ts +60 -0
- package/RadialBarChart/RadialBarChart.js +298 -0
- package/RadialBarChart/RadialBarChart.mjs +292 -0
- package/RadialBarChart/RadialBarChart.plugins.d.mts +4 -0
- package/RadialBarChart/RadialBarChart.plugins.d.ts +4 -0
- package/RadialBarChart/RadialBarChart.plugins.js +9 -0
- package/RadialBarChart/RadialBarChart.plugins.mjs +3 -0
- package/RadialBarChart/RadialBarElement.d.mts +16 -0
- package/RadialBarChart/RadialBarElement.d.ts +16 -0
- package/RadialBarChart/RadialBarElement.js +54 -0
- package/RadialBarChart/RadialBarElement.mjs +48 -0
- package/RadialBarChart/RadialBarPlot.d.mts +21 -0
- package/RadialBarChart/RadialBarPlot.d.ts +21 -0
- package/RadialBarChart/RadialBarPlot.js +85 -0
- package/RadialBarChart/RadialBarPlot.mjs +79 -0
- package/RadialBarChart/index.d.mts +3 -0
- package/RadialBarChart/index.d.ts +3 -0
- package/RadialBarChart/index.js +39 -0
- package/RadialBarChart/index.mjs +3 -0
- package/RadialBarChart/radialBarClasses.d.mts +15 -0
- package/RadialBarChart/radialBarClasses.d.ts +15 -0
- package/RadialBarChart/radialBarClasses.js +26 -0
- package/RadialBarChart/radialBarClasses.mjs +18 -0
- package/RadialBarChart/seriesConfig/seriesProcessor.js +4 -0
- package/RadialBarChart/seriesConfig/seriesProcessor.mjs +4 -0
- package/RadialBarChart/useRadialBarChartProps.d.mts +28 -0
- package/RadialBarChart/useRadialBarChartProps.d.ts +28 -0
- package/RadialBarChart/useRadialBarChartProps.js +100 -0
- package/RadialBarChart/useRadialBarChartProps.mjs +93 -0
- package/RadialBarChart/useRadialBarPlotData.d.mts +23 -0
- package/RadialBarChart/useRadialBarPlotData.d.ts +23 -0
- package/RadialBarChart/useRadialBarPlotData.js +94 -0
- package/RadialBarChart/useRadialBarPlotData.mjs +87 -0
- package/RadialLineChart/RadialArea.js +13 -1
- package/RadialLineChart/RadialArea.mjs +13 -1
- package/RadialLineChart/RadialLine.js +13 -1
- package/RadialLineChart/RadialLine.mjs +13 -1
- package/RadialLineChart/RadialLineChart.d.mts +11 -3
- package/RadialLineChart/RadialLineChart.d.ts +11 -3
- package/RadialLineChart/RadialLineChart.js +24 -673
- package/RadialLineChart/RadialLineChart.mjs +24 -673
- package/RadialLineChart/RadialLineHighlightElement.d.mts +15 -0
- package/RadialLineChart/RadialLineHighlightElement.d.ts +15 -0
- package/RadialLineChart/RadialLineHighlightElement.js +46 -0
- package/RadialLineChart/RadialLineHighlightElement.mjs +39 -0
- package/RadialLineChart/RadialLineHighlightPlot.d.mts +23 -0
- package/RadialLineChart/RadialLineHighlightPlot.d.ts +23 -0
- package/RadialLineChart/RadialLineHighlightPlot.js +92 -0
- package/RadialLineChart/RadialLineHighlightPlot.mjs +86 -0
- package/RadialLineChart/RadialMarkPlot.js +17 -2
- package/RadialLineChart/RadialMarkPlot.mjs +17 -2
- package/RadialLineChart/index.d.mts +3 -1
- package/RadialLineChart/index.d.ts +3 -1
- package/RadialLineChart/index.js +22 -0
- package/RadialLineChart/index.mjs +3 -1
- package/RadialLineChart/radialLineClasses.d.mts +3 -1
- package/RadialLineChart/radialLineClasses.d.ts +3 -1
- package/RadialLineChart/radialLineClasses.js +2 -1
- package/RadialLineChart/radialLineClasses.mjs +2 -1
- package/RadialLineChart/seriesConfig/getItemAtPosition.d.mts +6 -0
- package/RadialLineChart/seriesConfig/getItemAtPosition.d.ts +6 -0
- package/RadialLineChart/seriesConfig/getItemAtPosition.js +353 -0
- package/RadialLineChart/seriesConfig/getItemAtPosition.mjs +348 -0
- package/RadialLineChart/seriesConfig/getSeriesWithDefaultValues.js +2 -1
- package/RadialLineChart/seriesConfig/getSeriesWithDefaultValues.mjs +2 -1
- package/RadialLineChart/seriesConfig/index.js +2 -1
- package/RadialLineChart/seriesConfig/index.mjs +2 -1
- package/RadialLineChart/seriesConfig/seriesProcessor.js +4 -0
- package/RadialLineChart/seriesConfig/seriesProcessor.mjs +4 -0
- package/RadialLineChart/useRadialLineChartProps.d.mts +2 -0
- package/RadialLineChart/useRadialLineChartProps.d.ts +2 -0
- package/RadialLineChart/useRadialLineChartProps.js +16 -8
- package/RadialLineChart/useRadialLineChartProps.mjs +16 -8
- package/RadialLineChart/useRadialLinePlotData.js +2 -1
- package/RadialLineChart/useRadialLinePlotData.mjs +3 -2
- package/ScatterChartPremium/ScatterChartPremium.d.mts +25 -0
- package/ScatterChartPremium/ScatterChartPremium.d.ts +25 -0
- package/ScatterChartPremium/ScatterChartPremium.js +507 -0
- package/ScatterChartPremium/ScatterChartPremium.mjs +501 -0
- package/ScatterChartPremium/ScatterChartPremium.plugins.d.mts +3 -0
- package/ScatterChartPremium/ScatterChartPremium.plugins.d.ts +3 -0
- package/ScatterChartPremium/ScatterChartPremium.plugins.js +8 -0
- package/ScatterChartPremium/ScatterChartPremium.plugins.mjs +2 -0
- package/ScatterChartPremium/ScatterPlotPremium.d.mts +14 -0
- package/ScatterChartPremium/ScatterPlotPremium.d.ts +14 -0
- package/ScatterChartPremium/ScatterPlotPremium.js +28 -0
- package/ScatterChartPremium/ScatterPlotPremium.mjs +21 -0
- package/ScatterChartPremium/index.d.mts +3 -0
- package/ScatterChartPremium/index.d.ts +3 -0
- package/ScatterChartPremium/index.js +26 -0
- package/ScatterChartPremium/index.mjs +3 -0
- package/ScatterChartPremium/webgl/ScatterWebGLPlot.d.mts +4 -0
- package/ScatterChartPremium/webgl/ScatterWebGLPlot.d.ts +4 -0
- package/ScatterChartPremium/webgl/ScatterWebGLPlot.js +70 -0
- package/ScatterChartPremium/webgl/ScatterWebGLPlot.mjs +65 -0
- package/ScatterChartPremium/webgl/ScatterWebGLProgram.d.mts +18 -0
- package/ScatterChartPremium/webgl/ScatterWebGLProgram.d.ts +18 -0
- package/ScatterChartPremium/webgl/ScatterWebGLProgram.js +129 -0
- package/ScatterChartPremium/webgl/ScatterWebGLProgram.mjs +122 -0
- package/ScatterChartPremium/webgl/shaders.d.mts +2 -0
- package/ScatterChartPremium/webgl/shaders.d.ts +2 -0
- package/ScatterChartPremium/webgl/shaders.js +57 -0
- package/ScatterChartPremium/webgl/shaders.mjs +51 -0
- package/ScatterChartPremium/webgl/useScatterWebGLPlotData.d.mts +7 -0
- package/ScatterChartPremium/webgl/useScatterWebGLPlotData.d.ts +7 -0
- package/ScatterChartPremium/webgl/useScatterWebGLPlotData.js +140 -0
- package/ScatterChartPremium/webgl/useScatterWebGLPlotData.mjs +134 -0
- package/index.d.mts +3 -1
- package/index.d.ts +3 -1
- package/index.js +25 -1
- package/index.mjs +4 -2
- package/internals/index.d.mts +1 -0
- package/internals/index.d.ts +1 -0
- package/internals/index.js +13 -0
- package/internals/index.mjs +1 -0
- package/models/seriesType/radialLine.d.mts +7 -1
- package/models/seriesType/radialLine.d.ts +7 -1
- package/package.json +184 -114
- package/plugins/selectors/useChartCandlestickPosition.selectors.d.mts +1 -1
- package/plugins/selectors/useChartCandlestickPosition.selectors.d.ts +1 -1
- package/utils/webgl/parseColor.d.mts +2 -1
- package/utils/webgl/parseColor.d.ts +2 -1
- package/utils/webgl/parseColor.js +8 -7
- package/utils/webgl/parseColor.mjs +8 -7
- package/utils/webgl/utils.d.mts +13 -0
- package/utils/webgl/utils.d.ts +13 -0
- package/utils/webgl/utils.js +29 -0
- package/utils/webgl/utils.mjs +27 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useScatterWebGLPlotData = useScatterWebGLPlotData;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
11
|
+
var _parseColor = require("../../utils/webgl/parseColor");
|
|
12
|
+
const DEFAULT_MARKER_SIZE = 4;
|
|
13
|
+
const EMPTY_DATA = {
|
|
14
|
+
centers: new Float32Array(0),
|
|
15
|
+
sizes: new Float32Array(0),
|
|
16
|
+
colors: new Uint8Array(0),
|
|
17
|
+
pointCount: 0
|
|
18
|
+
};
|
|
19
|
+
function useScatterWebGLPlotData() {
|
|
20
|
+
const seriesData = (0, _hooks.useScatterSeriesContext)();
|
|
21
|
+
const {
|
|
22
|
+
xAxis: xAxes,
|
|
23
|
+
xAxisIds
|
|
24
|
+
} = (0, _hooks.useXAxes)();
|
|
25
|
+
const {
|
|
26
|
+
yAxis: yAxes,
|
|
27
|
+
yAxisIds
|
|
28
|
+
} = (0, _hooks.useYAxes)();
|
|
29
|
+
const drawingArea = (0, _hooks.useDrawingArea)();
|
|
30
|
+
const defaultXAxisId = xAxisIds[0];
|
|
31
|
+
const defaultYAxisId = yAxisIds[0];
|
|
32
|
+
|
|
33
|
+
// Colors and sizes depend only on series identity (series color + markerSize).
|
|
34
|
+
// When only the drawing area or axes change we reuse the cached Float32Array
|
|
35
|
+
// references so the WebGL program can skip the GPU upload for them.
|
|
36
|
+
// Caveat: if the axis scale starts producing non-numeric values for some points
|
|
37
|
+
// (e.g. NaN after a config change), those points are skipped from the centers
|
|
38
|
+
// walk while the cached sizes/colors entries for them stay in place — which can
|
|
39
|
+
// desynchronise styles from positions until the cache is invalidated. Acceptable
|
|
40
|
+
// for now since seriesData identity changes on any series mutation.
|
|
41
|
+
const cachedStylesRef = React.useRef(null);
|
|
42
|
+
|
|
43
|
+
// Centers change on every zoom/axis update, but the underlying ArrayBuffer
|
|
44
|
+
// can be reused to avoid allocating ~1.6 MB per zoom frame at 200k points.
|
|
45
|
+
// We return a fresh Float32Array VIEW over the pooled buffer so the WebGL
|
|
46
|
+
// program's reference-equality short-circuit still treats it as new data.
|
|
47
|
+
const centersPoolRef = React.useRef(null);
|
|
48
|
+
return React.useMemo(() => {
|
|
49
|
+
if (!seriesData) {
|
|
50
|
+
return EMPTY_DATA;
|
|
51
|
+
}
|
|
52
|
+
const {
|
|
53
|
+
series,
|
|
54
|
+
seriesOrder
|
|
55
|
+
} = seriesData;
|
|
56
|
+
let maxPoints = 0;
|
|
57
|
+
for (const seriesId of seriesOrder) {
|
|
58
|
+
const s = series[seriesId];
|
|
59
|
+
if (s.hidden) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
maxPoints += s.data?.length ?? 0;
|
|
63
|
+
}
|
|
64
|
+
if (maxPoints === 0) {
|
|
65
|
+
return EMPTY_DATA;
|
|
66
|
+
}
|
|
67
|
+
const cached = cachedStylesRef.current;
|
|
68
|
+
const reuseStyles = cached !== null && cached.seriesData === seriesData && cached.sizes.length === maxPoints && cached.colors.length === maxPoints * 4;
|
|
69
|
+
const centersLength = maxPoints * 2;
|
|
70
|
+
let pool = centersPoolRef.current;
|
|
71
|
+
if (pool === null || pool.length < centersLength) {
|
|
72
|
+
pool = new Float32Array(centersLength);
|
|
73
|
+
centersPoolRef.current = pool;
|
|
74
|
+
}
|
|
75
|
+
// New view over the shared buffer — reference identity differs each call so
|
|
76
|
+
// the GPU upload path treats the centers as dirty, but no heap allocation
|
|
77
|
+
// of the underlying buffer is incurred.
|
|
78
|
+
const centers = new Float32Array(pool.buffer, 0, centersLength);
|
|
79
|
+
const sizes = reuseStyles ? cached.sizes : new Float32Array(maxPoints);
|
|
80
|
+
const colors = reuseStyles ? cached.colors : new Uint8Array(maxPoints * 4);
|
|
81
|
+
let pointCount = 0;
|
|
82
|
+
const dx = -drawingArea.left;
|
|
83
|
+
const dy = -drawingArea.top;
|
|
84
|
+
for (const seriesId of seriesOrder) {
|
|
85
|
+
const s = series[seriesId];
|
|
86
|
+
if (s.hidden) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const xAxisId = s.xAxisId ?? defaultXAxisId;
|
|
90
|
+
const yAxisId = s.yAxisId ?? defaultYAxisId;
|
|
91
|
+
if (!(xAxisId in xAxes) || !(yAxisId in yAxes)) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const xScale = xAxes[xAxisId].scale;
|
|
95
|
+
const yScale = yAxes[yAxisId].scale;
|
|
96
|
+
const data = s.data;
|
|
97
|
+
if (!data) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const [cr, cg, cb, ca] = (0, _parseColor.parseColor)(s.color);
|
|
101
|
+
const markerSize = s.markerSize ?? DEFAULT_MARKER_SIZE;
|
|
102
|
+
for (let i = 0; i < data.length; i += 1) {
|
|
103
|
+
const point = data[i];
|
|
104
|
+
if (point == null) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const sx = xScale(point.x);
|
|
108
|
+
const sy = yScale(point.y);
|
|
109
|
+
if (sx == null || sy == null || Number.isNaN(sx) || Number.isNaN(sy)) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const offset2 = pointCount * 2;
|
|
113
|
+
centers[offset2] = sx + dx;
|
|
114
|
+
centers[offset2 + 1] = sy + dy;
|
|
115
|
+
if (!reuseStyles) {
|
|
116
|
+
sizes[pointCount] = markerSize;
|
|
117
|
+
const offset4 = pointCount * 4;
|
|
118
|
+
colors[offset4] = cr;
|
|
119
|
+
colors[offset4 + 1] = cg;
|
|
120
|
+
colors[offset4 + 2] = cb;
|
|
121
|
+
colors[offset4 + 3] = ca;
|
|
122
|
+
}
|
|
123
|
+
pointCount += 1;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (!reuseStyles) {
|
|
127
|
+
cachedStylesRef.current = {
|
|
128
|
+
seriesData,
|
|
129
|
+
sizes,
|
|
130
|
+
colors
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
centers,
|
|
135
|
+
sizes,
|
|
136
|
+
colors,
|
|
137
|
+
pointCount
|
|
138
|
+
};
|
|
139
|
+
}, [seriesData, xAxes, yAxes, drawingArea, defaultXAxisId, defaultYAxisId]);
|
|
140
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useDrawingArea, useScatterSeriesContext, useXAxes, useYAxes } from '@mui/x-charts/hooks';
|
|
5
|
+
import { parseColor } from "../../utils/webgl/parseColor.mjs";
|
|
6
|
+
const DEFAULT_MARKER_SIZE = 4;
|
|
7
|
+
const EMPTY_DATA = {
|
|
8
|
+
centers: new Float32Array(0),
|
|
9
|
+
sizes: new Float32Array(0),
|
|
10
|
+
colors: new Uint8Array(0),
|
|
11
|
+
pointCount: 0
|
|
12
|
+
};
|
|
13
|
+
export function useScatterWebGLPlotData() {
|
|
14
|
+
const seriesData = useScatterSeriesContext();
|
|
15
|
+
const {
|
|
16
|
+
xAxis: xAxes,
|
|
17
|
+
xAxisIds
|
|
18
|
+
} = useXAxes();
|
|
19
|
+
const {
|
|
20
|
+
yAxis: yAxes,
|
|
21
|
+
yAxisIds
|
|
22
|
+
} = useYAxes();
|
|
23
|
+
const drawingArea = useDrawingArea();
|
|
24
|
+
const defaultXAxisId = xAxisIds[0];
|
|
25
|
+
const defaultYAxisId = yAxisIds[0];
|
|
26
|
+
|
|
27
|
+
// Colors and sizes depend only on series identity (series color + markerSize).
|
|
28
|
+
// When only the drawing area or axes change we reuse the cached Float32Array
|
|
29
|
+
// references so the WebGL program can skip the GPU upload for them.
|
|
30
|
+
// Caveat: if the axis scale starts producing non-numeric values for some points
|
|
31
|
+
// (e.g. NaN after a config change), those points are skipped from the centers
|
|
32
|
+
// walk while the cached sizes/colors entries for them stay in place — which can
|
|
33
|
+
// desynchronise styles from positions until the cache is invalidated. Acceptable
|
|
34
|
+
// for now since seriesData identity changes on any series mutation.
|
|
35
|
+
const cachedStylesRef = React.useRef(null);
|
|
36
|
+
|
|
37
|
+
// Centers change on every zoom/axis update, but the underlying ArrayBuffer
|
|
38
|
+
// can be reused to avoid allocating ~1.6 MB per zoom frame at 200k points.
|
|
39
|
+
// We return a fresh Float32Array VIEW over the pooled buffer so the WebGL
|
|
40
|
+
// program's reference-equality short-circuit still treats it as new data.
|
|
41
|
+
const centersPoolRef = React.useRef(null);
|
|
42
|
+
return React.useMemo(() => {
|
|
43
|
+
if (!seriesData) {
|
|
44
|
+
return EMPTY_DATA;
|
|
45
|
+
}
|
|
46
|
+
const {
|
|
47
|
+
series,
|
|
48
|
+
seriesOrder
|
|
49
|
+
} = seriesData;
|
|
50
|
+
let maxPoints = 0;
|
|
51
|
+
for (const seriesId of seriesOrder) {
|
|
52
|
+
const s = series[seriesId];
|
|
53
|
+
if (s.hidden) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
maxPoints += s.data?.length ?? 0;
|
|
57
|
+
}
|
|
58
|
+
if (maxPoints === 0) {
|
|
59
|
+
return EMPTY_DATA;
|
|
60
|
+
}
|
|
61
|
+
const cached = cachedStylesRef.current;
|
|
62
|
+
const reuseStyles = cached !== null && cached.seriesData === seriesData && cached.sizes.length === maxPoints && cached.colors.length === maxPoints * 4;
|
|
63
|
+
const centersLength = maxPoints * 2;
|
|
64
|
+
let pool = centersPoolRef.current;
|
|
65
|
+
if (pool === null || pool.length < centersLength) {
|
|
66
|
+
pool = new Float32Array(centersLength);
|
|
67
|
+
centersPoolRef.current = pool;
|
|
68
|
+
}
|
|
69
|
+
// New view over the shared buffer — reference identity differs each call so
|
|
70
|
+
// the GPU upload path treats the centers as dirty, but no heap allocation
|
|
71
|
+
// of the underlying buffer is incurred.
|
|
72
|
+
const centers = new Float32Array(pool.buffer, 0, centersLength);
|
|
73
|
+
const sizes = reuseStyles ? cached.sizes : new Float32Array(maxPoints);
|
|
74
|
+
const colors = reuseStyles ? cached.colors : new Uint8Array(maxPoints * 4);
|
|
75
|
+
let pointCount = 0;
|
|
76
|
+
const dx = -drawingArea.left;
|
|
77
|
+
const dy = -drawingArea.top;
|
|
78
|
+
for (const seriesId of seriesOrder) {
|
|
79
|
+
const s = series[seriesId];
|
|
80
|
+
if (s.hidden) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const xAxisId = s.xAxisId ?? defaultXAxisId;
|
|
84
|
+
const yAxisId = s.yAxisId ?? defaultYAxisId;
|
|
85
|
+
if (!(xAxisId in xAxes) || !(yAxisId in yAxes)) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const xScale = xAxes[xAxisId].scale;
|
|
89
|
+
const yScale = yAxes[yAxisId].scale;
|
|
90
|
+
const data = s.data;
|
|
91
|
+
if (!data) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
const [cr, cg, cb, ca] = parseColor(s.color);
|
|
95
|
+
const markerSize = s.markerSize ?? DEFAULT_MARKER_SIZE;
|
|
96
|
+
for (let i = 0; i < data.length; i += 1) {
|
|
97
|
+
const point = data[i];
|
|
98
|
+
if (point == null) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const sx = xScale(point.x);
|
|
102
|
+
const sy = yScale(point.y);
|
|
103
|
+
if (sx == null || sy == null || Number.isNaN(sx) || Number.isNaN(sy)) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const offset2 = pointCount * 2;
|
|
107
|
+
centers[offset2] = sx + dx;
|
|
108
|
+
centers[offset2 + 1] = sy + dy;
|
|
109
|
+
if (!reuseStyles) {
|
|
110
|
+
sizes[pointCount] = markerSize;
|
|
111
|
+
const offset4 = pointCount * 4;
|
|
112
|
+
colors[offset4] = cr;
|
|
113
|
+
colors[offset4 + 1] = cg;
|
|
114
|
+
colors[offset4 + 2] = cb;
|
|
115
|
+
colors[offset4 + 3] = ca;
|
|
116
|
+
}
|
|
117
|
+
pointCount += 1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (!reuseStyles) {
|
|
121
|
+
cachedStylesRef.current = {
|
|
122
|
+
seriesData,
|
|
123
|
+
sizes,
|
|
124
|
+
colors
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
centers,
|
|
129
|
+
sizes,
|
|
130
|
+
colors,
|
|
131
|
+
pointCount
|
|
132
|
+
};
|
|
133
|
+
}, [seriesData, xAxes, yAxes, drawingArea, defaultXAxisId, defaultYAxisId]);
|
|
134
|
+
}
|
package/index.d.mts
CHANGED
|
@@ -50,6 +50,8 @@ export * from "./ChartsRadialDataProviderPremium/index.mjs";
|
|
|
50
50
|
export * from "./ChartsContainerPremium/index.mjs";
|
|
51
51
|
export * from "./BarChartPremium/index.mjs";
|
|
52
52
|
export * from "./HeatmapPremium/index.mjs";
|
|
53
|
+
export * from "./ScatterChartPremium/index.mjs";
|
|
53
54
|
export * from "./ChartsWebGLLayer/index.mjs";
|
|
54
55
|
export * from "./CandlestickChart/index.mjs";
|
|
55
|
-
export * from "./RadialLineChart/index.mjs";
|
|
56
|
+
export * from "./RadialLineChart/index.mjs";
|
|
57
|
+
export * from "./RadialBarChart/index.mjs";
|
package/index.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ export * from "./ChartsRadialDataProviderPremium/index.js";
|
|
|
50
50
|
export * from "./ChartsContainerPremium/index.js";
|
|
51
51
|
export * from "./BarChartPremium/index.js";
|
|
52
52
|
export * from "./HeatmapPremium/index.js";
|
|
53
|
+
export * from "./ScatterChartPremium/index.js";
|
|
53
54
|
export * from "./ChartsWebGLLayer/index.js";
|
|
54
55
|
export * from "./CandlestickChart/index.js";
|
|
55
|
-
export * from "./RadialLineChart/index.js";
|
|
56
|
+
export * from "./RadialLineChart/index.js";
|
|
57
|
+
export * from "./RadialBarChart/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts-premium v9.0
|
|
2
|
+
* @mui/x-charts-premium v9.1.0
|
|
3
3
|
*
|
|
4
4
|
* @license SEE LICENSE IN LICENSE
|
|
5
5
|
* This source code is licensed under the SEE LICENSE IN LICENSE license found in the
|
|
@@ -594,6 +594,18 @@ Object.keys(_HeatmapPremium).forEach(function (key) {
|
|
|
594
594
|
}
|
|
595
595
|
});
|
|
596
596
|
});
|
|
597
|
+
var _ScatterChartPremium = require("./ScatterChartPremium");
|
|
598
|
+
Object.keys(_ScatterChartPremium).forEach(function (key) {
|
|
599
|
+
if (key === "default" || key === "__esModule") return;
|
|
600
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
601
|
+
if (key in exports && exports[key] === _ScatterChartPremium[key]) return;
|
|
602
|
+
Object.defineProperty(exports, key, {
|
|
603
|
+
enumerable: true,
|
|
604
|
+
get: function () {
|
|
605
|
+
return _ScatterChartPremium[key];
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
});
|
|
597
609
|
var _ChartsWebGLLayer = require("./ChartsWebGLLayer");
|
|
598
610
|
Object.keys(_ChartsWebGLLayer).forEach(function (key) {
|
|
599
611
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -629,4 +641,16 @@ Object.keys(_RadialLineChart).forEach(function (key) {
|
|
|
629
641
|
return _RadialLineChart[key];
|
|
630
642
|
}
|
|
631
643
|
});
|
|
644
|
+
});
|
|
645
|
+
var _RadialBarChart = require("./RadialBarChart");
|
|
646
|
+
Object.keys(_RadialBarChart).forEach(function (key) {
|
|
647
|
+
if (key === "default" || key === "__esModule") return;
|
|
648
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
649
|
+
if (key in exports && exports[key] === _RadialBarChart[key]) return;
|
|
650
|
+
Object.defineProperty(exports, key, {
|
|
651
|
+
enumerable: true,
|
|
652
|
+
get: function () {
|
|
653
|
+
return _RadialBarChart[key];
|
|
654
|
+
}
|
|
655
|
+
});
|
|
632
656
|
});
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts-premium v9.0
|
|
2
|
+
* @mui/x-charts-premium v9.1.0
|
|
3
3
|
*
|
|
4
4
|
* @license SEE LICENSE IN LICENSE
|
|
5
5
|
* This source code is licensed under the SEE LICENSE IN LICENSE license found in the
|
|
@@ -66,6 +66,8 @@ export * from "./ChartsRadialDataProviderPremium/index.mjs";
|
|
|
66
66
|
export * from "./ChartsContainerPremium/index.mjs";
|
|
67
67
|
export * from "./BarChartPremium/index.mjs";
|
|
68
68
|
export * from "./HeatmapPremium/index.mjs";
|
|
69
|
+
export * from "./ScatterChartPremium/index.mjs";
|
|
69
70
|
export * from "./ChartsWebGLLayer/index.mjs";
|
|
70
71
|
export * from "./CandlestickChart/index.mjs";
|
|
71
|
-
export * from "./RadialLineChart/index.mjs";
|
|
72
|
+
export * from "./RadialLineChart/index.mjs";
|
|
73
|
+
export * from "./RadialBarChart/index.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as getRadialLineItemAtPosition } from "../RadialLineChart/seriesConfig/getItemAtPosition.mjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as getRadialLineItemAtPosition } from "../RadialLineChart/seriesConfig/getItemAtPosition.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "getRadialLineItemAtPosition", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _getItemAtPosition.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _getItemAtPosition = _interopRequireDefault(require("../RadialLineChart/seriesConfig/getItemAtPosition"));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as getRadialLineItemAtPosition } from "../RadialLineChart/seriesConfig/getItemAtPosition.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CommonSeriesType, CommonLineSeriesType, RadialSeriesType, StackableSeriesType, SeriesId, CommonDefaultizedProps } from '@mui/x-charts/internals';
|
|
2
|
-
import type { StackOffsetType } from '@mui/x-charts/models';
|
|
2
|
+
import type { CurveType, StackOffsetType } from '@mui/x-charts/models';
|
|
3
3
|
import type { DefaultizedProps } from '@mui/x-internals/types';
|
|
4
4
|
export interface RadialLineSeriesType extends CommonSeriesType<number | null, 'line'>, RadialSeriesType, StackableSeriesType, CommonLineSeriesType {
|
|
5
5
|
type: 'radialLine';
|
|
@@ -8,6 +8,12 @@ export interface RadialLineSeriesType extends CommonSeriesType<number | null, 'l
|
|
|
8
8
|
* @default 'none'
|
|
9
9
|
*/
|
|
10
10
|
stackOffset?: StackOffsetType;
|
|
11
|
+
/**
|
|
12
|
+
* The type of curve to use for the line.
|
|
13
|
+
* Read more about curves at [line interpolation](https://mui.com/x/react-charts/lines/#interpolation).
|
|
14
|
+
* @default 'linear'
|
|
15
|
+
*/
|
|
16
|
+
curve?: CurveType;
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
13
19
|
* An object that allows to identify a single line.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CommonSeriesType, CommonLineSeriesType, RadialSeriesType, StackableSeriesType, SeriesId, CommonDefaultizedProps } from '@mui/x-charts/internals';
|
|
2
|
-
import type { StackOffsetType } from '@mui/x-charts/models';
|
|
2
|
+
import type { CurveType, StackOffsetType } from '@mui/x-charts/models';
|
|
3
3
|
import type { DefaultizedProps } from '@mui/x-internals/types';
|
|
4
4
|
export interface RadialLineSeriesType extends CommonSeriesType<number | null, 'line'>, RadialSeriesType, StackableSeriesType, CommonLineSeriesType {
|
|
5
5
|
type: 'radialLine';
|
|
@@ -8,6 +8,12 @@ export interface RadialLineSeriesType extends CommonSeriesType<number | null, 'l
|
|
|
8
8
|
* @default 'none'
|
|
9
9
|
*/
|
|
10
10
|
stackOffset?: StackOffsetType;
|
|
11
|
+
/**
|
|
12
|
+
* The type of curve to use for the line.
|
|
13
|
+
* Read more about curves at [line interpolation](https://mui.com/x/react-charts/lines/#interpolation).
|
|
14
|
+
* @default 'linear'
|
|
15
|
+
*/
|
|
16
|
+
curve?: CurveType;
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
13
19
|
* An object that allows to identify a single line.
|