@mui/x-charts-premium 9.0.4 → 9.2.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.d.mts +4 -1
- package/BarChartPremium/BarChartPremium.d.ts +4 -1
- package/BarChartPremium/BarChartPremium.js +23 -1191
- package/BarChartPremium/BarChartPremium.mjs +24 -1192
- package/BarChartPremium/BarPlotPremium.d.mts +37 -0
- package/BarChartPremium/BarPlotPremium.d.ts +37 -0
- package/BarChartPremium/BarPlotPremium.js +78 -0
- package/BarChartPremium/BarPlotPremium.mjs +72 -0
- package/BarChartPremium/RangeBar/seriesConfig/seriesProcessor.js +2 -0
- package/BarChartPremium/RangeBar/seriesConfig/seriesProcessor.mjs +2 -0
- package/BarChartPremium/RangeBar/useUtilityClasses.d.mts +1 -1
- package/BarChartPremium/RangeBar/useUtilityClasses.d.ts +1 -1
- package/BarChartPremium/index.d.mts +1 -0
- package/BarChartPremium/index.d.ts +1 -0
- package/BarChartPremium/index.js +12 -0
- package/BarChartPremium/index.mjs +1 -0
- package/BarChartPremium/useBarChartPremiumProps.d.mts +2 -1
- package/BarChartPremium/useBarChartPremiumProps.d.ts +2 -1
- package/BarChartPremium/useBarChartPremiumProps.js +39 -5
- package/BarChartPremium/useBarChartPremiumProps.mjs +39 -5
- package/BarChartPremium/webgl/BarWebGLPlot.d.mts +10 -0
- package/BarChartPremium/webgl/BarWebGLPlot.d.ts +10 -0
- package/BarChartPremium/webgl/BarWebGLPlot.js +81 -0
- package/BarChartPremium/webgl/BarWebGLPlot.mjs +75 -0
- package/BarChartPremium/webgl/BarWebGLProgram.d.mts +19 -0
- package/BarChartPremium/webgl/BarWebGLProgram.d.ts +19 -0
- package/BarChartPremium/webgl/BarWebGLProgram.js +107 -0
- package/BarChartPremium/webgl/BarWebGLProgram.mjs +100 -0
- package/BarChartPremium/webgl/shaders.d.mts +2 -0
- package/BarChartPremium/webgl/shaders.d.ts +2 -0
- package/BarChartPremium/webgl/shaders.js +69 -0
- package/BarChartPremium/webgl/shaders.mjs +63 -0
- package/BarChartPremium/webgl/useBarWebGLPlotData.d.mts +10 -0
- package/BarChartPremium/webgl/useBarWebGLPlotData.d.ts +10 -0
- package/BarChartPremium/webgl/useBarWebGLPlotData.js +160 -0
- package/BarChartPremium/webgl/useBarWebGLPlotData.mjs +154 -0
- package/CHANGELOG.md +236 -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 +9 -3
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.mjs +9 -3
- 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 +67 -0
- package/RadialBarChart/RadialBarChart.d.ts +67 -0
- package/RadialBarChart/RadialBarChart.js +311 -0
- package/RadialBarChart/RadialBarChart.mjs +305 -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 +68 -0
- package/RadialBarChart/RadialBarElement.mjs +62 -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/axisTooltipGetter.js +5 -2
- package/RadialBarChart/seriesConfig/axisTooltipGetter.mjs +5 -2
- package/RadialBarChart/seriesConfig/getItemAtPosition.d.mts +6 -0
- package/RadialBarChart/seriesConfig/getItemAtPosition.d.ts +6 -0
- package/RadialBarChart/seriesConfig/getItemAtPosition.js +69 -0
- package/RadialBarChart/seriesConfig/getItemAtPosition.mjs +63 -0
- package/RadialBarChart/seriesConfig/index.js +2 -1
- package/RadialBarChart/seriesConfig/index.mjs +2 -1
- package/RadialBarChart/seriesConfig/seriesProcessor.js +4 -0
- package/RadialBarChart/seriesConfig/seriesProcessor.mjs +4 -0
- package/RadialBarChart/useRadialBarChartProps.d.mts +30 -0
- package/RadialBarChart/useRadialBarChartProps.d.ts +30 -0
- package/RadialBarChart/useRadialBarChartProps.js +108 -0
- package/RadialBarChart/useRadialBarChartProps.mjs +101 -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 +26 -673
- package/RadialLineChart/RadialLineChart.mjs +26 -673
- package/RadialLineChart/RadialLineChart.plugins.d.mts +1 -1
- package/RadialLineChart/RadialLineChart.plugins.d.ts +1 -1
- package/RadialLineChart/RadialLineChart.plugins.js +1 -1
- package/RadialLineChart/RadialLineChart.plugins.mjs +1 -1
- 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 +76 -6
- 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,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type BarPlotProps, type BarPlotSlotProps, type BarPlotSlots } from '@mui/x-charts/BarChart';
|
|
3
|
+
import type { RendererType } from '@mui/x-charts/ScatterChart';
|
|
4
|
+
export type BarPlotPremiumRenderer = RendererType | 'webgl';
|
|
5
|
+
export interface BarPlotPremiumSlots extends BarPlotSlots {}
|
|
6
|
+
export interface BarPlotPremiumSlotProps extends BarPlotSlotProps {}
|
|
7
|
+
export interface BarPlotPremiumProps extends Omit<BarPlotProps, 'renderer' | 'slots' | 'slotProps'> {
|
|
8
|
+
/**
|
|
9
|
+
* Overridable component slots.
|
|
10
|
+
* @default {}
|
|
11
|
+
*/
|
|
12
|
+
slots?: BarPlotPremiumSlots;
|
|
13
|
+
/**
|
|
14
|
+
* The props used for each component slot.
|
|
15
|
+
* @default {}
|
|
16
|
+
*/
|
|
17
|
+
slotProps?: BarPlotPremiumSlotProps;
|
|
18
|
+
/**
|
|
19
|
+
* The type of renderer to use for the bar plot.
|
|
20
|
+
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
21
|
+
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
22
|
+
* - `webgl`: Renders bars using WebGL for better performance with very large datasets, at the cost of some limitations.
|
|
23
|
+
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
24
|
+
*
|
|
25
|
+
* @default 'svg-single'
|
|
26
|
+
*/
|
|
27
|
+
renderer?: BarPlotPremiumRenderer;
|
|
28
|
+
}
|
|
29
|
+
declare function BarPlotPremium({
|
|
30
|
+
renderer,
|
|
31
|
+
borderRadius,
|
|
32
|
+
...other
|
|
33
|
+
}: BarPlotPremiumProps): React.JSX.Element;
|
|
34
|
+
declare namespace BarPlotPremium {
|
|
35
|
+
var propTypes: any;
|
|
36
|
+
}
|
|
37
|
+
export { BarPlotPremium };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type BarPlotProps, type BarPlotSlotProps, type BarPlotSlots } from '@mui/x-charts/BarChart';
|
|
3
|
+
import type { RendererType } from '@mui/x-charts/ScatterChart';
|
|
4
|
+
export type BarPlotPremiumRenderer = RendererType | 'webgl';
|
|
5
|
+
export interface BarPlotPremiumSlots extends BarPlotSlots {}
|
|
6
|
+
export interface BarPlotPremiumSlotProps extends BarPlotSlotProps {}
|
|
7
|
+
export interface BarPlotPremiumProps extends Omit<BarPlotProps, 'renderer' | 'slots' | 'slotProps'> {
|
|
8
|
+
/**
|
|
9
|
+
* Overridable component slots.
|
|
10
|
+
* @default {}
|
|
11
|
+
*/
|
|
12
|
+
slots?: BarPlotPremiumSlots;
|
|
13
|
+
/**
|
|
14
|
+
* The props used for each component slot.
|
|
15
|
+
* @default {}
|
|
16
|
+
*/
|
|
17
|
+
slotProps?: BarPlotPremiumSlotProps;
|
|
18
|
+
/**
|
|
19
|
+
* The type of renderer to use for the bar plot.
|
|
20
|
+
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
21
|
+
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
22
|
+
* - `webgl`: Renders bars using WebGL for better performance with very large datasets, at the cost of some limitations.
|
|
23
|
+
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
24
|
+
*
|
|
25
|
+
* @default 'svg-single'
|
|
26
|
+
*/
|
|
27
|
+
renderer?: BarPlotPremiumRenderer;
|
|
28
|
+
}
|
|
29
|
+
declare function BarPlotPremium({
|
|
30
|
+
renderer,
|
|
31
|
+
borderRadius,
|
|
32
|
+
...other
|
|
33
|
+
}: BarPlotPremiumProps): React.JSX.Element;
|
|
34
|
+
declare namespace BarPlotPremium {
|
|
35
|
+
var propTypes: any;
|
|
36
|
+
}
|
|
37
|
+
export { BarPlotPremium };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.BarPlotPremium = BarPlotPremium;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _BarChart = require("@mui/x-charts/BarChart");
|
|
15
|
+
var _BarWebGLPlot = require("./webgl/BarWebGLPlot");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
const _excluded = ["renderer", "borderRadius"];
|
|
18
|
+
function BarPlotPremium(_ref) {
|
|
19
|
+
let {
|
|
20
|
+
renderer,
|
|
21
|
+
borderRadius
|
|
22
|
+
} = _ref,
|
|
23
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
24
|
+
if (renderer === 'webgl') {
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarWebGLPlot.BarWebGLPlot, {
|
|
26
|
+
borderRadius: borderRadius
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, (0, _extends2.default)({
|
|
30
|
+
renderer: renderer,
|
|
31
|
+
borderRadius: borderRadius
|
|
32
|
+
}, other));
|
|
33
|
+
}
|
|
34
|
+
process.env.NODE_ENV !== "production" ? BarPlotPremium.propTypes = {
|
|
35
|
+
// ----------------------------- Warning --------------------------------
|
|
36
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
37
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
38
|
+
// ----------------------------------------------------------------------
|
|
39
|
+
/**
|
|
40
|
+
* Defines the border radius of the bar element.
|
|
41
|
+
*/
|
|
42
|
+
borderRadius: _propTypes.default.number,
|
|
43
|
+
/**
|
|
44
|
+
* A CSS class name applied to the root element.
|
|
45
|
+
*/
|
|
46
|
+
className: _propTypes.default.string,
|
|
47
|
+
/**
|
|
48
|
+
* Callback fired when a bar item is clicked.
|
|
49
|
+
* @param {MouseEvent} event The event source of the callback.
|
|
50
|
+
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
51
|
+
*/
|
|
52
|
+
onItemClick: _propTypes.default.func,
|
|
53
|
+
/**
|
|
54
|
+
* The type of renderer to use for the bar plot.
|
|
55
|
+
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
56
|
+
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
57
|
+
* - `webgl`: Renders bars using WebGL for better performance with very large datasets, at the cost of some limitations.
|
|
58
|
+
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
59
|
+
*
|
|
60
|
+
* @default 'svg-single'
|
|
61
|
+
*/
|
|
62
|
+
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-single', 'webgl']),
|
|
63
|
+
/**
|
|
64
|
+
* If `true`, animations are skipped.
|
|
65
|
+
* @default undefined
|
|
66
|
+
*/
|
|
67
|
+
skipAnimation: _propTypes.default.bool,
|
|
68
|
+
/**
|
|
69
|
+
* The props used for each component slot.
|
|
70
|
+
* @default {}
|
|
71
|
+
*/
|
|
72
|
+
slotProps: _propTypes.default.object,
|
|
73
|
+
/**
|
|
74
|
+
* Overridable component slots.
|
|
75
|
+
* @default {}
|
|
76
|
+
*/
|
|
77
|
+
slots: _propTypes.default.object
|
|
78
|
+
} : void 0;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["renderer", "borderRadius"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { BarPlot } from '@mui/x-charts/BarChart';
|
|
9
|
+
import { BarWebGLPlot } from "./webgl/BarWebGLPlot.mjs";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
function BarPlotPremium(_ref) {
|
|
12
|
+
let {
|
|
13
|
+
renderer,
|
|
14
|
+
borderRadius
|
|
15
|
+
} = _ref,
|
|
16
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
17
|
+
if (renderer === 'webgl') {
|
|
18
|
+
return /*#__PURE__*/_jsx(BarWebGLPlot, {
|
|
19
|
+
borderRadius: borderRadius
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return /*#__PURE__*/_jsx(BarPlot, _extends({
|
|
23
|
+
renderer: renderer,
|
|
24
|
+
borderRadius: borderRadius
|
|
25
|
+
}, other));
|
|
26
|
+
}
|
|
27
|
+
process.env.NODE_ENV !== "production" ? BarPlotPremium.propTypes = {
|
|
28
|
+
// ----------------------------- Warning --------------------------------
|
|
29
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
30
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
31
|
+
// ----------------------------------------------------------------------
|
|
32
|
+
/**
|
|
33
|
+
* Defines the border radius of the bar element.
|
|
34
|
+
*/
|
|
35
|
+
borderRadius: PropTypes.number,
|
|
36
|
+
/**
|
|
37
|
+
* A CSS class name applied to the root element.
|
|
38
|
+
*/
|
|
39
|
+
className: PropTypes.string,
|
|
40
|
+
/**
|
|
41
|
+
* Callback fired when a bar item is clicked.
|
|
42
|
+
* @param {MouseEvent} event The event source of the callback.
|
|
43
|
+
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
44
|
+
*/
|
|
45
|
+
onItemClick: PropTypes.func,
|
|
46
|
+
/**
|
|
47
|
+
* The type of renderer to use for the bar plot.
|
|
48
|
+
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
49
|
+
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
50
|
+
* - `webgl`: Renders bars using WebGL for better performance with very large datasets, at the cost of some limitations.
|
|
51
|
+
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
52
|
+
*
|
|
53
|
+
* @default 'svg-single'
|
|
54
|
+
*/
|
|
55
|
+
renderer: PropTypes.oneOf(['svg-batch', 'svg-single', 'webgl']),
|
|
56
|
+
/**
|
|
57
|
+
* If `true`, animations are skipped.
|
|
58
|
+
* @default undefined
|
|
59
|
+
*/
|
|
60
|
+
skipAnimation: PropTypes.bool,
|
|
61
|
+
/**
|
|
62
|
+
* The props used for each component slot.
|
|
63
|
+
* @default {}
|
|
64
|
+
*/
|
|
65
|
+
slotProps: PropTypes.object,
|
|
66
|
+
/**
|
|
67
|
+
* Overridable component slots.
|
|
68
|
+
* @default {}
|
|
69
|
+
*/
|
|
70
|
+
slots: PropTypes.object
|
|
71
|
+
} : void 0;
|
|
72
|
+
export { BarPlotPremium };
|
|
@@ -19,6 +19,8 @@ const seriesProcessor = (params, dataset, isItemVisible) => {
|
|
|
19
19
|
const seriesData = series[id];
|
|
20
20
|
const datasetKeys = seriesData?.datasetKeys;
|
|
21
21
|
if (seriesData.data === undefined && dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
22
|
+
// TODO: fix mui/no-guarded-throw
|
|
23
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
22
24
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: range bar series with id='${id}' has no data.
|
|
23
25
|
Either provide a data property to the series or use the dataset prop.` : (0, _formatErrorMessage2.default)(44, id));
|
|
24
26
|
}
|
|
@@ -12,6 +12,8 @@ const seriesProcessor = (params, dataset, isItemVisible) => {
|
|
|
12
12
|
const seriesData = series[id];
|
|
13
13
|
const datasetKeys = seriesData?.datasetKeys;
|
|
14
14
|
if (seriesData.data === undefined && dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
15
|
+
// TODO: fix mui/no-guarded-throw
|
|
16
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
15
17
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: range bar series with id='${id}' has no data.
|
|
16
18
|
Either provide a data property to the series or use the dataset prop.` : _formatErrorMessage(44, id));
|
|
17
19
|
}
|
|
@@ -9,4 +9,4 @@ export interface RangeBarClasses {
|
|
|
9
9
|
export type RangeBarClassKey = keyof RangeBarClasses;
|
|
10
10
|
export declare function getRangeBarUtilityClass(slot: string): string;
|
|
11
11
|
export declare const rangeBarClasses: RangeBarClasses;
|
|
12
|
-
export declare const useUtilityClasses: (classes?: Partial<RangeBarClasses>) => Record<"
|
|
12
|
+
export declare const useUtilityClasses: (classes?: Partial<RangeBarClasses>) => Record<"root" | "series" | "seriesLabels", string>;
|
|
@@ -9,4 +9,4 @@ export interface RangeBarClasses {
|
|
|
9
9
|
export type RangeBarClassKey = keyof RangeBarClasses;
|
|
10
10
|
export declare function getRangeBarUtilityClass(slot: string): string;
|
|
11
11
|
export declare const rangeBarClasses: RangeBarClasses;
|
|
12
|
-
export declare const useUtilityClasses: (classes?: Partial<RangeBarClasses>) => Record<"
|
|
12
|
+
export declare const useUtilityClasses: (classes?: Partial<RangeBarClasses>) => Record<"root" | "series" | "seriesLabels", string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./BarChartPremium.mjs";
|
|
2
2
|
export * from "./BarChartPremium.plugins.mjs";
|
|
3
|
+
export * from "./BarPlotPremium.mjs";
|
|
3
4
|
export * from "./RangeBar/RangeBarPlot.mjs";
|
|
4
5
|
export * from "./RangeBar/FocusedRangeBar.mjs";
|
|
5
6
|
export { rangeBarClasses, type RangeBarClasses, type RangeBarClassKey } from "./RangeBar/useUtilityClasses.mjs";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./BarChartPremium.js";
|
|
2
2
|
export * from "./BarChartPremium.plugins.js";
|
|
3
|
+
export * from "./BarPlotPremium.js";
|
|
3
4
|
export * from "./RangeBar/RangeBarPlot.js";
|
|
4
5
|
export * from "./RangeBar/FocusedRangeBar.js";
|
|
5
6
|
export { rangeBarClasses, type RangeBarClasses, type RangeBarClassKey } from "./RangeBar/useUtilityClasses.js";
|
package/BarChartPremium/index.js
CHANGED
|
@@ -36,6 +36,18 @@ Object.keys(_BarChartPremium2).forEach(function (key) {
|
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
});
|
|
39
|
+
var _BarPlotPremium = require("./BarPlotPremium");
|
|
40
|
+
Object.keys(_BarPlotPremium).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
43
|
+
if (key in exports && exports[key] === _BarPlotPremium[key]) return;
|
|
44
|
+
Object.defineProperty(exports, key, {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return _BarPlotPremium[key];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
39
51
|
var _RangeBarPlot = require("./RangeBar/RangeBarPlot");
|
|
40
52
|
Object.keys(_RangeBarPlot).forEach(function (key) {
|
|
41
53
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./BarChartPremium.mjs";
|
|
2
2
|
export * from "./BarChartPremium.plugins.mjs";
|
|
3
|
+
export * from "./BarPlotPremium.mjs";
|
|
3
4
|
export * from "./RangeBar/RangeBarPlot.mjs";
|
|
4
5
|
export * from "./RangeBar/FocusedRangeBar.mjs";
|
|
5
6
|
export { rangeBarClasses } from "./RangeBar/useUtilityClasses.mjs";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type BarChartPluginSignatures } from '@mui/x-charts/BarChart';
|
|
2
2
|
import { type ChartsContainerProps } from '@mui/x-charts/ChartsContainer';
|
|
3
3
|
import { type BarChartPremiumProps } from "./BarChartPremium.mjs";
|
|
4
|
+
import { type BarPlotPremiumProps } from "./BarPlotPremium.mjs";
|
|
4
5
|
import { type RangeBarPlotProps } from "./RangeBar/RangeBarPlot.mjs";
|
|
5
6
|
/**
|
|
6
7
|
* A helper function that extracts BarChartPremiumProps from the input props
|
|
@@ -11,9 +12,9 @@ import { type RangeBarPlotProps } from "./RangeBar/RangeBarPlot.mjs";
|
|
|
11
12
|
*/
|
|
12
13
|
export declare function useBarChartPremiumProps(props: BarChartPremiumProps): {
|
|
13
14
|
chartsContainerProps: ChartsContainerProps<"bar" | "rangeBar", BarChartPluginSignatures>;
|
|
15
|
+
barPlotPremiumProps: BarPlotPremiumProps;
|
|
14
16
|
rangeBarPlotProps: RangeBarPlotProps;
|
|
15
17
|
chartsWrapperProps: Omit<import("@mui/x-charts").ChartsWrapperProps, "children">;
|
|
16
|
-
barPlotProps: import("@mui/x-charts").BarPlotProps;
|
|
17
18
|
gridProps: import("@mui/x-charts").ChartsGridProps;
|
|
18
19
|
clipPathProps: import("@mui/x-charts").ChartsClipPathProps;
|
|
19
20
|
clipPathGroupProps: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type BarChartPluginSignatures } from '@mui/x-charts/BarChart';
|
|
2
2
|
import { type ChartsContainerProps } from '@mui/x-charts/ChartsContainer';
|
|
3
3
|
import { type BarChartPremiumProps } from "./BarChartPremium.js";
|
|
4
|
+
import { type BarPlotPremiumProps } from "./BarPlotPremium.js";
|
|
4
5
|
import { type RangeBarPlotProps } from "./RangeBar/RangeBarPlot.js";
|
|
5
6
|
/**
|
|
6
7
|
* A helper function that extracts BarChartPremiumProps from the input props
|
|
@@ -11,9 +12,9 @@ import { type RangeBarPlotProps } from "./RangeBar/RangeBarPlot.js";
|
|
|
11
12
|
*/
|
|
12
13
|
export declare function useBarChartPremiumProps(props: BarChartPremiumProps): {
|
|
13
14
|
chartsContainerProps: ChartsContainerProps<"bar" | "rangeBar", BarChartPluginSignatures>;
|
|
15
|
+
barPlotPremiumProps: BarPlotPremiumProps;
|
|
14
16
|
rangeBarPlotProps: RangeBarPlotProps;
|
|
15
17
|
chartsWrapperProps: Omit<import("@mui/x-charts").ChartsWrapperProps, "children">;
|
|
16
|
-
barPlotProps: import("@mui/x-charts").BarPlotProps;
|
|
17
18
|
gridProps: import("@mui/x-charts").ChartsGridProps;
|
|
18
19
|
clipPathProps: import("@mui/x-charts").ChartsClipPathProps;
|
|
19
20
|
clipPathGroupProps: {
|
|
@@ -8,7 +8,15 @@ exports.useBarChartPremiumProps = useBarChartPremiumProps;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
10
|
var _internals = require("@mui/x-charts/internals");
|
|
11
|
-
const _excluded = ["
|
|
11
|
+
const _excluded = ["renderer"],
|
|
12
|
+
_excluded2 = ["chartsContainerProps", "barPlotProps"];
|
|
13
|
+
/**
|
|
14
|
+
* Default minimum spacing (in pixels) between ticks on band axes when the WebGL
|
|
15
|
+
* renderer is active. Without this, a chart with 20k bars would render 20k SVG
|
|
16
|
+
* ticks, dwarfing the gain from drawing bars on the GPU.
|
|
17
|
+
*/
|
|
18
|
+
const WEBGL_DEFAULT_BAND_TICK_SPACING = 50;
|
|
19
|
+
|
|
12
20
|
/**
|
|
13
21
|
* A helper function that extracts BarChartPremiumProps from the input props
|
|
14
22
|
* and returns an object with props for the children components of BarChartPremium.
|
|
@@ -17,11 +25,23 @@ const _excluded = ["chartsContainerProps"];
|
|
|
17
25
|
* @returns An object with props for the children components of BarChartPremium
|
|
18
26
|
*/
|
|
19
27
|
function useBarChartPremiumProps(props) {
|
|
20
|
-
const
|
|
28
|
+
const {
|
|
29
|
+
renderer
|
|
30
|
+
} = props,
|
|
31
|
+
rest = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
32
|
+
const _useBarChartProps = (0, _internals.useBarChartProps)(rest),
|
|
21
33
|
{
|
|
22
|
-
chartsContainerProps
|
|
34
|
+
chartsContainerProps,
|
|
35
|
+
barPlotProps
|
|
23
36
|
} = _useBarChartProps,
|
|
24
|
-
barChartProps = (0, _objectWithoutPropertiesLoose2.default)(_useBarChartProps,
|
|
37
|
+
barChartProps = (0, _objectWithoutPropertiesLoose2.default)(_useBarChartProps, _excluded2);
|
|
38
|
+
const premiumContainerProps = renderer === 'webgl' ? (0, _extends2.default)({}, chartsContainerProps, {
|
|
39
|
+
xAxis: applyWebGLBandTickSpacing(chartsContainerProps.xAxis),
|
|
40
|
+
yAxis: applyWebGLBandTickSpacing(chartsContainerProps.yAxis)
|
|
41
|
+
}) : chartsContainerProps;
|
|
42
|
+
const barPlotPremiumProps = (0, _extends2.default)({}, barPlotProps, {
|
|
43
|
+
renderer
|
|
44
|
+
});
|
|
25
45
|
const rangeBarPlotProps = {
|
|
26
46
|
onItemClick: props.onItemClick,
|
|
27
47
|
slots: props.slots,
|
|
@@ -29,7 +49,21 @@ function useBarChartPremiumProps(props) {
|
|
|
29
49
|
borderRadius: props.borderRadius
|
|
30
50
|
};
|
|
31
51
|
return (0, _extends2.default)({}, barChartProps, {
|
|
32
|
-
chartsContainerProps:
|
|
52
|
+
chartsContainerProps: premiumContainerProps,
|
|
53
|
+
barPlotPremiumProps,
|
|
33
54
|
rangeBarPlotProps
|
|
34
55
|
});
|
|
56
|
+
}
|
|
57
|
+
function applyWebGLBandTickSpacing(axes) {
|
|
58
|
+
if (!axes) {
|
|
59
|
+
return axes;
|
|
60
|
+
}
|
|
61
|
+
return axes.map(axis => {
|
|
62
|
+
if (axis.scaleType === 'band' && axis.tickSpacing === undefined) {
|
|
63
|
+
return (0, _extends2.default)({}, axis, {
|
|
64
|
+
tickSpacing: WEBGL_DEFAULT_BAND_TICK_SPACING
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return axis;
|
|
68
|
+
});
|
|
35
69
|
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["renderer"],
|
|
4
|
+
_excluded2 = ["chartsContainerProps", "barPlotProps"];
|
|
4
5
|
import { useBarChartProps } from '@mui/x-charts/internals';
|
|
6
|
+
/**
|
|
7
|
+
* Default minimum spacing (in pixels) between ticks on band axes when the WebGL
|
|
8
|
+
* renderer is active. Without this, a chart with 20k bars would render 20k SVG
|
|
9
|
+
* ticks, dwarfing the gain from drawing bars on the GPU.
|
|
10
|
+
*/
|
|
11
|
+
const WEBGL_DEFAULT_BAND_TICK_SPACING = 50;
|
|
12
|
+
|
|
5
13
|
/**
|
|
6
14
|
* A helper function that extracts BarChartPremiumProps from the input props
|
|
7
15
|
* and returns an object with props for the children components of BarChartPremium.
|
|
@@ -10,11 +18,23 @@ import { useBarChartProps } from '@mui/x-charts/internals';
|
|
|
10
18
|
* @returns An object with props for the children components of BarChartPremium
|
|
11
19
|
*/
|
|
12
20
|
export function useBarChartPremiumProps(props) {
|
|
13
|
-
const
|
|
21
|
+
const {
|
|
22
|
+
renderer
|
|
23
|
+
} = props,
|
|
24
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
25
|
+
const _useBarChartProps = useBarChartProps(rest),
|
|
14
26
|
{
|
|
15
|
-
chartsContainerProps
|
|
27
|
+
chartsContainerProps,
|
|
28
|
+
barPlotProps
|
|
16
29
|
} = _useBarChartProps,
|
|
17
|
-
barChartProps = _objectWithoutPropertiesLoose(_useBarChartProps,
|
|
30
|
+
barChartProps = _objectWithoutPropertiesLoose(_useBarChartProps, _excluded2);
|
|
31
|
+
const premiumContainerProps = renderer === 'webgl' ? _extends({}, chartsContainerProps, {
|
|
32
|
+
xAxis: applyWebGLBandTickSpacing(chartsContainerProps.xAxis),
|
|
33
|
+
yAxis: applyWebGLBandTickSpacing(chartsContainerProps.yAxis)
|
|
34
|
+
}) : chartsContainerProps;
|
|
35
|
+
const barPlotPremiumProps = _extends({}, barPlotProps, {
|
|
36
|
+
renderer
|
|
37
|
+
});
|
|
18
38
|
const rangeBarPlotProps = {
|
|
19
39
|
onItemClick: props.onItemClick,
|
|
20
40
|
slots: props.slots,
|
|
@@ -22,7 +42,21 @@ export function useBarChartPremiumProps(props) {
|
|
|
22
42
|
borderRadius: props.borderRadius
|
|
23
43
|
};
|
|
24
44
|
return _extends({}, barChartProps, {
|
|
25
|
-
chartsContainerProps:
|
|
45
|
+
chartsContainerProps: premiumContainerProps,
|
|
46
|
+
barPlotPremiumProps,
|
|
26
47
|
rangeBarPlotProps
|
|
27
48
|
});
|
|
49
|
+
}
|
|
50
|
+
function applyWebGLBandTickSpacing(axes) {
|
|
51
|
+
if (!axes) {
|
|
52
|
+
return axes;
|
|
53
|
+
}
|
|
54
|
+
return axes.map(axis => {
|
|
55
|
+
if (axis.scaleType === 'band' && axis.tickSpacing === undefined) {
|
|
56
|
+
return _extends({}, axis, {
|
|
57
|
+
tickSpacing: WEBGL_DEFAULT_BAND_TICK_SPACING
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return axis;
|
|
61
|
+
});
|
|
28
62
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface BarWebGLPlotProps {
|
|
3
|
+
borderRadius?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* @ignore - Internal component used for rendering the bar plot using WebGL. Not exported from the package.
|
|
7
|
+
*/
|
|
8
|
+
export declare function BarWebGLPlot({
|
|
9
|
+
borderRadius
|
|
10
|
+
}: BarWebGLPlotProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface BarWebGLPlotProps {
|
|
3
|
+
borderRadius?: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* @ignore - Internal component used for rendering the bar plot using WebGL. Not exported from the package.
|
|
7
|
+
*/
|
|
8
|
+
export declare function BarWebGLPlot({
|
|
9
|
+
borderRadius
|
|
10
|
+
}: BarWebGLPlotProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,81 @@
|
|
|
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.BarWebGLPlot = BarWebGLPlot;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
11
|
+
var _internals = require("@mui/x-charts/internals");
|
|
12
|
+
var _ChartsWebGLContext = require("../../ChartsWebGLLayer/ChartsWebGLContext");
|
|
13
|
+
var _BarWebGLProgram = require("./BarWebGLProgram");
|
|
14
|
+
var _useBarWebGLPlotData = require("./useBarWebGLPlotData");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
/**
|
|
17
|
+
* @ignore - Internal component used for rendering the bar plot using WebGL. Not exported from the package.
|
|
18
|
+
*/
|
|
19
|
+
function BarWebGLPlot({
|
|
20
|
+
borderRadius = 0
|
|
21
|
+
}) {
|
|
22
|
+
const layer = (0, _ChartsWebGLContext.useWebGLLayer)();
|
|
23
|
+
const drawingArea = (0, _hooks.useDrawingArea)();
|
|
24
|
+
const {
|
|
25
|
+
xAxis: xAxes
|
|
26
|
+
} = (0, _hooks.useXAxes)();
|
|
27
|
+
const {
|
|
28
|
+
yAxis: yAxes
|
|
29
|
+
} = (0, _hooks.useYAxes)();
|
|
30
|
+
const {
|
|
31
|
+
completedData
|
|
32
|
+
} = (0, _internals.useBarPlotData)(drawingArea, xAxes, yAxes);
|
|
33
|
+
if (!layer) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BarWebGLPlotImpl, {
|
|
37
|
+
gl: layer.gl,
|
|
38
|
+
registerDraw: layer.registerDraw,
|
|
39
|
+
requestRender: layer.requestRender,
|
|
40
|
+
borderRadius: borderRadius,
|
|
41
|
+
completedData: completedData
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function BarWebGLPlotImpl(props) {
|
|
45
|
+
const {
|
|
46
|
+
gl,
|
|
47
|
+
registerDraw,
|
|
48
|
+
requestRender,
|
|
49
|
+
borderRadius,
|
|
50
|
+
completedData
|
|
51
|
+
} = props;
|
|
52
|
+
const drawingArea = (0, _hooks.useDrawingArea)();
|
|
53
|
+
const plotData = (0, _useBarWebGLPlotData.useBarWebGLPlotData)(drawingArea, completedData, borderRadius);
|
|
54
|
+
const [program, setProgram] = React.useState(null);
|
|
55
|
+
const drawRef = React.useRef(null);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
const prog = new _BarWebGLProgram.BarWebGLProgram(gl);
|
|
58
|
+
setProgram(prog);
|
|
59
|
+
return () => {
|
|
60
|
+
prog.dispose();
|
|
61
|
+
};
|
|
62
|
+
}, [gl]);
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
drawRef.current = () => {
|
|
65
|
+
program?.render(plotData.count);
|
|
66
|
+
};
|
|
67
|
+
}, [program, plotData.count]);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
const unregister = registerDraw(drawRef);
|
|
70
|
+
return unregister;
|
|
71
|
+
}, [registerDraw]);
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
program?.setResolution(drawingArea.width, drawingArea.height);
|
|
74
|
+
requestRender();
|
|
75
|
+
}, [drawingArea.width, drawingArea.height, program, requestRender]);
|
|
76
|
+
React.useEffect(() => {
|
|
77
|
+
program?.plot(plotData);
|
|
78
|
+
requestRender();
|
|
79
|
+
}, [program, plotData, requestRender]);
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useDrawingArea, useXAxes, useYAxes } from '@mui/x-charts/hooks';
|
|
5
|
+
import { useBarPlotData } from '@mui/x-charts/internals';
|
|
6
|
+
import { useWebGLLayer } from "../../ChartsWebGLLayer/ChartsWebGLContext.mjs";
|
|
7
|
+
import { BarWebGLProgram } from "./BarWebGLProgram.mjs";
|
|
8
|
+
import { useBarWebGLPlotData } from "./useBarWebGLPlotData.mjs";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* @ignore - Internal component used for rendering the bar plot using WebGL. Not exported from the package.
|
|
12
|
+
*/
|
|
13
|
+
export function BarWebGLPlot({
|
|
14
|
+
borderRadius = 0
|
|
15
|
+
}) {
|
|
16
|
+
const layer = useWebGLLayer();
|
|
17
|
+
const drawingArea = useDrawingArea();
|
|
18
|
+
const {
|
|
19
|
+
xAxis: xAxes
|
|
20
|
+
} = useXAxes();
|
|
21
|
+
const {
|
|
22
|
+
yAxis: yAxes
|
|
23
|
+
} = useYAxes();
|
|
24
|
+
const {
|
|
25
|
+
completedData
|
|
26
|
+
} = useBarPlotData(drawingArea, xAxes, yAxes);
|
|
27
|
+
if (!layer) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
return /*#__PURE__*/_jsx(BarWebGLPlotImpl, {
|
|
31
|
+
gl: layer.gl,
|
|
32
|
+
registerDraw: layer.registerDraw,
|
|
33
|
+
requestRender: layer.requestRender,
|
|
34
|
+
borderRadius: borderRadius,
|
|
35
|
+
completedData: completedData
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function BarWebGLPlotImpl(props) {
|
|
39
|
+
const {
|
|
40
|
+
gl,
|
|
41
|
+
registerDraw,
|
|
42
|
+
requestRender,
|
|
43
|
+
borderRadius,
|
|
44
|
+
completedData
|
|
45
|
+
} = props;
|
|
46
|
+
const drawingArea = useDrawingArea();
|
|
47
|
+
const plotData = useBarWebGLPlotData(drawingArea, completedData, borderRadius);
|
|
48
|
+
const [program, setProgram] = React.useState(null);
|
|
49
|
+
const drawRef = React.useRef(null);
|
|
50
|
+
React.useEffect(() => {
|
|
51
|
+
const prog = new BarWebGLProgram(gl);
|
|
52
|
+
setProgram(prog);
|
|
53
|
+
return () => {
|
|
54
|
+
prog.dispose();
|
|
55
|
+
};
|
|
56
|
+
}, [gl]);
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
drawRef.current = () => {
|
|
59
|
+
program?.render(plotData.count);
|
|
60
|
+
};
|
|
61
|
+
}, [program, plotData.count]);
|
|
62
|
+
React.useEffect(() => {
|
|
63
|
+
const unregister = registerDraw(drawRef);
|
|
64
|
+
return unregister;
|
|
65
|
+
}, [registerDraw]);
|
|
66
|
+
React.useEffect(() => {
|
|
67
|
+
program?.setResolution(drawingArea.width, drawingArea.height);
|
|
68
|
+
requestRender();
|
|
69
|
+
}, [drawingArea.width, drawingArea.height, program, requestRender]);
|
|
70
|
+
React.useEffect(() => {
|
|
71
|
+
program?.plot(plotData);
|
|
72
|
+
requestRender();
|
|
73
|
+
}, [program, plotData, requestRender]);
|
|
74
|
+
return null;
|
|
75
|
+
}
|