@mui/x-charts-premium 9.0.3 → 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/FocusedRangeBar.js +3 -0
- package/BarChartPremium/RangeBar/FocusedRangeBar.mjs +3 -0
- package/BarChartPremium/RangeBar/seriesConfig/seriesProcessor.js +2 -0
- package/BarChartPremium/RangeBar/seriesConfig/seriesProcessor.mjs +2 -0
- package/CHANGELOG.md +220 -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/shaders.d.mts +1 -1
- package/HeatmapPremium/webgl/shaders.d.ts +1 -1
- package/HeatmapPremium/webgl/shaders.js +1 -1
- package/HeatmapPremium/webgl/shaders.mjs +1 -1
- 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 +32 -3
- package/RadialLineChart/RadialMarkPlot.mjs +32 -3
- 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.d.mts +3 -1
- package/RadialLineChart/useRadialLinePlotData.d.ts +3 -1
- package/RadialLineChart/useRadialLinePlotData.js +5 -1
- package/RadialLineChart/useRadialLinePlotData.mjs +6 -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 +185 -115
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
'use client';
|
|
2
3
|
|
|
3
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -9,49 +10,100 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
9
10
|
var _hooks = require("@mui/x-charts/hooks");
|
|
10
11
|
var _internals = require("@mui/x-charts/internals");
|
|
11
12
|
var _parseColor = require("../../utils/webgl/parseColor");
|
|
13
|
+
/* Far enough off-canvas that the rect is never visible; used for invalid x/y entries.
|
|
14
|
+
* Avoids coupling the position pass to the color/saturation passes. */
|
|
15
|
+
const OFFSCREEN = -1e9;
|
|
16
|
+
function ensurePoolFloat32(pool, n) {
|
|
17
|
+
if (pool && pool.length >= n) {
|
|
18
|
+
return pool;
|
|
19
|
+
}
|
|
20
|
+
return new Float32Array(n);
|
|
21
|
+
}
|
|
12
22
|
function useHeatmapPlotData(drawingArea, series, xScale, yScale) {
|
|
13
23
|
const width = xScale.bandwidth();
|
|
14
24
|
const height = yScale.bandwidth();
|
|
15
25
|
const colorScale = (0, _hooks.useZColorScale)();
|
|
16
26
|
const store = (0, _internals.useStore)();
|
|
17
27
|
const getHighlightState = store.use(_internals.selectorChartsHighlightStateCallback);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
28
|
+
|
|
29
|
+
/* Colors only change when series data or color scale changes. Cached so resize/highlight
|
|
30
|
+
* renders don't re-upload the colors buffer.
|
|
31
|
+
* Stored as Uint8 (1 byte per channel) — 4x less GPU traffic than Float32 RGBA. */
|
|
32
|
+
const colors = React.useMemo(() => {
|
|
33
|
+
const out = new Uint8Array(series.data.length * 4);
|
|
24
34
|
for (let dataIndex = 0; dataIndex < series.data.length; dataIndex += 1) {
|
|
25
|
-
const
|
|
26
|
-
const x = xScale(xDomain[xIndex]);
|
|
27
|
-
const y = yScale(yDomain[yIndex]);
|
|
35
|
+
const value = series.data[dataIndex][2];
|
|
28
36
|
const color = colorScale?.(value);
|
|
29
|
-
if (
|
|
37
|
+
if (!color) {
|
|
38
|
+
/* Alpha 0 hides the rect; src-alpha blending makes RGB irrelevant. */
|
|
30
39
|
continue;
|
|
31
40
|
}
|
|
32
|
-
centers[dataIndex * 2] = x + width / 2 - drawingArea.left;
|
|
33
|
-
centers[dataIndex * 2 + 1] = y + height / 2 - drawingArea.top;
|
|
34
41
|
const rgbColor = (0, _parseColor.parseColor)(color);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
out[dataIndex * 4] = rgbColor[0];
|
|
43
|
+
out[dataIndex * 4 + 1] = rgbColor[1];
|
|
44
|
+
out[dataIndex * 4 + 2] = rgbColor[2];
|
|
45
|
+
out[dataIndex * 4 + 3] = 255;
|
|
46
|
+
}
|
|
47
|
+
return out;
|
|
48
|
+
}, [colorScale, series.data]);
|
|
49
|
+
|
|
50
|
+
/* Saturations only change with highlight state. Pooled so highlight churn doesn't
|
|
51
|
+
* allocate per change. */
|
|
52
|
+
const saturationsPoolRef = React.useRef(null);
|
|
53
|
+
const saturations = React.useMemo(() => {
|
|
54
|
+
const n = series.data.length;
|
|
55
|
+
const pool = ensurePoolFloat32(saturationsPoolRef.current ?? undefined, n);
|
|
56
|
+
saturationsPoolRef.current = pool;
|
|
57
|
+
for (let dataIndex = 0; dataIndex < n; dataIndex += 1) {
|
|
58
|
+
const item = series.data[dataIndex];
|
|
39
59
|
const highlightState = getHighlightState({
|
|
40
60
|
type: 'heatmap',
|
|
41
61
|
seriesId: series.id,
|
|
42
|
-
xIndex,
|
|
43
|
-
yIndex
|
|
62
|
+
xIndex: item[0],
|
|
63
|
+
yIndex: item[1]
|
|
44
64
|
});
|
|
65
|
+
let saturation = 0;
|
|
45
66
|
if (highlightState === 'highlighted') {
|
|
46
|
-
|
|
67
|
+
saturation = 0.2;
|
|
47
68
|
} else if (highlightState === 'faded') {
|
|
48
|
-
|
|
69
|
+
saturation = -0.2;
|
|
70
|
+
}
|
|
71
|
+
pool[dataIndex] = saturation;
|
|
72
|
+
}
|
|
73
|
+
/* Subarray gives a fresh identity over the same bytes — upload short-circuit fires. */
|
|
74
|
+
return pool.subarray(0, n);
|
|
75
|
+
}, [getHighlightState, series.data, series.id]);
|
|
76
|
+
|
|
77
|
+
/* Positions change on resize (drawing area / band width). Pooled to avoid per-frame
|
|
78
|
+
* allocation. Subarray view gives a fresh identity each call so the upload still runs. */
|
|
79
|
+
const centersPoolRef = React.useRef(null);
|
|
80
|
+
const centers = React.useMemo(() => {
|
|
81
|
+
const n = series.data.length;
|
|
82
|
+
const pool = ensurePoolFloat32(centersPoolRef.current ?? undefined, n * 2);
|
|
83
|
+
centersPoolRef.current = pool;
|
|
84
|
+
const left = drawingArea.left;
|
|
85
|
+
const top = drawingArea.top;
|
|
86
|
+
const halfWidth = width / 2;
|
|
87
|
+
const halfHeight = height / 2;
|
|
88
|
+
const xDomain = xScale.domain();
|
|
89
|
+
const yDomain = yScale.domain();
|
|
90
|
+
for (let dataIndex = 0; dataIndex < n; dataIndex += 1) {
|
|
91
|
+
const item = series.data[dataIndex];
|
|
92
|
+
const x = xScale(xDomain[item[0]]);
|
|
93
|
+
const y = yScale(yDomain[item[1]]);
|
|
94
|
+
if (x === undefined || y === undefined) {
|
|
95
|
+
pool[dataIndex * 2] = OFFSCREEN;
|
|
96
|
+
pool[dataIndex * 2 + 1] = OFFSCREEN;
|
|
97
|
+
continue;
|
|
49
98
|
}
|
|
99
|
+
pool[dataIndex * 2] = x + halfWidth - left;
|
|
100
|
+
pool[dataIndex * 2 + 1] = y + halfHeight - top;
|
|
50
101
|
}
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
102
|
+
return pool.subarray(0, n * 2);
|
|
103
|
+
}, [drawingArea.left, drawingArea.top, height, series.data, width, xScale, yScale]);
|
|
104
|
+
return React.useMemo(() => ({
|
|
105
|
+
centers,
|
|
106
|
+
colors,
|
|
107
|
+
saturations
|
|
108
|
+
}), [centers, colors, saturations]);
|
|
57
109
|
}
|
|
@@ -1,50 +1,104 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import * as React from 'react';
|
|
2
4
|
import { useZColorScale } from '@mui/x-charts/hooks';
|
|
3
5
|
import { selectorChartsHighlightStateCallback, useStore } from '@mui/x-charts/internals';
|
|
4
6
|
import { parseColor } from "../../utils/webgl/parseColor.mjs";
|
|
7
|
+
|
|
8
|
+
/* Far enough off-canvas that the rect is never visible; used for invalid x/y entries.
|
|
9
|
+
* Avoids coupling the position pass to the color/saturation passes. */
|
|
10
|
+
const OFFSCREEN = -1e9;
|
|
11
|
+
function ensurePoolFloat32(pool, n) {
|
|
12
|
+
if (pool && pool.length >= n) {
|
|
13
|
+
return pool;
|
|
14
|
+
}
|
|
15
|
+
return new Float32Array(n);
|
|
16
|
+
}
|
|
5
17
|
export function useHeatmapPlotData(drawingArea, series, xScale, yScale) {
|
|
6
18
|
const width = xScale.bandwidth();
|
|
7
19
|
const height = yScale.bandwidth();
|
|
8
20
|
const colorScale = useZColorScale();
|
|
9
21
|
const store = useStore();
|
|
10
22
|
const getHighlightState = store.use(selectorChartsHighlightStateCallback);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
23
|
+
|
|
24
|
+
/* Colors only change when series data or color scale changes. Cached so resize/highlight
|
|
25
|
+
* renders don't re-upload the colors buffer.
|
|
26
|
+
* Stored as Uint8 (1 byte per channel) — 4x less GPU traffic than Float32 RGBA. */
|
|
27
|
+
const colors = React.useMemo(() => {
|
|
28
|
+
const out = new Uint8Array(series.data.length * 4);
|
|
17
29
|
for (let dataIndex = 0; dataIndex < series.data.length; dataIndex += 1) {
|
|
18
|
-
const
|
|
19
|
-
const x = xScale(xDomain[xIndex]);
|
|
20
|
-
const y = yScale(yDomain[yIndex]);
|
|
30
|
+
const value = series.data[dataIndex][2];
|
|
21
31
|
const color = colorScale?.(value);
|
|
22
|
-
if (
|
|
32
|
+
if (!color) {
|
|
33
|
+
/* Alpha 0 hides the rect; src-alpha blending makes RGB irrelevant. */
|
|
23
34
|
continue;
|
|
24
35
|
}
|
|
25
|
-
centers[dataIndex * 2] = x + width / 2 - drawingArea.left;
|
|
26
|
-
centers[dataIndex * 2 + 1] = y + height / 2 - drawingArea.top;
|
|
27
36
|
const rgbColor = parseColor(color);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
out[dataIndex * 4] = rgbColor[0];
|
|
38
|
+
out[dataIndex * 4 + 1] = rgbColor[1];
|
|
39
|
+
out[dataIndex * 4 + 2] = rgbColor[2];
|
|
40
|
+
out[dataIndex * 4 + 3] = 255;
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
43
|
+
}, [colorScale, series.data]);
|
|
44
|
+
|
|
45
|
+
/* Saturations only change with highlight state. Pooled so highlight churn doesn't
|
|
46
|
+
* allocate per change. */
|
|
47
|
+
const saturationsPoolRef = React.useRef(null);
|
|
48
|
+
const saturations = React.useMemo(() => {
|
|
49
|
+
const n = series.data.length;
|
|
50
|
+
const pool = ensurePoolFloat32(saturationsPoolRef.current ?? undefined, n);
|
|
51
|
+
saturationsPoolRef.current = pool;
|
|
52
|
+
for (let dataIndex = 0; dataIndex < n; dataIndex += 1) {
|
|
53
|
+
const item = series.data[dataIndex];
|
|
32
54
|
const highlightState = getHighlightState({
|
|
33
55
|
type: 'heatmap',
|
|
34
56
|
seriesId: series.id,
|
|
35
|
-
xIndex,
|
|
36
|
-
yIndex
|
|
57
|
+
xIndex: item[0],
|
|
58
|
+
yIndex: item[1]
|
|
37
59
|
});
|
|
60
|
+
let saturation = 0;
|
|
38
61
|
if (highlightState === 'highlighted') {
|
|
39
|
-
|
|
62
|
+
saturation = 0.2;
|
|
40
63
|
} else if (highlightState === 'faded') {
|
|
41
|
-
|
|
64
|
+
saturation = -0.2;
|
|
65
|
+
}
|
|
66
|
+
pool[dataIndex] = saturation;
|
|
67
|
+
}
|
|
68
|
+
/* Subarray gives a fresh identity over the same bytes — upload short-circuit fires. */
|
|
69
|
+
return pool.subarray(0, n);
|
|
70
|
+
}, [getHighlightState, series.data, series.id]);
|
|
71
|
+
|
|
72
|
+
/* Positions change on resize (drawing area / band width). Pooled to avoid per-frame
|
|
73
|
+
* allocation. Subarray view gives a fresh identity each call so the upload still runs. */
|
|
74
|
+
const centersPoolRef = React.useRef(null);
|
|
75
|
+
const centers = React.useMemo(() => {
|
|
76
|
+
const n = series.data.length;
|
|
77
|
+
const pool = ensurePoolFloat32(centersPoolRef.current ?? undefined, n * 2);
|
|
78
|
+
centersPoolRef.current = pool;
|
|
79
|
+
const left = drawingArea.left;
|
|
80
|
+
const top = drawingArea.top;
|
|
81
|
+
const halfWidth = width / 2;
|
|
82
|
+
const halfHeight = height / 2;
|
|
83
|
+
const xDomain = xScale.domain();
|
|
84
|
+
const yDomain = yScale.domain();
|
|
85
|
+
for (let dataIndex = 0; dataIndex < n; dataIndex += 1) {
|
|
86
|
+
const item = series.data[dataIndex];
|
|
87
|
+
const x = xScale(xDomain[item[0]]);
|
|
88
|
+
const y = yScale(yDomain[item[1]]);
|
|
89
|
+
if (x === undefined || y === undefined) {
|
|
90
|
+
pool[dataIndex * 2] = OFFSCREEN;
|
|
91
|
+
pool[dataIndex * 2 + 1] = OFFSCREEN;
|
|
92
|
+
continue;
|
|
42
93
|
}
|
|
94
|
+
pool[dataIndex * 2] = x + halfWidth - left;
|
|
95
|
+
pool[dataIndex * 2 + 1] = y + halfHeight - top;
|
|
43
96
|
}
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
97
|
+
return pool.subarray(0, n * 2);
|
|
98
|
+
}, [drawingArea.left, drawingArea.top, height, series.data, width, xScale, yScale]);
|
|
99
|
+
return React.useMemo(() => ({
|
|
100
|
+
centers,
|
|
101
|
+
colors,
|
|
102
|
+
saturations
|
|
103
|
+
}), [centers, colors, saturations]);
|
|
50
104
|
}
|
package/LICENSE
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
1
3
|
Commercial License
|
|
2
4
|
|
|
3
5
|
Copyright (c) 2020 Material-UI SAS
|
|
4
6
|
|
|
5
|
-
MUI
|
|
7
|
+
MUI X Premium (https://mui.com/pricing/) is commercial software. You MUST agree to the
|
|
6
8
|
End User License Agreement (EULA: https://mui.com/r/x-license-eula) to be able to
|
|
7
9
|
use the software.
|
|
8
10
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { type ChartsSlots, type ChartsSlotProps } from '@mui/x-charts/internals';
|
|
4
|
+
import { type ChartsRadialGridProps } from '@mui/x-charts/ChartsRadialGrid';
|
|
5
|
+
import { type ChartsLegendSlots, type ChartsLegendSlotProps } from "../ChartsLegend/index.mjs";
|
|
6
|
+
import { type ChartsTooltipSlots, type ChartsTooltipSlotProps } from "../ChartsTooltip/index.mjs";
|
|
7
|
+
import { type ChartsOverlayProps, type ChartsOverlaySlots, type ChartsOverlaySlotProps } from "../ChartsOverlay/index.mjs";
|
|
8
|
+
import { type ChartsToolbarSlots, type ChartsToolbarSlotProps } from "../Toolbar/index.mjs";
|
|
9
|
+
import { type ChartsRadialDataProviderPremiumProps } from "../ChartsRadialDataProviderPremium/index.mjs";
|
|
10
|
+
import type { RadialBarSeriesType } from "../models/seriesType/radialBar.mjs";
|
|
11
|
+
import { type RadialBarChartPluginSignatures } from "./RadialBarChart.plugins.mjs";
|
|
12
|
+
export type RadialBarSeries = MakeOptional<RadialBarSeriesType, 'type'>;
|
|
13
|
+
export interface RadialBarChartSlots extends ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
14
|
+
export interface RadialBarChartSlotProps extends ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
15
|
+
export interface RadialBarChartProps extends Omit<ChartsRadialDataProviderPremiumProps<'radialBar', RadialBarChartPluginSignatures>, 'series' | 'plugins' | 'zAxis' | 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
16
|
+
/**
|
|
17
|
+
* The series to display in the radial bar chart.
|
|
18
|
+
* An array of [[RadialBarSeries]] objects.
|
|
19
|
+
*/
|
|
20
|
+
series: Readonly<RadialBarSeries[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Option to display a radial grid in the background.
|
|
23
|
+
*/
|
|
24
|
+
grid?: Pick<ChartsRadialGridProps, 'radius' | 'rotation'>;
|
|
25
|
+
/**
|
|
26
|
+
* If `true`, the legend is not rendered.
|
|
27
|
+
*/
|
|
28
|
+
hideLegend?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Overridable component slots.
|
|
31
|
+
* @default {}
|
|
32
|
+
*/
|
|
33
|
+
slots?: RadialBarChartSlots;
|
|
34
|
+
/**
|
|
35
|
+
* The props used for each component slot.
|
|
36
|
+
* @default {}
|
|
37
|
+
*/
|
|
38
|
+
slotProps?: RadialBarChartSlotProps;
|
|
39
|
+
/**
|
|
40
|
+
* If `true`, animations are skipped.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
skipAnimation?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* If true, shows the default chart toolbar.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
showToolbar?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Demos:
|
|
52
|
+
*
|
|
53
|
+
* - [Radial bar demonstration](https://mui.com/x/react-charts/radial-bar/)
|
|
54
|
+
*
|
|
55
|
+
* API:
|
|
56
|
+
*
|
|
57
|
+
* - [RadialBarChart API](https://mui.com/x/api/charts/radial-bar-chart/)
|
|
58
|
+
*/
|
|
59
|
+
declare const RadialBarChart: React.ForwardRefExoticComponent<RadialBarChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
export { RadialBarChart as Unstable_RadialBarChart };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { type ChartsSlots, type ChartsSlotProps } from '@mui/x-charts/internals';
|
|
4
|
+
import { type ChartsRadialGridProps } from '@mui/x-charts/ChartsRadialGrid';
|
|
5
|
+
import { type ChartsLegendSlots, type ChartsLegendSlotProps } from "../ChartsLegend/index.js";
|
|
6
|
+
import { type ChartsTooltipSlots, type ChartsTooltipSlotProps } from "../ChartsTooltip/index.js";
|
|
7
|
+
import { type ChartsOverlayProps, type ChartsOverlaySlots, type ChartsOverlaySlotProps } from "../ChartsOverlay/index.js";
|
|
8
|
+
import { type ChartsToolbarSlots, type ChartsToolbarSlotProps } from "../Toolbar/index.js";
|
|
9
|
+
import { type ChartsRadialDataProviderPremiumProps } from "../ChartsRadialDataProviderPremium/index.js";
|
|
10
|
+
import type { RadialBarSeriesType } from "../models/seriesType/radialBar.js";
|
|
11
|
+
import { type RadialBarChartPluginSignatures } from "./RadialBarChart.plugins.js";
|
|
12
|
+
export type RadialBarSeries = MakeOptional<RadialBarSeriesType, 'type'>;
|
|
13
|
+
export interface RadialBarChartSlots extends ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
14
|
+
export interface RadialBarChartSlotProps extends ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
15
|
+
export interface RadialBarChartProps extends Omit<ChartsRadialDataProviderPremiumProps<'radialBar', RadialBarChartPluginSignatures>, 'series' | 'plugins' | 'zAxis' | 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
16
|
+
/**
|
|
17
|
+
* The series to display in the radial bar chart.
|
|
18
|
+
* An array of [[RadialBarSeries]] objects.
|
|
19
|
+
*/
|
|
20
|
+
series: Readonly<RadialBarSeries[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Option to display a radial grid in the background.
|
|
23
|
+
*/
|
|
24
|
+
grid?: Pick<ChartsRadialGridProps, 'radius' | 'rotation'>;
|
|
25
|
+
/**
|
|
26
|
+
* If `true`, the legend is not rendered.
|
|
27
|
+
*/
|
|
28
|
+
hideLegend?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Overridable component slots.
|
|
31
|
+
* @default {}
|
|
32
|
+
*/
|
|
33
|
+
slots?: RadialBarChartSlots;
|
|
34
|
+
/**
|
|
35
|
+
* The props used for each component slot.
|
|
36
|
+
* @default {}
|
|
37
|
+
*/
|
|
38
|
+
slotProps?: RadialBarChartSlotProps;
|
|
39
|
+
/**
|
|
40
|
+
* If `true`, animations are skipped.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
skipAnimation?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* If true, shows the default chart toolbar.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
showToolbar?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Demos:
|
|
52
|
+
*
|
|
53
|
+
* - [Radial bar demonstration](https://mui.com/x/react-charts/radial-bar/)
|
|
54
|
+
*
|
|
55
|
+
* API:
|
|
56
|
+
*
|
|
57
|
+
* - [RadialBarChart API](https://mui.com/x/api/charts/radial-bar-chart/)
|
|
58
|
+
*/
|
|
59
|
+
declare const RadialBarChart: React.ForwardRefExoticComponent<RadialBarChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
60
|
+
export { RadialBarChart as Unstable_RadialBarChart };
|