@mui/x-charts-premium 9.1.0 → 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 +21 -8
- package/BarChartPremium/BarChartPremium.mjs +22 -9
- 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/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 +103 -0
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.js +2 -2
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.mjs +2 -2
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.js +9 -3
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.mjs +9 -3
- package/RadialBarChart/RadialBarChart.d.mts +7 -0
- package/RadialBarChart/RadialBarChart.d.ts +7 -0
- package/RadialBarChart/RadialBarChart.js +15 -2
- package/RadialBarChart/RadialBarChart.mjs +15 -2
- package/RadialBarChart/RadialBarElement.js +15 -1
- package/RadialBarChart/RadialBarElement.mjs +15 -1
- package/RadialBarChart/radialBarClasses.d.mts +1 -1
- package/RadialBarChart/radialBarClasses.d.ts +1 -1
- 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/useRadialBarChartProps.d.mts +2 -0
- package/RadialBarChart/useRadialBarChartProps.d.ts +2 -0
- package/RadialBarChart/useRadialBarChartProps.js +10 -2
- package/RadialBarChart/useRadialBarChartProps.mjs +10 -2
- package/RadialLineChart/RadialLineChart.js +4 -2
- package/RadialLineChart/RadialLineChart.mjs +4 -2
- 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/seriesConfig/getItemAtPosition.js +3 -3
- package/RadialLineChart/seriesConfig/getItemAtPosition.mjs +4 -4
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +125 -125
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type BarChartProProps, type BarChartProSlotProps, type BarChartProSlots } from '@mui/x-charts-pro/BarChartPro';
|
|
3
3
|
import { type BarSeries } from '@mui/x-charts/BarChart';
|
|
4
|
+
import type { BarChartPremiumPluginSignatures } from "./BarChartPremium.plugins.mjs";
|
|
5
|
+
import { type BarPlotPremiumProps } from "./BarPlotPremium.mjs";
|
|
4
6
|
import { type BarItemIdentifier, type RangeBarItemIdentifier, type RangeBarSeriesType } from "../models/index.mjs";
|
|
7
|
+
import type { ChartsContainerPremiumProps } from "../ChartsContainerPremium/index.mjs";
|
|
5
8
|
export type RangeBarSeries = RangeBarSeriesType;
|
|
6
9
|
export interface BarChartPremiumSlots extends BarChartProSlots {}
|
|
7
10
|
export interface BarChartPremiumSlotProps extends BarChartProSlotProps {}
|
|
8
|
-
export interface BarChartPremiumProps extends Omit<BarChartProProps, 'series' | '
|
|
11
|
+
export interface BarChartPremiumProps extends Omit<BarChartProProps, 'apiRef' | 'slots' | 'slotProps' | 'seriesConfig' | 'plugins' | 'series' | 'renderer'>, Omit<ChartsContainerPremiumProps<'bar', BarChartPremiumPluginSignatures>, 'series' | 'slots' | 'slotProps'>, Pick<BarPlotPremiumProps, 'renderer'> {
|
|
9
12
|
/**
|
|
10
13
|
* Overridable component slots.
|
|
11
14
|
* @default {}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type BarChartProProps, type BarChartProSlotProps, type BarChartProSlots } from '@mui/x-charts-pro/BarChartPro';
|
|
3
3
|
import { type BarSeries } from '@mui/x-charts/BarChart';
|
|
4
|
+
import type { BarChartPremiumPluginSignatures } from "./BarChartPremium.plugins.js";
|
|
5
|
+
import { type BarPlotPremiumProps } from "./BarPlotPremium.js";
|
|
4
6
|
import { type BarItemIdentifier, type RangeBarItemIdentifier, type RangeBarSeriesType } from "../models/index.js";
|
|
7
|
+
import type { ChartsContainerPremiumProps } from "../ChartsContainerPremium/index.js";
|
|
5
8
|
export type RangeBarSeries = RangeBarSeriesType;
|
|
6
9
|
export interface BarChartPremiumSlots extends BarChartProSlots {}
|
|
7
10
|
export interface BarChartPremiumSlotProps extends BarChartProSlotProps {}
|
|
8
|
-
export interface BarChartPremiumProps extends Omit<BarChartProProps, 'series' | '
|
|
11
|
+
export interface BarChartPremiumProps extends Omit<BarChartProProps, 'apiRef' | 'slots' | 'slotProps' | 'seriesConfig' | 'plugins' | 'series' | 'renderer'>, Omit<ChartsContainerPremiumProps<'bar', BarChartPremiumPluginSignatures>, 'series' | 'slots' | 'slotProps'>, Pick<BarPlotPremiumProps, 'renderer'> {
|
|
9
12
|
/**
|
|
10
13
|
* Overridable component slots.
|
|
11
14
|
* @default {}
|
|
@@ -16,7 +16,8 @@ var _ChartsLegend = require("@mui/x-charts/ChartsLegend");
|
|
|
16
16
|
var _ChartsToolbarPro = require("@mui/x-charts-pro/ChartsToolbarPro");
|
|
17
17
|
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
18
18
|
var _ChartsWrapper = require("@mui/x-charts/ChartsWrapper");
|
|
19
|
-
var
|
|
19
|
+
var _ChartsLayerContainer = require("@mui/x-charts/ChartsLayerContainer");
|
|
20
|
+
var _ChartsSvgLayer = require("@mui/x-charts/ChartsSvgLayer");
|
|
20
21
|
var _ChartsGrid = require("@mui/x-charts/ChartsGrid");
|
|
21
22
|
var _BarChart = require("@mui/x-charts/BarChart");
|
|
22
23
|
var _ChartsOverlay = require("@mui/x-charts/ChartsOverlay");
|
|
@@ -28,6 +29,8 @@ var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
|
28
29
|
var _internals = require("@mui/x-charts-pro/internals");
|
|
29
30
|
var _useBarChartPremiumProps = require("./useBarChartPremiumProps");
|
|
30
31
|
var _BarChartPremium2 = require("./BarChartPremium.plugins");
|
|
32
|
+
var _BarPlotPremium = require("./BarPlotPremium");
|
|
33
|
+
var _ChartsWebGLLayer = require("../ChartsWebGLLayer");
|
|
31
34
|
var _ChartsDataProviderPremium = require("../ChartsDataProviderPremium");
|
|
32
35
|
var _RangeBarPlot = require("./RangeBar/RangeBarPlot");
|
|
33
36
|
var _FocusedRangeBar = require("./RangeBar/FocusedRangeBar");
|
|
@@ -60,7 +63,7 @@ const BarChartPremium = exports.BarChartPremium = /*#__PURE__*/React.forwardRef(
|
|
|
60
63
|
const {
|
|
61
64
|
chartsWrapperProps,
|
|
62
65
|
chartsContainerProps,
|
|
63
|
-
|
|
66
|
+
barPlotPremiumProps,
|
|
64
67
|
rangeBarPlotProps,
|
|
65
68
|
gridProps,
|
|
66
69
|
clipPathProps,
|
|
@@ -83,14 +86,23 @@ const BarChartPremium = exports.BarChartPremium = /*#__PURE__*/React.forwardRef(
|
|
|
83
86
|
}));
|
|
84
87
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
85
88
|
const Toolbar = props.slots?.toolbar ?? _ChartsToolbarPro.ChartsToolbarPro;
|
|
89
|
+
const renderer = barPlotPremiumProps.renderer;
|
|
86
90
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsDataProviderPremium.ChartsDataProviderPremium, (0, _extends2.default)({}, chartsDataProviderProProps, {
|
|
87
91
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
88
92
|
ref: ref,
|
|
89
|
-
children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
90
|
-
children: [
|
|
91
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
children: [showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsLayerContainer.ChartsLayerContainer, {
|
|
94
|
+
children: [renderer === 'webgl' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
95
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSvgLayer.ChartsSvgLayer, {
|
|
96
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps))
|
|
97
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsWebGLLayer.ChartsWebGLLayer, {
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarPlotPremium.BarPlotPremium, (0, _extends2.default)({}, barPlotPremiumProps))
|
|
99
|
+
})]
|
|
100
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSvgLayer.ChartsSvgLayer, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
101
|
+
children: [renderer !== 'webgl' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
102
|
+
children: [renderer !== 'webgl' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarPlotPremium.BarPlotPremium, (0, _extends2.default)({}, barPlotPremiumProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RangeBarPlot.RangeBarPlot, (0, _extends2.default)({}, rangeBarPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.FocusedBar, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedRangeBar.FocusedRangeBar, {})]
|
|
103
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsZoomSlider.ChartsZoomSlider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsBrushOverlay.ChartsBrushOverlay, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
104
|
+
}))]
|
|
105
|
+
}), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
|
|
94
106
|
}))
|
|
95
107
|
}));
|
|
96
108
|
});
|
|
@@ -355,11 +367,12 @@ process.env.NODE_ENV !== "production" ? BarChartPremium.propTypes = {
|
|
|
355
367
|
* The type of renderer to use for the bar plot.
|
|
356
368
|
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
357
369
|
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
370
|
+
* - `webgl`: Renders bars using WebGL for better performance with very large datasets, at the cost of some limitations.
|
|
358
371
|
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
359
372
|
*
|
|
360
373
|
* @default 'svg-single'
|
|
361
374
|
*/
|
|
362
|
-
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-single']),
|
|
375
|
+
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-single', 'webgl']),
|
|
363
376
|
/**
|
|
364
377
|
* The series to display in the bar chart.
|
|
365
378
|
* An array of [[BarSeries]] or [[RangeBarSeries]] objects.
|
|
@@ -10,9 +10,10 @@ import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
|
|
|
10
10
|
import { ChartsToolbarPro } from '@mui/x-charts-pro/ChartsToolbarPro';
|
|
11
11
|
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
12
12
|
import { ChartsWrapper } from '@mui/x-charts/ChartsWrapper';
|
|
13
|
-
import {
|
|
13
|
+
import { ChartsLayerContainer } from '@mui/x-charts/ChartsLayerContainer';
|
|
14
|
+
import { ChartsSvgLayer } from '@mui/x-charts/ChartsSvgLayer';
|
|
14
15
|
import { ChartsGrid } from '@mui/x-charts/ChartsGrid';
|
|
15
|
-
import {
|
|
16
|
+
import { FocusedBar } from '@mui/x-charts/BarChart';
|
|
16
17
|
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
17
18
|
import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
|
|
18
19
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
@@ -22,6 +23,8 @@ import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
|
22
23
|
import { useChartsContainerProProps } from '@mui/x-charts-pro/internals';
|
|
23
24
|
import { useBarChartPremiumProps } from "./useBarChartPremiumProps.mjs";
|
|
24
25
|
import { BAR_CHART_PREMIUM_PLUGINS } from "./BarChartPremium.plugins.mjs";
|
|
26
|
+
import { BarPlotPremium } from "./BarPlotPremium.mjs";
|
|
27
|
+
import { ChartsWebGLLayer } from "../ChartsWebGLLayer/index.mjs";
|
|
25
28
|
import { ChartsDataProviderPremium } from "../ChartsDataProviderPremium/index.mjs";
|
|
26
29
|
import { RangeBarPlot } from "./RangeBar/RangeBarPlot.mjs";
|
|
27
30
|
import { FocusedRangeBar } from "./RangeBar/FocusedRangeBar.mjs";
|
|
@@ -53,7 +56,7 @@ const BarChartPremium = /*#__PURE__*/React.forwardRef(function BarChartPremium(i
|
|
|
53
56
|
const {
|
|
54
57
|
chartsWrapperProps,
|
|
55
58
|
chartsContainerProps,
|
|
56
|
-
|
|
59
|
+
barPlotPremiumProps,
|
|
57
60
|
rangeBarPlotProps,
|
|
58
61
|
gridProps,
|
|
59
62
|
clipPathProps,
|
|
@@ -76,14 +79,23 @@ const BarChartPremium = /*#__PURE__*/React.forwardRef(function BarChartPremium(i
|
|
|
76
79
|
}));
|
|
77
80
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
78
81
|
const Toolbar = props.slots?.toolbar ?? ChartsToolbarPro;
|
|
82
|
+
const renderer = barPlotPremiumProps.renderer;
|
|
79
83
|
return /*#__PURE__*/_jsx(ChartsDataProviderPremium, _extends({}, chartsDataProviderProProps, {
|
|
80
84
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
81
85
|
ref: ref,
|
|
82
|
-
children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(
|
|
83
|
-
children: [
|
|
84
|
-
children: [/*#__PURE__*/_jsx(
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsLayerContainer, {
|
|
87
|
+
children: [renderer === 'webgl' && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
88
|
+
children: [/*#__PURE__*/_jsx(ChartsSvgLayer, {
|
|
89
|
+
children: /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps))
|
|
90
|
+
}), /*#__PURE__*/_jsx(ChartsWebGLLayer, {
|
|
91
|
+
children: /*#__PURE__*/_jsx(BarPlotPremium, _extends({}, barPlotPremiumProps))
|
|
92
|
+
})]
|
|
93
|
+
}), /*#__PURE__*/_jsxs(ChartsSvgLayer, _extends({}, chartsSurfaceProps, {
|
|
94
|
+
children: [renderer !== 'webgl' && /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
95
|
+
children: [renderer !== 'webgl' && /*#__PURE__*/_jsx(BarPlotPremium, _extends({}, barPlotPremiumProps)), /*#__PURE__*/_jsx(RangeBarPlot, _extends({}, rangeBarPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), /*#__PURE__*/_jsx(FocusedBar, {}), /*#__PURE__*/_jsx(FocusedRangeBar, {})]
|
|
96
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsZoomSlider, {}), /*#__PURE__*/_jsx(ChartsBrushOverlay, {}), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
97
|
+
}))]
|
|
98
|
+
}), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
|
|
87
99
|
}))
|
|
88
100
|
}));
|
|
89
101
|
});
|
|
@@ -348,11 +360,12 @@ process.env.NODE_ENV !== "production" ? BarChartPremium.propTypes = {
|
|
|
348
360
|
* The type of renderer to use for the bar plot.
|
|
349
361
|
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
350
362
|
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
363
|
+
* - `webgl`: Renders bars using WebGL for better performance with very large datasets, at the cost of some limitations.
|
|
351
364
|
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
352
365
|
*
|
|
353
366
|
* @default 'svg-single'
|
|
354
367
|
*/
|
|
355
|
-
renderer: PropTypes.oneOf(['svg-batch', 'svg-single']),
|
|
368
|
+
renderer: PropTypes.oneOf(['svg-batch', 'svg-single', 'webgl']),
|
|
356
369
|
/**
|
|
357
370
|
* The series to display in the bar chart.
|
|
358
371
|
* An array of [[BarSeries]] or [[RangeBarSeries]] objects.
|
|
@@ -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 };
|
|
@@ -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
|
}
|