@mui/x-charts 9.0.3 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.mts +1 -2
- package/BarChart/BarChart.d.ts +1 -2
- package/BarChart/BarChart.js +2 -913
- package/BarChart/BarChart.mjs +2 -913
- package/BarChart/FocusedBar.js +3 -0
- package/BarChart/FocusedBar.mjs +3 -0
- package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -0
- package/BarChart/seriesConfig/bar/seriesProcessor.mjs +2 -0
- package/CHANGELOG.md +220 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.d.mts +55 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.d.ts +55 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.js +94 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.mjs +88 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.d.mts +13 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.d.ts +13 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.js +86 -0
- package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.mjs +80 -0
- package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.d.mts +18 -0
- package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.d.ts +18 -0
- package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.js +26 -0
- package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.mjs +16 -0
- package/ChartsAxisHighlightValue/index.d.mts +1 -0
- package/ChartsAxisHighlightValue/index.d.ts +1 -0
- package/ChartsAxisHighlightValue/index.js +16 -0
- package/ChartsAxisHighlightValue/index.mjs +1 -0
- package/ChartsAxisHighlightValue/useAxisHighlightValue.d.mts +14 -0
- package/ChartsAxisHighlightValue/useAxisHighlightValue.d.ts +14 -0
- package/ChartsAxisHighlightValue/useAxisHighlightValue.js +130 -0
- package/ChartsAxisHighlightValue/useAxisHighlightValue.mjs +124 -0
- package/ChartsContainer/ChartsContainer.js +4 -1431
- package/ChartsContainer/ChartsContainer.mjs +4 -1431
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.d.mts +15 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.d.ts +15 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.js +56 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.mjs +50 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.mts +6 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.ts +6 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.js +5 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.mjs +1 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.d.mts +11 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.d.ts +11 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.js +70 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.mjs +64 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.d.mts +9 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.d.ts +9 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.js +87 -0
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.mjs +81 -0
- package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.d.mts +9 -0
- package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.d.ts +9 -0
- package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.js +98 -0
- package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.mjs +92 -0
- package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.d.mts +7 -0
- package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.d.ts +7 -0
- package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.js +14 -0
- package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.mjs +6 -0
- package/ChartsRadialAxisHighlight/index.d.mts +5 -0
- package/ChartsRadialAxisHighlight/index.d.ts +5 -0
- package/ChartsRadialAxisHighlight/index.js +47 -0
- package/ChartsRadialAxisHighlight/index.mjs +4 -0
- package/ChartsRadiusAxis/index.d.mts +3 -2
- package/ChartsRadiusAxis/index.d.ts +3 -2
- package/ChartsRadiusAxis/index.mjs +3 -1
- package/ChartsRotationAxis/index.d.mts +3 -2
- package/ChartsRotationAxis/index.d.ts +3 -2
- package/ChartsRotationAxis/index.mjs +3 -1
- package/ChartsTooltip/useAxesTooltip.js +11 -3
- package/ChartsTooltip/useAxesTooltip.mjs +11 -3
- package/ChartsXAxis/useAxisTicksProps.d.mts +162 -81
- package/ChartsXAxis/useAxisTicksProps.d.ts +162 -81
- package/ChartsYAxis/useAxisTicksProps.d.mts +162 -81
- package/ChartsYAxis/useAxisTicksProps.d.ts +162 -81
- package/LICENSE +2 -0
- package/LineChart/FocusedLineMark.js +3 -0
- package/LineChart/FocusedLineMark.mjs +3 -0
- package/LineChart/LineChart.js +2 -913
- package/LineChart/LineChart.mjs +2 -913
- package/LineChart/seriesConfig/curveEvaluation.d.mts +19 -1
- package/LineChart/seriesConfig/curveEvaluation.d.ts +19 -1
- package/LineChart/seriesConfig/curveEvaluation.js +132 -0
- package/LineChart/seriesConfig/curveEvaluation.mjs +131 -0
- package/LineChart/seriesConfig/getItemAtPosition.js +12 -35
- package/LineChart/seriesConfig/getItemAtPosition.mjs +10 -33
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +2 -1
- package/LineChart/seriesConfig/getSeriesWithDefaultValues.mjs +2 -1
- package/LineChart/seriesConfig/seriesProcessor.js +4 -0
- package/LineChart/seriesConfig/seriesProcessor.mjs +4 -0
- package/LineChart/useAreaPlotData.js +4 -0
- package/LineChart/useAreaPlotData.mjs +4 -0
- package/LineChart/useLinePlotData.js +2 -0
- package/LineChart/useLinePlotData.mjs +2 -0
- package/LineChart/useMarkPlotData.js +2 -0
- package/LineChart/useMarkPlotData.mjs +2 -0
- package/PieChart/FocusedPieArc.js +3 -0
- package/PieChart/FocusedPieArc.mjs +3 -0
- package/RadarChart/FocusedRadarMark.js +3 -0
- package/RadarChart/FocusedRadarMark.mjs +3 -0
- package/ScatterChart/FocusedScatterMark.js +10 -21
- package/ScatterChart/FocusedScatterMark.mjs +10 -21
- package/ScatterChart/HighlightedScatterMark.d.mts +11 -0
- package/ScatterChart/HighlightedScatterMark.d.ts +11 -0
- package/ScatterChart/HighlightedScatterMark.js +68 -0
- package/ScatterChart/HighlightedScatterMark.mjs +62 -0
- package/ScatterChart/ScatterChart.d.mts +1 -2
- package/ScatterChart/ScatterChart.d.ts +1 -2
- package/ScatterChart/ScatterChart.js +2 -913
- package/ScatterChart/ScatterChart.mjs +2 -913
- package/ScatterChart/index.d.mts +1 -0
- package/ScatterChart/index.d.ts +1 -0
- package/ScatterChart/index.js +12 -0
- package/ScatterChart/index.mjs +1 -0
- package/ScatterChart/scatterClasses.d.mts +3 -1
- package/ScatterChart/scatterClasses.d.ts +3 -1
- package/ScatterChart/scatterClasses.js +3 -2
- package/ScatterChart/scatterClasses.mjs +3 -2
- package/ScatterChart/useScatterChartProps.js +3 -1
- package/ScatterChart/useScatterChartProps.mjs +3 -1
- package/ScatterChart/useScatterItemPosition.d.mts +16 -0
- package/ScatterChart/useScatterItemPosition.d.ts +16 -0
- package/ScatterChart/useScatterItemPosition.js +47 -0
- package/ScatterChart/useScatterItemPosition.mjs +41 -0
- package/SparkLineChart/SparkLineChart.js +2 -913
- package/SparkLineChart/SparkLineChart.mjs +2 -913
- package/hooks/useAxis.d.mts +3 -3
- package/hooks/useAxis.d.ts +3 -3
- package/hooks/useAxisSystem.d.mts +1 -1
- package/hooks/useAxisSystem.d.ts +1 -1
- package/hooks/useAxisSystem.js +1 -1
- package/hooks/useAxisSystem.mjs +1 -1
- package/index.d.mts +2 -0
- package/index.d.ts +2 -0
- package/index.js +25 -1
- package/index.mjs +3 -1
- package/internals/commonNextFocusItem.js +62 -8
- package/internals/commonNextFocusItem.mjs +62 -8
- package/internals/findClosestIndex.d.mts +5 -0
- package/internals/findClosestIndex.d.ts +5 -0
- package/internals/findClosestIndex.js +27 -0
- package/internals/findClosestIndex.mjs +22 -0
- package/internals/getAsNumber.d.mts +1 -0
- package/internals/getAsNumber.d.ts +1 -0
- package/internals/getAsNumber.js +9 -0
- package/internals/getAsNumber.mjs +3 -0
- package/internals/index.d.mts +6 -0
- package/internals/index.d.ts +6 -0
- package/internals/index.js +60 -0
- package/internals/index.mjs +6 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -2
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.mjs +4 -2
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/polarExtremumGetter.types.d.mts +2 -2
- package/internals/plugins/corePlugins/useChartSeriesConfig/types/polarExtremumGetter.types.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +4 -21
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs +4 -21
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.mts +30 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.ts +30 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.js +57 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.mjs +51 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +7 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.mjs +7 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +7 -1
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.mjs +7 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.mts +4 -7
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +4 -7
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.d.mts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.d.ts +3 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +27 -6
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.mjs +27 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/index.d.mts +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/index.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/index.js +12 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/index.mjs +2 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.mts +4 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.mts +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.mts +1 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +1 -1
- package/models/axis.d.mts +28 -28
- package/models/axis.d.ts +28 -28
- package/models/axis.js +5 -1
- package/models/axis.mjs +5 -1
- package/models/seriesType/line.d.mts +6 -6
- package/models/seriesType/line.d.ts +6 -6
- package/package.json +170 -142
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ChartsRadialAxisHighlightProps } from "./ChartsRadialAxisHighlight.types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Demos:
|
|
4
|
+
*
|
|
5
|
+
* - [Radial Lines](https://mui.com/x/react-charts/radial-lines/)
|
|
6
|
+
*
|
|
7
|
+
* API:
|
|
8
|
+
*
|
|
9
|
+
* - [ChartsRadialAxisHighlight API](https://mui.com/x/api/charts/charts-radial-axis-highlight/)
|
|
10
|
+
*/
|
|
11
|
+
declare function ChartsRadialAxisHighlight(props: ChartsRadialAxisHighlightProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare namespace ChartsRadialAxisHighlight {
|
|
13
|
+
var propTypes: any;
|
|
14
|
+
}
|
|
15
|
+
export { ChartsRadialAxisHighlight };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ChartsRadialAxisHighlightProps } from "./ChartsRadialAxisHighlight.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Demos:
|
|
4
|
+
*
|
|
5
|
+
* - [Radial Lines](https://mui.com/x/react-charts/radial-lines/)
|
|
6
|
+
*
|
|
7
|
+
* API:
|
|
8
|
+
*
|
|
9
|
+
* - [ChartsRadialAxisHighlight API](https://mui.com/x/api/charts/charts-radial-axis-highlight/)
|
|
10
|
+
*/
|
|
11
|
+
declare function ChartsRadialAxisHighlight(props: ChartsRadialAxisHighlightProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare namespace ChartsRadialAxisHighlight {
|
|
13
|
+
var propTypes: any;
|
|
14
|
+
}
|
|
15
|
+
export { ChartsRadialAxisHighlight };
|
|
@@ -0,0 +1,56 @@
|
|
|
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.ChartsRadialAxisHighlight = ChartsRadialAxisHighlight;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
13
|
+
var _chartsRadialAxisHighlightClasses = require("./chartsRadialAxisHighlightClasses");
|
|
14
|
+
var _ChartsRotationAxisHighlight = _interopRequireDefault(require("./ChartsRotationAxisHighlight"));
|
|
15
|
+
var _ChartsRadiusAxisHighlight = _interopRequireDefault(require("./ChartsRadiusAxisHighlight"));
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
const useUtilityClasses = () => {
|
|
18
|
+
const slots = {
|
|
19
|
+
root: ['root']
|
|
20
|
+
};
|
|
21
|
+
return (0, _composeClasses.default)(slots, _chartsRadialAxisHighlightClasses.getRadialAxisHighlightUtilityClass);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Demos:
|
|
26
|
+
*
|
|
27
|
+
* - [Radial Lines](https://mui.com/x/react-charts/radial-lines/)
|
|
28
|
+
*
|
|
29
|
+
* API:
|
|
30
|
+
*
|
|
31
|
+
* - [ChartsRadialAxisHighlight API](https://mui.com/x/api/charts/charts-radial-axis-highlight/)
|
|
32
|
+
*/
|
|
33
|
+
function ChartsRadialAxisHighlight(props) {
|
|
34
|
+
const {
|
|
35
|
+
rotation: rotationHighlight,
|
|
36
|
+
radius: radiusHighlight
|
|
37
|
+
} = props;
|
|
38
|
+
const classes = useUtilityClasses();
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
40
|
+
children: [rotationHighlight && rotationHighlight !== 'none' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsRotationAxisHighlight.default, {
|
|
41
|
+
type: rotationHighlight,
|
|
42
|
+
classes: classes
|
|
43
|
+
}), radiusHighlight && radiusHighlight !== 'none' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsRadiusAxisHighlight.default, {
|
|
44
|
+
type: radiusHighlight,
|
|
45
|
+
classes: classes
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
process.env.NODE_ENV !== "production" ? ChartsRadialAxisHighlight.propTypes = {
|
|
50
|
+
// ----------------------------- Warning --------------------------------
|
|
51
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
52
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
53
|
+
// ----------------------------------------------------------------------
|
|
54
|
+
radius: _propTypes.default.oneOf(['line', 'none']),
|
|
55
|
+
rotation: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
56
|
+
} : void 0;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
6
|
+
import { getRadialAxisHighlightUtilityClass } from "./chartsRadialAxisHighlightClasses.mjs";
|
|
7
|
+
import ChartsRotationAxisHighlight from "./ChartsRotationAxisHighlight.mjs";
|
|
8
|
+
import ChartsRadiusAxisHighlight from "./ChartsRadiusAxisHighlight.mjs";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
const useUtilityClasses = () => {
|
|
11
|
+
const slots = {
|
|
12
|
+
root: ['root']
|
|
13
|
+
};
|
|
14
|
+
return composeClasses(slots, getRadialAxisHighlightUtilityClass);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Demos:
|
|
19
|
+
*
|
|
20
|
+
* - [Radial Lines](https://mui.com/x/react-charts/radial-lines/)
|
|
21
|
+
*
|
|
22
|
+
* API:
|
|
23
|
+
*
|
|
24
|
+
* - [ChartsRadialAxisHighlight API](https://mui.com/x/api/charts/charts-radial-axis-highlight/)
|
|
25
|
+
*/
|
|
26
|
+
function ChartsRadialAxisHighlight(props) {
|
|
27
|
+
const {
|
|
28
|
+
rotation: rotationHighlight,
|
|
29
|
+
radius: radiusHighlight
|
|
30
|
+
} = props;
|
|
31
|
+
const classes = useUtilityClasses();
|
|
32
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
33
|
+
children: [rotationHighlight && rotationHighlight !== 'none' && /*#__PURE__*/_jsx(ChartsRotationAxisHighlight, {
|
|
34
|
+
type: rotationHighlight,
|
|
35
|
+
classes: classes
|
|
36
|
+
}), radiusHighlight && radiusHighlight !== 'none' && /*#__PURE__*/_jsx(ChartsRadiusAxisHighlight, {
|
|
37
|
+
type: radiusHighlight,
|
|
38
|
+
classes: classes
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
process.env.NODE_ENV !== "production" ? ChartsRadialAxisHighlight.propTypes = {
|
|
43
|
+
// ----------------------------- Warning --------------------------------
|
|
44
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
45
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
46
|
+
// ----------------------------------------------------------------------
|
|
47
|
+
radius: PropTypes.oneOf(['line', 'none']),
|
|
48
|
+
rotation: PropTypes.oneOf(['band', 'line', 'none'])
|
|
49
|
+
} : void 0;
|
|
50
|
+
export { ChartsRadialAxisHighlight };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type ChartsRadialAxisHighlightRotationType = 'none' | 'line' | 'band';
|
|
2
|
+
export type ChartsRadialAxisHighlightRadiusType = 'none' | 'line';
|
|
3
|
+
export type ChartsRadialAxisHighlightProps = {
|
|
4
|
+
rotation?: ChartsRadialAxisHighlightRotationType;
|
|
5
|
+
radius?: ChartsRadialAxisHighlightRadiusType;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type ChartsRadialAxisHighlightRotationType = 'none' | 'line' | 'band';
|
|
2
|
+
export type ChartsRadialAxisHighlightRadiusType = 'none' | 'line';
|
|
3
|
+
export type ChartsRadialAxisHighlightProps = {
|
|
4
|
+
rotation?: ChartsRadialAxisHighlightRotationType;
|
|
5
|
+
radius?: ChartsRadialAxisHighlightRadiusType;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ChartsRadialAxisHighlightPathType = 'line' | 'band';
|
|
2
|
+
export declare const ChartsRadialAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
3
|
+
ownerState: {
|
|
4
|
+
axisHighlight: ChartsRadialAxisHighlightPathType;
|
|
5
|
+
};
|
|
6
|
+
}, Pick<import("react").SVGProps<SVGPathElement>, keyof import("react").SVGProps<SVGPathElement>>, {}>;
|
|
7
|
+
export declare const ChartsRadialAxisHighlightCircle: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
8
|
+
ownerState: {
|
|
9
|
+
axisHighlight: ChartsRadialAxisHighlightPathType;
|
|
10
|
+
};
|
|
11
|
+
}, Pick<import("react").SVGProps<SVGCircleElement>, keyof import("react").SVGProps<SVGCircleElement>>, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ChartsRadialAxisHighlightPathType = 'line' | 'band';
|
|
2
|
+
export declare const ChartsRadialAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
3
|
+
ownerState: {
|
|
4
|
+
axisHighlight: ChartsRadialAxisHighlightPathType;
|
|
5
|
+
};
|
|
6
|
+
}, Pick<import("react").SVGProps<SVGPathElement>, keyof import("react").SVGProps<SVGPathElement>>, {}>;
|
|
7
|
+
export declare const ChartsRadialAxisHighlightCircle: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
8
|
+
ownerState: {
|
|
9
|
+
axisHighlight: ChartsRadialAxisHighlightPathType;
|
|
10
|
+
};
|
|
11
|
+
}, Pick<import("react").SVGProps<SVGCircleElement>, keyof import("react").SVGProps<SVGCircleElement>>, {}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ChartsRadialAxisHighlightPath = exports.ChartsRadialAxisHighlightCircle = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
11
|
+
const ChartsRadialAxisHighlightPath = exports.ChartsRadialAxisHighlightPath = (0, _styles.styled)('path', {
|
|
12
|
+
name: 'MuiChartsRadialAxisHighlight',
|
|
13
|
+
slot: 'Root'
|
|
14
|
+
})(({
|
|
15
|
+
theme
|
|
16
|
+
}) => ({
|
|
17
|
+
pointerEvents: 'none',
|
|
18
|
+
variants: [{
|
|
19
|
+
props: {
|
|
20
|
+
axisHighlight: 'band'
|
|
21
|
+
},
|
|
22
|
+
style: (0, _extends2.default)({
|
|
23
|
+
fill: 'white',
|
|
24
|
+
fillOpacity: 0.1
|
|
25
|
+
}, theme.applyStyles('light', {
|
|
26
|
+
fill: 'gray'
|
|
27
|
+
}))
|
|
28
|
+
}, {
|
|
29
|
+
props: {
|
|
30
|
+
axisHighlight: 'line'
|
|
31
|
+
},
|
|
32
|
+
style: (0, _extends2.default)({
|
|
33
|
+
fill: 'none',
|
|
34
|
+
strokeDasharray: '5 2',
|
|
35
|
+
stroke: '#ffffff'
|
|
36
|
+
}, theme.applyStyles('light', {
|
|
37
|
+
stroke: '#000000'
|
|
38
|
+
}))
|
|
39
|
+
}]
|
|
40
|
+
}));
|
|
41
|
+
const ChartsRadialAxisHighlightCircle = exports.ChartsRadialAxisHighlightCircle = (0, _styles.styled)('circle', {
|
|
42
|
+
name: 'MuiChartsRadialAxisHighlight',
|
|
43
|
+
slot: 'Root'
|
|
44
|
+
})(({
|
|
45
|
+
theme
|
|
46
|
+
}) => ({
|
|
47
|
+
pointerEvents: 'none',
|
|
48
|
+
variants: [{
|
|
49
|
+
props: {
|
|
50
|
+
axisHighlight: 'band'
|
|
51
|
+
},
|
|
52
|
+
style: (0, _extends2.default)({
|
|
53
|
+
fill: 'white',
|
|
54
|
+
fillOpacity: 0.1
|
|
55
|
+
}, theme.applyStyles('light', {
|
|
56
|
+
fill: 'gray'
|
|
57
|
+
}))
|
|
58
|
+
}, {
|
|
59
|
+
props: {
|
|
60
|
+
axisHighlight: 'line'
|
|
61
|
+
},
|
|
62
|
+
style: (0, _extends2.default)({
|
|
63
|
+
fill: 'none',
|
|
64
|
+
strokeDasharray: '5 2',
|
|
65
|
+
stroke: '#ffffff'
|
|
66
|
+
}, theme.applyStyles('light', {
|
|
67
|
+
stroke: '#000000'
|
|
68
|
+
}))
|
|
69
|
+
}]
|
|
70
|
+
}));
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
export const ChartsRadialAxisHighlightPath = styled('path', {
|
|
6
|
+
name: 'MuiChartsRadialAxisHighlight',
|
|
7
|
+
slot: 'Root'
|
|
8
|
+
})(({
|
|
9
|
+
theme
|
|
10
|
+
}) => ({
|
|
11
|
+
pointerEvents: 'none',
|
|
12
|
+
variants: [{
|
|
13
|
+
props: {
|
|
14
|
+
axisHighlight: 'band'
|
|
15
|
+
},
|
|
16
|
+
style: _extends({
|
|
17
|
+
fill: 'white',
|
|
18
|
+
fillOpacity: 0.1
|
|
19
|
+
}, theme.applyStyles('light', {
|
|
20
|
+
fill: 'gray'
|
|
21
|
+
}))
|
|
22
|
+
}, {
|
|
23
|
+
props: {
|
|
24
|
+
axisHighlight: 'line'
|
|
25
|
+
},
|
|
26
|
+
style: _extends({
|
|
27
|
+
fill: 'none',
|
|
28
|
+
strokeDasharray: '5 2',
|
|
29
|
+
stroke: '#ffffff'
|
|
30
|
+
}, theme.applyStyles('light', {
|
|
31
|
+
stroke: '#000000'
|
|
32
|
+
}))
|
|
33
|
+
}]
|
|
34
|
+
}));
|
|
35
|
+
export const ChartsRadialAxisHighlightCircle = styled('circle', {
|
|
36
|
+
name: 'MuiChartsRadialAxisHighlight',
|
|
37
|
+
slot: 'Root'
|
|
38
|
+
})(({
|
|
39
|
+
theme
|
|
40
|
+
}) => ({
|
|
41
|
+
pointerEvents: 'none',
|
|
42
|
+
variants: [{
|
|
43
|
+
props: {
|
|
44
|
+
axisHighlight: 'band'
|
|
45
|
+
},
|
|
46
|
+
style: _extends({
|
|
47
|
+
fill: 'white',
|
|
48
|
+
fillOpacity: 0.1
|
|
49
|
+
}, theme.applyStyles('light', {
|
|
50
|
+
fill: 'gray'
|
|
51
|
+
}))
|
|
52
|
+
}, {
|
|
53
|
+
props: {
|
|
54
|
+
axisHighlight: 'line'
|
|
55
|
+
},
|
|
56
|
+
style: _extends({
|
|
57
|
+
fill: 'none',
|
|
58
|
+
strokeDasharray: '5 2',
|
|
59
|
+
stroke: '#ffffff'
|
|
60
|
+
}, theme.applyStyles('light', {
|
|
61
|
+
stroke: '#000000'
|
|
62
|
+
}))
|
|
63
|
+
}]
|
|
64
|
+
}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ChartsRadialAxisHighlightRadiusType } from "./ChartsRadialAxisHighlight.types.mjs";
|
|
2
|
+
import { type ChartsRadialAxisHighlightClasses } from "./chartsRadialAxisHighlightClasses.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* @ignore - internal component.
|
|
5
|
+
*/
|
|
6
|
+
export default function ChartsRadiusAxisHighlight(props: {
|
|
7
|
+
type: ChartsRadialAxisHighlightRadiusType;
|
|
8
|
+
classes: ChartsRadialAxisHighlightClasses;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ChartsRadialAxisHighlightRadiusType } from "./ChartsRadialAxisHighlight.types.js";
|
|
2
|
+
import { type ChartsRadialAxisHighlightClasses } from "./chartsRadialAxisHighlightClasses.js";
|
|
3
|
+
/**
|
|
4
|
+
* @ignore - internal component.
|
|
5
|
+
*/
|
|
6
|
+
export default function ChartsRadiusAxisHighlight(props: {
|
|
7
|
+
type: ChartsRadialAxisHighlightRadiusType;
|
|
8
|
+
classes: ChartsRadialAxisHighlightClasses;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,87 @@
|
|
|
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.default = ChartsRadiusAxisHighlight;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _useStore = require("../internals/store/useStore");
|
|
11
|
+
var _useChartPolarAxis = require("../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
12
|
+
var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
|
|
13
|
+
var _ChartsRadialAxisHighlightPath = require("./ChartsRadialAxisHighlightPath");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function polarToSvg(cx, cy, radius, angle) {
|
|
16
|
+
return [cx + radius * Math.sin(angle), cy - radius * Math.cos(angle)];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @ignore - internal component.
|
|
21
|
+
*/
|
|
22
|
+
function ChartsRadiusAxisHighlight(props) {
|
|
23
|
+
const {
|
|
24
|
+
type,
|
|
25
|
+
classes
|
|
26
|
+
} = props;
|
|
27
|
+
const store = (0, _useStore.useStore)();
|
|
28
|
+
const {
|
|
29
|
+
cx,
|
|
30
|
+
cy
|
|
31
|
+
} = store.use(_useChartPolarAxis.selectorChartPolarCenter);
|
|
32
|
+
const {
|
|
33
|
+
axis: radiusAxes,
|
|
34
|
+
axisIds: radiusAxisIds
|
|
35
|
+
} = store.use(_useChartPolarAxis.selectorChartRadiusAxis);
|
|
36
|
+
const {
|
|
37
|
+
axis: rotationAxes,
|
|
38
|
+
axisIds: rotationAxisIds
|
|
39
|
+
} = store.use(_useChartPolarAxis.selectorChartRotationAxis);
|
|
40
|
+
const pointerX = store.use(_useChartInteraction.selectorChartsInteractionPointerX);
|
|
41
|
+
const pointerY = store.use(_useChartInteraction.selectorChartsInteractionPointerY);
|
|
42
|
+
if (pointerX === null || pointerY === null) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const radiusAxisId = radiusAxisIds[0];
|
|
46
|
+
if (radiusAxisId === undefined) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const radiusAxis = radiusAxes[radiusAxisId];
|
|
50
|
+
const radiusScale = radiusAxis.scale;
|
|
51
|
+
const innerRadius = radiusScale.range()[0];
|
|
52
|
+
const outerRadius = radiusScale.range()[1];
|
|
53
|
+
const pointerRadius = Math.sqrt((pointerX - cx) ** 2 + (pointerY - cy) ** 2);
|
|
54
|
+
if (pointerRadius < innerRadius || pointerRadius > outerRadius) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (type === 'line') {
|
|
58
|
+
const rotationAxisId = rotationAxisIds[0];
|
|
59
|
+
const rotationAxis = rotationAxisId !== undefined ? rotationAxes[rotationAxisId] : undefined;
|
|
60
|
+
const startAngle = rotationAxis?.scale.range()[0] ?? 0;
|
|
61
|
+
const endAngle = rotationAxis?.scale.range()[1] ?? 2 * Math.PI;
|
|
62
|
+
const isFullCircle = rotationAxis?.isFullCircle ?? Math.abs(endAngle - startAngle) >= 2 * Math.PI;
|
|
63
|
+
if (isFullCircle) {
|
|
64
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsRadialAxisHighlightPath.ChartsRadialAxisHighlightCircle, {
|
|
65
|
+
cx: cx,
|
|
66
|
+
cy: cy,
|
|
67
|
+
r: pointerRadius,
|
|
68
|
+
className: classes.root,
|
|
69
|
+
ownerState: {
|
|
70
|
+
axisHighlight: 'line'
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const [startX, startY] = polarToSvg(cx, cy, pointerRadius, startAngle);
|
|
75
|
+
const [endX, endY] = polarToSvg(cx, cy, pointerRadius, endAngle);
|
|
76
|
+
const isLargeArc = Math.abs(endAngle - startAngle) >= Math.PI;
|
|
77
|
+
const isDirectArc = endAngle > startAngle;
|
|
78
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsRadialAxisHighlightPath.ChartsRadialAxisHighlightPath, {
|
|
79
|
+
d: `M ${startX} ${startY} A ${pointerRadius} ${pointerRadius} 0 ${isLargeArc ? 1 : 0} ${isDirectArc ? 1 : 0} ${endX} ${endY}`,
|
|
80
|
+
className: classes.root,
|
|
81
|
+
ownerState: {
|
|
82
|
+
axisHighlight: 'line'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useStore } from "../internals/store/useStore.mjs";
|
|
5
|
+
import { selectorChartPolarCenter, selectorChartRadiusAxis, selectorChartRotationAxis } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.mjs";
|
|
6
|
+
import { selectorChartsInteractionPointerX, selectorChartsInteractionPointerY } from "../internals/plugins/featurePlugins/useChartInteraction/index.mjs";
|
|
7
|
+
import { ChartsRadialAxisHighlightCircle, ChartsRadialAxisHighlightPath } from "./ChartsRadialAxisHighlightPath.mjs";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
function polarToSvg(cx, cy, radius, angle) {
|
|
10
|
+
return [cx + radius * Math.sin(angle), cy - radius * Math.cos(angle)];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @ignore - internal component.
|
|
15
|
+
*/
|
|
16
|
+
export default function ChartsRadiusAxisHighlight(props) {
|
|
17
|
+
const {
|
|
18
|
+
type,
|
|
19
|
+
classes
|
|
20
|
+
} = props;
|
|
21
|
+
const store = useStore();
|
|
22
|
+
const {
|
|
23
|
+
cx,
|
|
24
|
+
cy
|
|
25
|
+
} = store.use(selectorChartPolarCenter);
|
|
26
|
+
const {
|
|
27
|
+
axis: radiusAxes,
|
|
28
|
+
axisIds: radiusAxisIds
|
|
29
|
+
} = store.use(selectorChartRadiusAxis);
|
|
30
|
+
const {
|
|
31
|
+
axis: rotationAxes,
|
|
32
|
+
axisIds: rotationAxisIds
|
|
33
|
+
} = store.use(selectorChartRotationAxis);
|
|
34
|
+
const pointerX = store.use(selectorChartsInteractionPointerX);
|
|
35
|
+
const pointerY = store.use(selectorChartsInteractionPointerY);
|
|
36
|
+
if (pointerX === null || pointerY === null) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const radiusAxisId = radiusAxisIds[0];
|
|
40
|
+
if (radiusAxisId === undefined) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const radiusAxis = radiusAxes[radiusAxisId];
|
|
44
|
+
const radiusScale = radiusAxis.scale;
|
|
45
|
+
const innerRadius = radiusScale.range()[0];
|
|
46
|
+
const outerRadius = radiusScale.range()[1];
|
|
47
|
+
const pointerRadius = Math.sqrt((pointerX - cx) ** 2 + (pointerY - cy) ** 2);
|
|
48
|
+
if (pointerRadius < innerRadius || pointerRadius > outerRadius) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
if (type === 'line') {
|
|
52
|
+
const rotationAxisId = rotationAxisIds[0];
|
|
53
|
+
const rotationAxis = rotationAxisId !== undefined ? rotationAxes[rotationAxisId] : undefined;
|
|
54
|
+
const startAngle = rotationAxis?.scale.range()[0] ?? 0;
|
|
55
|
+
const endAngle = rotationAxis?.scale.range()[1] ?? 2 * Math.PI;
|
|
56
|
+
const isFullCircle = rotationAxis?.isFullCircle ?? Math.abs(endAngle - startAngle) >= 2 * Math.PI;
|
|
57
|
+
if (isFullCircle) {
|
|
58
|
+
return /*#__PURE__*/_jsx(ChartsRadialAxisHighlightCircle, {
|
|
59
|
+
cx: cx,
|
|
60
|
+
cy: cy,
|
|
61
|
+
r: pointerRadius,
|
|
62
|
+
className: classes.root,
|
|
63
|
+
ownerState: {
|
|
64
|
+
axisHighlight: 'line'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const [startX, startY] = polarToSvg(cx, cy, pointerRadius, startAngle);
|
|
69
|
+
const [endX, endY] = polarToSvg(cx, cy, pointerRadius, endAngle);
|
|
70
|
+
const isLargeArc = Math.abs(endAngle - startAngle) >= Math.PI;
|
|
71
|
+
const isDirectArc = endAngle > startAngle;
|
|
72
|
+
return /*#__PURE__*/_jsx(ChartsRadialAxisHighlightPath, {
|
|
73
|
+
d: `M ${startX} ${startY} A ${pointerRadius} ${pointerRadius} 0 ${isLargeArc ? 1 : 0} ${isDirectArc ? 1 : 0} ${endX} ${endY}`,
|
|
74
|
+
className: classes.root,
|
|
75
|
+
ownerState: {
|
|
76
|
+
axisHighlight: 'line'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ChartsRadialAxisHighlightRotationType } from "./ChartsRadialAxisHighlight.types.mjs";
|
|
2
|
+
import { type ChartsRadialAxisHighlightClasses } from "./chartsRadialAxisHighlightClasses.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* @ignore - internal component.
|
|
5
|
+
*/
|
|
6
|
+
export default function ChartsRotationAxisHighlight(props: {
|
|
7
|
+
type: ChartsRadialAxisHighlightRotationType;
|
|
8
|
+
classes: ChartsRadialAxisHighlightClasses;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ChartsRadialAxisHighlightRotationType } from "./ChartsRadialAxisHighlight.types.js";
|
|
2
|
+
import { type ChartsRadialAxisHighlightClasses } from "./chartsRadialAxisHighlightClasses.js";
|
|
3
|
+
/**
|
|
4
|
+
* @ignore - internal component.
|
|
5
|
+
*/
|
|
6
|
+
export default function ChartsRotationAxisHighlight(props: {
|
|
7
|
+
type: ChartsRadialAxisHighlightRotationType;
|
|
8
|
+
classes: ChartsRadialAxisHighlightClasses;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,98 @@
|
|
|
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.default = ChartsRotationAxisHighlight;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
11
|
+
var _useStore = require("../internals/store/useStore");
|
|
12
|
+
var _useChartPolarAxis = require("../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
13
|
+
var _useChartPolarInteraction = require("../internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors");
|
|
14
|
+
var _ChartsRadialAxisHighlightPath = require("./ChartsRadialAxisHighlightPath");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
function polarToSvg(cx, cy, radius, angle) {
|
|
17
|
+
return [cx + radius * Math.sin(angle), cy - radius * Math.cos(angle)];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @ignore - internal component.
|
|
22
|
+
*/
|
|
23
|
+
function ChartsRotationAxisHighlight(props) {
|
|
24
|
+
const {
|
|
25
|
+
type,
|
|
26
|
+
classes
|
|
27
|
+
} = props;
|
|
28
|
+
const store = (0, _useStore.useStore)();
|
|
29
|
+
const {
|
|
30
|
+
cx,
|
|
31
|
+
cy
|
|
32
|
+
} = store.use(_useChartPolarAxis.selectorChartPolarCenter);
|
|
33
|
+
const {
|
|
34
|
+
axis: rotationAxes,
|
|
35
|
+
axisIds: rotationAxisIds
|
|
36
|
+
} = store.use(_useChartPolarAxis.selectorChartRotationAxis);
|
|
37
|
+
const {
|
|
38
|
+
axis: radiusAxes,
|
|
39
|
+
axisIds: radiusAxisIds
|
|
40
|
+
} = store.use(_useChartPolarAxis.selectorChartRadiusAxis);
|
|
41
|
+
const rotationIndex = store.use(_useChartPolarInteraction.selectorChartsInteractionRotationAxisIndex);
|
|
42
|
+
const rotationValue = store.use(_useChartPolarInteraction.selectorChartsInteractionRotationAxisValue);
|
|
43
|
+
if (rotationIndex === null || rotationIndex === -1) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const rotationAxisId = rotationAxisIds[0];
|
|
47
|
+
const radiusAxisId = radiusAxisIds[0];
|
|
48
|
+
if (rotationAxisId === undefined || radiusAxisId === undefined) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
const rotationAxis = rotationAxes[rotationAxisId];
|
|
52
|
+
const radiusAxis = radiusAxes[radiusAxisId];
|
|
53
|
+
const rotationScale = rotationAxis.scale;
|
|
54
|
+
const radiusScale = radiusAxis.scale;
|
|
55
|
+
const innerRadius = radiusScale.range()[0];
|
|
56
|
+
const outerRadius = radiusScale.range()[1];
|
|
57
|
+
const angle = rotationScale(rotationValue);
|
|
58
|
+
if (angle === undefined) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
if (type === 'band') {
|
|
62
|
+
if (!(0, _scaleGuards.isOrdinalScale)(rotationScale)) {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
const step = rotationScale.step();
|
|
66
|
+
const bandwidth = rotationScale.bandwidth();
|
|
67
|
+
// For point scale: bandwidth = 0, the band is centered on the value.
|
|
68
|
+
// For band scale: scale(value) returns the band start, the band size is bandwidth.
|
|
69
|
+
const startAngle = angle - (step - bandwidth) / 2;
|
|
70
|
+
const endAngle = startAngle + step;
|
|
71
|
+
const [x1Outer, y1Outer] = polarToSvg(cx, cy, outerRadius, startAngle);
|
|
72
|
+
const [x2Outer, y2Outer] = polarToSvg(cx, cy, outerRadius, endAngle);
|
|
73
|
+
const [x1Inner, y1Inner] = polarToSvg(cx, cy, innerRadius, startAngle);
|
|
74
|
+
const [x2Inner, y2Inner] = polarToSvg(cx, cy, innerRadius, endAngle);
|
|
75
|
+
const isLargeArc = Math.abs(endAngle - startAngle) >= Math.PI;
|
|
76
|
+
const innerArc = innerRadius > 0 ? `L ${x2Inner} ${y2Inner} A ${innerRadius} ${innerRadius} 0 ${isLargeArc ? 1 : 0} 0 ${x1Inner} ${y1Inner}` : `L ${cx} ${cy}`;
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsRadialAxisHighlightPath.ChartsRadialAxisHighlightPath, {
|
|
78
|
+
d: `M ${x1Outer} ${y1Outer} A ${outerRadius} ${outerRadius} 0 ${isLargeArc ? 1 : 0} 1 ${x2Outer} ${y2Outer} ${innerArc} Z`,
|
|
79
|
+
className: classes.root,
|
|
80
|
+
ownerState: {
|
|
81
|
+
axisHighlight: 'band'
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
if (type === 'line') {
|
|
86
|
+
const lineAngle = (0, _scaleGuards.isOrdinalScale)(rotationScale) ? angle + rotationScale.bandwidth() / 2 : angle;
|
|
87
|
+
const [x1, y1] = polarToSvg(cx, cy, innerRadius, lineAngle);
|
|
88
|
+
const [x2, y2] = polarToSvg(cx, cy, outerRadius, lineAngle);
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsRadialAxisHighlightPath.ChartsRadialAxisHighlightPath, {
|
|
90
|
+
d: `M ${x1} ${y1} L ${x2} ${y2}`,
|
|
91
|
+
className: classes.root,
|
|
92
|
+
ownerState: {
|
|
93
|
+
axisHighlight: 'line'
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|