@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,79 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import { selectorChartPolarCenter, useChartsContext } from '@mui/x-charts/internals';
|
|
8
|
+
import { useUtilityClasses } from "./radialBarClasses.mjs";
|
|
9
|
+
import { useRadialBarPlotData } from "./useRadialBarPlotData.mjs";
|
|
10
|
+
import { RadialBarElement } from "./RadialBarElement.mjs";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const RadialBarPlotRoot = styled('g', {
|
|
13
|
+
name: 'MuiRadialBarPlot',
|
|
14
|
+
slot: 'Root'
|
|
15
|
+
})();
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Demos:
|
|
19
|
+
*
|
|
20
|
+
* - [Radial bar demonstration](https://mui.com/x/react-charts/radial-bars/)
|
|
21
|
+
*
|
|
22
|
+
* API:
|
|
23
|
+
*
|
|
24
|
+
* - [RadialBarPlot API](https://mui.com/x/api/charts/radial-bar-plot/)
|
|
25
|
+
*/
|
|
26
|
+
function RadialBarPlot(props) {
|
|
27
|
+
const {
|
|
28
|
+
className
|
|
29
|
+
} = props;
|
|
30
|
+
const {
|
|
31
|
+
completedData
|
|
32
|
+
} = useRadialBarPlotData();
|
|
33
|
+
const {
|
|
34
|
+
store
|
|
35
|
+
} = useChartsContext();
|
|
36
|
+
const {
|
|
37
|
+
cx,
|
|
38
|
+
cy
|
|
39
|
+
} = store.use(selectorChartPolarCenter);
|
|
40
|
+
const classes = useUtilityClasses();
|
|
41
|
+
return /*#__PURE__*/_jsx(RadialBarPlotRoot, {
|
|
42
|
+
className: clsx(classes.root, className),
|
|
43
|
+
transform: `translate(${cx} ${cy})`,
|
|
44
|
+
children: completedData.map(({
|
|
45
|
+
seriesId,
|
|
46
|
+
data
|
|
47
|
+
}) => /*#__PURE__*/_jsx("g", {
|
|
48
|
+
"data-series": seriesId,
|
|
49
|
+
className: classes.series,
|
|
50
|
+
children: data.map(({
|
|
51
|
+
dataIndex,
|
|
52
|
+
color,
|
|
53
|
+
startAngle,
|
|
54
|
+
endAngle,
|
|
55
|
+
innerRadius,
|
|
56
|
+
outerRadius
|
|
57
|
+
}) => /*#__PURE__*/_jsx(RadialBarElement, {
|
|
58
|
+
seriesId: seriesId,
|
|
59
|
+
dataIndex: dataIndex,
|
|
60
|
+
color: color,
|
|
61
|
+
startAngle: startAngle,
|
|
62
|
+
endAngle: endAngle,
|
|
63
|
+
innerRadius: innerRadius,
|
|
64
|
+
outerRadius: outerRadius
|
|
65
|
+
}, dataIndex))
|
|
66
|
+
}, seriesId))
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
process.env.NODE_ENV !== "production" ? RadialBarPlot.propTypes = {
|
|
70
|
+
// ----------------------------- Warning --------------------------------
|
|
71
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
72
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
73
|
+
// ----------------------------------------------------------------------
|
|
74
|
+
/**
|
|
75
|
+
* A CSS class name applied to the root element.
|
|
76
|
+
*/
|
|
77
|
+
className: PropTypes.string
|
|
78
|
+
} : void 0;
|
|
79
|
+
export { RadialBarPlot };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
radialBarClasses: true
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "radialBarClasses", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _radialBarClasses.radialBarClasses;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
var _RadialBarChart = require("./RadialBarChart");
|
|
16
|
+
Object.keys(_RadialBarChart).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
|
+
if (key in exports && exports[key] === _RadialBarChart[key]) return;
|
|
20
|
+
Object.defineProperty(exports, key, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _RadialBarChart[key];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
var _RadialBarPlot = require("./RadialBarPlot");
|
|
28
|
+
Object.keys(_RadialBarPlot).forEach(function (key) {
|
|
29
|
+
if (key === "default" || key === "__esModule") return;
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
|
+
if (key in exports && exports[key] === _RadialBarPlot[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _RadialBarPlot[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _radialBarClasses = require("./radialBarClasses");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RadialBarClasses {
|
|
2
|
+
/** Styles applied to the bar plot element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the group surrounding a series' bar elements. */
|
|
5
|
+
series: string;
|
|
6
|
+
/** Styles applied to an individual bar element. */
|
|
7
|
+
element: string;
|
|
8
|
+
}
|
|
9
|
+
export type RadialBarClassKey = keyof RadialBarClasses;
|
|
10
|
+
export declare const radialBarClasses: RadialBarClasses;
|
|
11
|
+
interface UseUtilityClassesOptions {
|
|
12
|
+
classes?: Partial<RadialBarClasses>;
|
|
13
|
+
}
|
|
14
|
+
export declare const useUtilityClasses: (options?: UseUtilityClassesOptions) => Record<"root" | "series" | "element", string>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RadialBarClasses {
|
|
2
|
+
/** Styles applied to the bar plot element. */
|
|
3
|
+
root: string;
|
|
4
|
+
/** Styles applied to the group surrounding a series' bar elements. */
|
|
5
|
+
series: string;
|
|
6
|
+
/** Styles applied to an individual bar element. */
|
|
7
|
+
element: string;
|
|
8
|
+
}
|
|
9
|
+
export type RadialBarClassKey = keyof RadialBarClasses;
|
|
10
|
+
export declare const radialBarClasses: RadialBarClasses;
|
|
11
|
+
interface UseUtilityClassesOptions {
|
|
12
|
+
classes?: Partial<RadialBarClasses>;
|
|
13
|
+
}
|
|
14
|
+
export declare const useUtilityClasses: (options?: UseUtilityClassesOptions) => Record<"root" | "series" | "element", string>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useUtilityClasses = exports.radialBarClasses = void 0;
|
|
8
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
9
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
10
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
11
|
+
function getRadialBarUtilityClass(slot) {
|
|
12
|
+
return (0, _generateUtilityClass.default)('MuiRadialBarChart', slot);
|
|
13
|
+
}
|
|
14
|
+
const radialBarClasses = exports.radialBarClasses = (0, _generateUtilityClasses.default)('MuiRadialBarChart', ['root', 'series', 'element']);
|
|
15
|
+
const useUtilityClasses = options => {
|
|
16
|
+
const {
|
|
17
|
+
classes
|
|
18
|
+
} = options ?? {};
|
|
19
|
+
const slots = {
|
|
20
|
+
root: ['root'],
|
|
21
|
+
series: ['series'],
|
|
22
|
+
element: ['element']
|
|
23
|
+
};
|
|
24
|
+
return (0, _composeClasses.default)(slots, getRadialBarUtilityClass, classes);
|
|
25
|
+
};
|
|
26
|
+
exports.useUtilityClasses = useUtilityClasses;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
3
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
4
|
+
function getRadialBarUtilityClass(slot) {
|
|
5
|
+
return generateUtilityClass('MuiRadialBarChart', slot);
|
|
6
|
+
}
|
|
7
|
+
export const radialBarClasses = generateUtilityClasses('MuiRadialBarChart', ['root', 'series', 'element']);
|
|
8
|
+
export const useUtilityClasses = options => {
|
|
9
|
+
const {
|
|
10
|
+
classes
|
|
11
|
+
} = options ?? {};
|
|
12
|
+
const slots = {
|
|
13
|
+
root: ['root'],
|
|
14
|
+
series: ['series'],
|
|
15
|
+
element: ['element']
|
|
16
|
+
};
|
|
17
|
+
return composeClasses(slots, getRadialBarUtilityClass, classes);
|
|
18
|
+
};
|
|
@@ -5,9 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.axisTooltipGetter = void 0;
|
|
7
7
|
const axisTooltipGetter = series => {
|
|
8
|
-
return Object.values(series).map(s =>
|
|
8
|
+
return Object.values(series).map(s => s.layout === 'horizontal' ? {
|
|
9
|
+
direction: 'radius',
|
|
10
|
+
axisId: 'radiusAxisId' in s ? s.radiusAxisId : undefined
|
|
11
|
+
} : {
|
|
9
12
|
direction: 'rotation',
|
|
10
13
|
axisId: 'rotationAxisId' in s ? s.rotationAxisId : undefined
|
|
11
|
-
})
|
|
14
|
+
});
|
|
12
15
|
};
|
|
13
16
|
exports.axisTooltipGetter = axisTooltipGetter;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export const axisTooltipGetter = series => {
|
|
2
|
-
return Object.values(series).map(s =>
|
|
2
|
+
return Object.values(series).map(s => s.layout === 'horizontal' ? {
|
|
3
|
+
direction: 'radius',
|
|
4
|
+
axisId: 'radiusAxisId' in s ? s.radiusAxisId : undefined
|
|
5
|
+
} : {
|
|
3
6
|
direction: 'rotation',
|
|
4
7
|
axisId: 'rotationAxisId' in s ? s.rotationAxisId : undefined
|
|
5
|
-
})
|
|
8
|
+
});
|
|
6
9
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ChartState, type UseChartPolarAxisSignature } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SeriesItemIdentifierWithType } from '@mui/x-charts/models';
|
|
3
|
+
export default function getItemAtPosition(state: ChartState<[UseChartPolarAxisSignature]>, point: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}): SeriesItemIdentifierWithType<'radialBar'> | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ChartState, type UseChartPolarAxisSignature } from '@mui/x-charts/internals';
|
|
2
|
+
import type { SeriesItemIdentifierWithType } from '@mui/x-charts/models';
|
|
3
|
+
export default function getItemAtPosition(state: ChartState<[UseChartPolarAxisSignature]>, point: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}): SeriesItemIdentifierWithType<'radialBar'> | undefined;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getItemAtPosition;
|
|
7
|
+
var _internals = require("@mui/x-charts/internals");
|
|
8
|
+
function getItemAtPosition(state, point) {
|
|
9
|
+
const {
|
|
10
|
+
axis: rotationAxes,
|
|
11
|
+
axisIds: rotationAxisIds
|
|
12
|
+
} = (0, _internals.selectorChartRotationAxis)(state);
|
|
13
|
+
const {
|
|
14
|
+
axis: radiusAxes,
|
|
15
|
+
axisIds: radiusAxisIds
|
|
16
|
+
} = (0, _internals.selectorChartRadiusAxis)(state);
|
|
17
|
+
const center = (0, _internals.selectorChartPolarCenter)(state);
|
|
18
|
+
const seriesState = (0, _internals.selectorAllSeriesOfType)(state, 'radialBar');
|
|
19
|
+
if (!seriesState || seriesState.seriesOrder.length === 0) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const defaultRotationAxisId = rotationAxisIds[0];
|
|
23
|
+
const defaultRadiusAxisId = radiusAxisIds[0];
|
|
24
|
+
const polarCoordinate = {
|
|
25
|
+
rotation: (0, _internals.generateSvg2rotation)(center)(point.x, point.y),
|
|
26
|
+
radius: Math.sqrt((point.x - center.cx) ** 2 + (point.y - center.cy) ** 2)
|
|
27
|
+
};
|
|
28
|
+
for (let stackIndex = 0; stackIndex < seriesState.stackingGroups.length; stackIndex += 1) {
|
|
29
|
+
const group = seriesState.stackingGroups[stackIndex];
|
|
30
|
+
const seriesIds = group.ids;
|
|
31
|
+
for (const seriesId of seriesIds) {
|
|
32
|
+
const series = (seriesState.series ?? {})[seriesId];
|
|
33
|
+
const rotationAxisId = series.rotationAxisId ?? defaultRotationAxisId;
|
|
34
|
+
const radiusAxisId = series.radiusAxisId ?? defaultRadiusAxisId;
|
|
35
|
+
const rotationAxis = rotationAxes[rotationAxisId];
|
|
36
|
+
const radiusAxis = radiusAxes[radiusAxisId];
|
|
37
|
+
const bandAxis = series.layout === 'horizontal' ? radiusAxis : rotationAxis;
|
|
38
|
+
const continuousAxis = series.layout === 'horizontal' ? rotationAxis : radiusAxis;
|
|
39
|
+
const clampedAngle = rotationAxis.scale.range()[0] + (0, _internals.clampAngleRad)(polarCoordinate.rotation - rotationAxis.scale.range()[0]);
|
|
40
|
+
const bandCoordinate = series.layout === 'horizontal' ? polarCoordinate.radius : clampedAngle;
|
|
41
|
+
const valueCoordinate = series.layout === 'horizontal' ? clampedAngle : polarCoordinate.radius;
|
|
42
|
+
const dataIndex = (0, _internals.getBandIndex)(bandAxis, {
|
|
43
|
+
groupNumber: seriesState.stackingGroups.length,
|
|
44
|
+
groupIndex: stackIndex
|
|
45
|
+
}, bandCoordinate);
|
|
46
|
+
if (dataIndex === -1) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// The point is inside the band for this series
|
|
51
|
+
const bar = series.visibleStackedData[dataIndex];
|
|
52
|
+
const start = continuousAxis.scale(bar[0]);
|
|
53
|
+
const end = continuousAxis.scale(bar[1]);
|
|
54
|
+
if (start == null || end == null) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const continuousMin = Math.min(start, end);
|
|
58
|
+
const continuousMax = Math.max(start, end);
|
|
59
|
+
if (valueCoordinate >= continuousMin && valueCoordinate <= continuousMax) {
|
|
60
|
+
return {
|
|
61
|
+
type: 'radialBar',
|
|
62
|
+
seriesId,
|
|
63
|
+
dataIndex
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { selectorAllSeriesOfType, selectorChartPolarCenter, selectorChartRadiusAxis, selectorChartRotationAxis, getBandIndex, clampAngleRad, generateSvg2rotation } from '@mui/x-charts/internals';
|
|
2
|
+
export default function getItemAtPosition(state, point) {
|
|
3
|
+
const {
|
|
4
|
+
axis: rotationAxes,
|
|
5
|
+
axisIds: rotationAxisIds
|
|
6
|
+
} = selectorChartRotationAxis(state);
|
|
7
|
+
const {
|
|
8
|
+
axis: radiusAxes,
|
|
9
|
+
axisIds: radiusAxisIds
|
|
10
|
+
} = selectorChartRadiusAxis(state);
|
|
11
|
+
const center = selectorChartPolarCenter(state);
|
|
12
|
+
const seriesState = selectorAllSeriesOfType(state, 'radialBar');
|
|
13
|
+
if (!seriesState || seriesState.seriesOrder.length === 0) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
const defaultRotationAxisId = rotationAxisIds[0];
|
|
17
|
+
const defaultRadiusAxisId = radiusAxisIds[0];
|
|
18
|
+
const polarCoordinate = {
|
|
19
|
+
rotation: generateSvg2rotation(center)(point.x, point.y),
|
|
20
|
+
radius: Math.sqrt((point.x - center.cx) ** 2 + (point.y - center.cy) ** 2)
|
|
21
|
+
};
|
|
22
|
+
for (let stackIndex = 0; stackIndex < seriesState.stackingGroups.length; stackIndex += 1) {
|
|
23
|
+
const group = seriesState.stackingGroups[stackIndex];
|
|
24
|
+
const seriesIds = group.ids;
|
|
25
|
+
for (const seriesId of seriesIds) {
|
|
26
|
+
const series = (seriesState.series ?? {})[seriesId];
|
|
27
|
+
const rotationAxisId = series.rotationAxisId ?? defaultRotationAxisId;
|
|
28
|
+
const radiusAxisId = series.radiusAxisId ?? defaultRadiusAxisId;
|
|
29
|
+
const rotationAxis = rotationAxes[rotationAxisId];
|
|
30
|
+
const radiusAxis = radiusAxes[radiusAxisId];
|
|
31
|
+
const bandAxis = series.layout === 'horizontal' ? radiusAxis : rotationAxis;
|
|
32
|
+
const continuousAxis = series.layout === 'horizontal' ? rotationAxis : radiusAxis;
|
|
33
|
+
const clampedAngle = rotationAxis.scale.range()[0] + clampAngleRad(polarCoordinate.rotation - rotationAxis.scale.range()[0]);
|
|
34
|
+
const bandCoordinate = series.layout === 'horizontal' ? polarCoordinate.radius : clampedAngle;
|
|
35
|
+
const valueCoordinate = series.layout === 'horizontal' ? clampedAngle : polarCoordinate.radius;
|
|
36
|
+
const dataIndex = getBandIndex(bandAxis, {
|
|
37
|
+
groupNumber: seriesState.stackingGroups.length,
|
|
38
|
+
groupIndex: stackIndex
|
|
39
|
+
}, bandCoordinate);
|
|
40
|
+
if (dataIndex === -1) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// The point is inside the band for this series
|
|
45
|
+
const bar = series.visibleStackedData[dataIndex];
|
|
46
|
+
const start = continuousAxis.scale(bar[0]);
|
|
47
|
+
const end = continuousAxis.scale(bar[1]);
|
|
48
|
+
if (start == null || end == null) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const continuousMin = Math.min(start, end);
|
|
52
|
+
const continuousMax = Math.max(start, end);
|
|
53
|
+
if (valueCoordinate >= continuousMin && valueCoordinate <= continuousMax) {
|
|
54
|
+
return {
|
|
55
|
+
type: 'radialBar',
|
|
56
|
+
seriesId,
|
|
57
|
+
dataIndex
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
@@ -14,6 +14,7 @@ var _getColor = _interopRequireDefault(require("./getColor"));
|
|
|
14
14
|
var _seriesProcessor = _interopRequireDefault(require("./seriesProcessor"));
|
|
15
15
|
var _getSeriesWithDefaultValues = _interopRequireDefault(require("./getSeriesWithDefaultValues"));
|
|
16
16
|
var _descriptionGetter = _interopRequireDefault(require("./descriptionGetter"));
|
|
17
|
+
var _getItemAtPosition = _interopRequireDefault(require("./getItemAtPosition"));
|
|
17
18
|
var _extremums = require("./extremums");
|
|
18
19
|
var _tooltip = _interopRequireDefault(require("./tooltip"));
|
|
19
20
|
_internals.polarSeriesTypes.addType('radialBar');
|
|
@@ -27,7 +28,7 @@ const radialBarSeriesConfig = exports.radialBarSeriesConfig = {
|
|
|
27
28
|
rotationExtremumGetter: _extremums.rotationExtremumGetter,
|
|
28
29
|
radiusExtremumGetter: _extremums.radiusExtremumGetter,
|
|
29
30
|
getSeriesWithDefaultValues: _getSeriesWithDefaultValues.default,
|
|
30
|
-
|
|
31
|
+
getItemAtPosition: _getItemAtPosition.default,
|
|
31
32
|
keyboardFocusHandler: _keyboardFocusHandler.default,
|
|
32
33
|
identifierSerializer: _internals.identifierSerializerSeriesIdDataIndex,
|
|
33
34
|
identifierCleaner: _internals.identifierCleanerSeriesIdDataIndex,
|
|
@@ -7,6 +7,7 @@ import colorProcessor from "./getColor.mjs";
|
|
|
7
7
|
import seriesProcessor from "./seriesProcessor.mjs";
|
|
8
8
|
import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.mjs";
|
|
9
9
|
import descriptionGetter from "./descriptionGetter.mjs";
|
|
10
|
+
import getItemAtPosition from "./getItemAtPosition.mjs";
|
|
10
11
|
import { radiusExtremumGetter, rotationExtremumGetter } from "./extremums.mjs";
|
|
11
12
|
import tooltipGetter from "./tooltip.mjs";
|
|
12
13
|
polarSeriesTypes.addType('radialBar');
|
|
@@ -20,7 +21,7 @@ export const radialBarSeriesConfig = {
|
|
|
20
21
|
rotationExtremumGetter,
|
|
21
22
|
radiusExtremumGetter,
|
|
22
23
|
getSeriesWithDefaultValues,
|
|
23
|
-
|
|
24
|
+
getItemAtPosition,
|
|
24
25
|
keyboardFocusHandler,
|
|
25
26
|
identifierSerializer: identifierSerializerSeriesIdDataIndex,
|
|
26
27
|
identifierCleaner: identifierCleanerSeriesIdDataIndex,
|
|
@@ -45,12 +45,16 @@ function seriesProcessor(params, dataset, isItemVisible) {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
48
|
+
// TODO: fix mui/no-guarded-throw
|
|
49
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
48
50
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Radial bar series with id="${id}" has no data. ` + 'The chart cannot render this series without data. ' + 'Provide a data property to the series or use the dataset prop.' : (0, _formatErrorMessage2.default)(269, id));
|
|
49
51
|
}
|
|
50
52
|
if (process.env.NODE_ENV !== 'production') {
|
|
51
53
|
if (!data && dataset) {
|
|
52
54
|
const dataKey = series[id].dataKey;
|
|
53
55
|
if (!dataKey && !series[id].valueGetter) {
|
|
56
|
+
// TODO: fix mui/no-guarded-throw
|
|
57
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
54
58
|
throw new Error(`MUI X Charts: Radial bar series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
|
|
55
59
|
}
|
|
56
60
|
if (dataKey) {
|
|
@@ -38,12 +38,16 @@ function seriesProcessor(params, dataset, isItemVisible) {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
41
|
+
// TODO: fix mui/no-guarded-throw
|
|
42
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
41
43
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Radial bar series with id="${id}" has no data. ` + 'The chart cannot render this series without data. ' + 'Provide a data property to the series or use the dataset prop.' : _formatErrorMessage(269, id));
|
|
42
44
|
}
|
|
43
45
|
if (process.env.NODE_ENV !== 'production') {
|
|
44
46
|
if (!data && dataset) {
|
|
45
47
|
const dataKey = series[id].dataKey;
|
|
46
48
|
if (!dataKey && !series[id].valueGetter) {
|
|
49
|
+
// TODO: fix mui/no-guarded-throw
|
|
50
|
+
// eslint-disable-next-line mui/no-guarded-throw
|
|
47
51
|
throw new Error(`MUI X Charts: Radial bar series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
|
|
48
52
|
}
|
|
49
53
|
if (dataKey) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartsClipPathProps } from "../ChartsClipPath/index.mjs";
|
|
3
|
+
import { type ChartsRadialGridProps } from "../ChartsRadialGrid/index.mjs";
|
|
4
|
+
import { type ChartsLegendSlotExtension } from "../ChartsLegend/index.mjs";
|
|
5
|
+
import { type ChartsOverlayProps } from "../ChartsOverlay/index.mjs";
|
|
6
|
+
import { type ChartsRadialDataProviderProps } from "../ChartsRadialDataProvider/index.mjs";
|
|
7
|
+
import type { RadialBarChartProps } from "./RadialBarChart.mjs";
|
|
8
|
+
import type { ChartsWrapperProps } from "../ChartsWrapper/index.mjs";
|
|
9
|
+
import type { ChartsRadialAxisHighlightProps } from "../ChartsRadialAxisHighlight/index.mjs";
|
|
10
|
+
import { type RadialBarChartPluginSignatures } from "./RadialBarChart.plugins.mjs";
|
|
11
|
+
/**
|
|
12
|
+
* A helper function that extracts RadialBarChartProps from the input props
|
|
13
|
+
* and returns an object with props for the children components of RadialBarChart.
|
|
14
|
+
*
|
|
15
|
+
* @param props The input props for RadialBarChart
|
|
16
|
+
* @returns An object with props for the children components of RadialBarChart
|
|
17
|
+
*/
|
|
18
|
+
export declare const useRadialBarChartProps: (props: RadialBarChartProps) => {
|
|
19
|
+
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
20
|
+
chartsContainerProps: ChartsRadialDataProviderProps<"radialBar", RadialBarChartPluginSignatures>;
|
|
21
|
+
gridProps: ChartsRadialGridProps | undefined;
|
|
22
|
+
clipPathProps: ChartsClipPathProps;
|
|
23
|
+
clipPathGroupProps: {
|
|
24
|
+
clipPath: string;
|
|
25
|
+
};
|
|
26
|
+
overlayProps: ChartsOverlayProps;
|
|
27
|
+
legendProps: ChartsLegendSlotExtension;
|
|
28
|
+
axisHighlightProps: ChartsRadialAxisHighlightProps;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartsClipPathProps } from "../ChartsClipPath/index.js";
|
|
3
|
+
import { type ChartsRadialGridProps } from "../ChartsRadialGrid/index.js";
|
|
4
|
+
import { type ChartsLegendSlotExtension } from "../ChartsLegend/index.js";
|
|
5
|
+
import { type ChartsOverlayProps } from "../ChartsOverlay/index.js";
|
|
6
|
+
import { type ChartsRadialDataProviderProps } from "../ChartsRadialDataProvider/index.js";
|
|
7
|
+
import type { RadialBarChartProps } from "./RadialBarChart.js";
|
|
8
|
+
import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
9
|
+
import type { ChartsRadialAxisHighlightProps } from "../ChartsRadialAxisHighlight/index.js";
|
|
10
|
+
import { type RadialBarChartPluginSignatures } from "./RadialBarChart.plugins.js";
|
|
11
|
+
/**
|
|
12
|
+
* A helper function that extracts RadialBarChartProps from the input props
|
|
13
|
+
* and returns an object with props for the children components of RadialBarChart.
|
|
14
|
+
*
|
|
15
|
+
* @param props The input props for RadialBarChart
|
|
16
|
+
* @returns An object with props for the children components of RadialBarChart
|
|
17
|
+
*/
|
|
18
|
+
export declare const useRadialBarChartProps: (props: RadialBarChartProps) => {
|
|
19
|
+
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
20
|
+
chartsContainerProps: ChartsRadialDataProviderProps<"radialBar", RadialBarChartPluginSignatures>;
|
|
21
|
+
gridProps: ChartsRadialGridProps | undefined;
|
|
22
|
+
clipPathProps: ChartsClipPathProps;
|
|
23
|
+
clipPathGroupProps: {
|
|
24
|
+
clipPath: string;
|
|
25
|
+
};
|
|
26
|
+
overlayProps: ChartsOverlayProps;
|
|
27
|
+
legendProps: ChartsLegendSlotExtension;
|
|
28
|
+
axisHighlightProps: ChartsRadialAxisHighlightProps;
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
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.useRadialBarChartProps = void 0;
|
|
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 _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
14
|
+
var _RadialBarChart = require("./RadialBarChart.plugins");
|
|
15
|
+
var _constants = require("../constants");
|
|
16
|
+
const _excluded = ["rotationAxis", "radiusAxis", "series", "width", "height", "margin", "colors", "dataset", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "showToolbar", "axisHighlight"];
|
|
17
|
+
/**
|
|
18
|
+
* A helper function that extracts RadialBarChartProps from the input props
|
|
19
|
+
* and returns an object with props for the children components of RadialBarChart.
|
|
20
|
+
*
|
|
21
|
+
* @param props The input props for RadialBarChart
|
|
22
|
+
* @returns An object with props for the children components of RadialBarChart
|
|
23
|
+
*/
|
|
24
|
+
const useRadialBarChartProps = props => {
|
|
25
|
+
const {
|
|
26
|
+
rotationAxis,
|
|
27
|
+
radiusAxis,
|
|
28
|
+
series,
|
|
29
|
+
width,
|
|
30
|
+
height,
|
|
31
|
+
margin,
|
|
32
|
+
colors,
|
|
33
|
+
dataset,
|
|
34
|
+
grid,
|
|
35
|
+
children,
|
|
36
|
+
slots,
|
|
37
|
+
slotProps,
|
|
38
|
+
skipAnimation,
|
|
39
|
+
loading,
|
|
40
|
+
axisHighlight
|
|
41
|
+
} = props,
|
|
42
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
43
|
+
const id = (0, _useId.default)();
|
|
44
|
+
const clipPathId = `${id}-clip-path`;
|
|
45
|
+
const seriesWithDefault = React.useMemo(() => series.map(s => (0, _extends2.default)({
|
|
46
|
+
type: 'radialBar'
|
|
47
|
+
}, s)), [series]);
|
|
48
|
+
const defaultRotationAxis = React.useMemo(() => {
|
|
49
|
+
return [{
|
|
50
|
+
id: _constants.DEFAULT_ROTATION_AXIS_KEY,
|
|
51
|
+
scaleType: 'band',
|
|
52
|
+
data: Array.from({
|
|
53
|
+
length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
|
|
54
|
+
}, (_, index) => index)
|
|
55
|
+
}];
|
|
56
|
+
}, [series, dataset]);
|
|
57
|
+
const chartsContainerProps = (0, _extends2.default)({}, other, {
|
|
58
|
+
series: seriesWithDefault,
|
|
59
|
+
width,
|
|
60
|
+
height,
|
|
61
|
+
margin,
|
|
62
|
+
colors,
|
|
63
|
+
dataset,
|
|
64
|
+
rotationAxis: rotationAxis ?? defaultRotationAxis,
|
|
65
|
+
radiusAxis,
|
|
66
|
+
skipAnimation,
|
|
67
|
+
plugins: _RadialBarChart.RADIAL_BAR_CHART_PLUGINS
|
|
68
|
+
});
|
|
69
|
+
const isHorizontal = series.some(s => s.layout === 'horizontal');
|
|
70
|
+
const axisHighlightProps = (0, _extends2.default)({}, isHorizontal ? {
|
|
71
|
+
radius: 'band'
|
|
72
|
+
} : {
|
|
73
|
+
rotation: 'band'
|
|
74
|
+
}, axisHighlight);
|
|
75
|
+
const gridProps = grid;
|
|
76
|
+
const clipPathGroupProps = {
|
|
77
|
+
clipPath: `url(#${clipPathId})`
|
|
78
|
+
};
|
|
79
|
+
const clipPathProps = {
|
|
80
|
+
id: clipPathId
|
|
81
|
+
};
|
|
82
|
+
const overlayProps = {
|
|
83
|
+
slots,
|
|
84
|
+
slotProps,
|
|
85
|
+
loading
|
|
86
|
+
};
|
|
87
|
+
const legendProps = {
|
|
88
|
+
slots,
|
|
89
|
+
slotProps
|
|
90
|
+
};
|
|
91
|
+
const chartsWrapperProps = {
|
|
92
|
+
legendPosition: props.slotProps?.legend?.position,
|
|
93
|
+
legendDirection: props.slotProps?.legend?.direction,
|
|
94
|
+
hideLegend: props.hideLegend ?? false
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
chartsWrapperProps,
|
|
98
|
+
chartsContainerProps,
|
|
99
|
+
gridProps,
|
|
100
|
+
clipPathProps,
|
|
101
|
+
clipPathGroupProps,
|
|
102
|
+
overlayProps,
|
|
103
|
+
legendProps,
|
|
104
|
+
axisHighlightProps,
|
|
105
|
+
children
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
exports.useRadialBarChartProps = useRadialBarChartProps;
|