@mui/x-charts 8.7.0 → 8.9.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.ts +4 -3
- package/BarChart/BarChart.js +17 -1
- package/BarChart/barClasses.d.ts +1 -1
- package/BarChart/seriesConfig/seriesProcessor.js +5 -3
- package/BarChart/useBarPlotData.js +32 -5
- package/CHANGELOG.md +199 -24
- package/ChartContainer/ChartContainer.js +22 -0
- package/ChartContainer/useChartContainerProps.js +8 -2
- package/ChartDataProvider/ChartDataProvider.js +6 -0
- package/ChartDataProvider/useChartDataProviderProps.d.ts +1 -1
- package/ChartDataProvider/useChartDataProviderProps.js +6 -1
- package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +34 -24
- package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +34 -24
- package/ChartsLabel/ChartsLabelMark.d.ts +2 -1
- package/ChartsLabel/index.d.ts +1 -0
- package/ChartsLabel/index.js +18 -0
- package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
- package/Gauge/GaugeContainer.d.ts +1 -1
- package/LineChart/LineChart.d.ts +3 -2
- package/LineChart/LineChart.js +23 -1
- package/LineChart/LineHighlightPlot.js +10 -4
- package/LineChart/MarkPlot.js +17 -3
- package/LineChart/useAreaPlotData.js +3 -2
- package/PieChart/PieArcLabelPlot.js +3 -0
- package/PieChart/PieArcPlot.js +3 -0
- package/PieChart/PieChart.d.ts +4 -3
- package/PieChart/PieChart.js +1 -1
- package/PieChart/pieClasses.d.ts +1 -1
- package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +3 -5
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.d.ts +2 -13
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +8 -45
- package/RadarChart/RadarChart.d.ts +2 -1
- package/RadarChart/RadarChart.js +23 -2
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +4 -3
- package/RadarChart/RadarMetricLabels/useRadarMetricData.js +4 -2
- package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +19 -3
- package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +20 -4
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +38 -4
- package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +32 -3
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.d.ts +8 -0
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +38 -0
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
- package/RadarChart/index.d.ts +1 -1
- package/RadarChart/useRadarChartProps.d.ts +3 -0
- package/RadarChart/useRadarChartProps.js +15 -3
- package/ScatterChart/ScatterChart.d.ts +4 -3
- package/ScatterChart/ScatterChart.js +1 -1
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/seriesConfig/seriesProcessor.js +3 -0
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +16 -0
- package/esm/BarChart/BarChart.d.ts +4 -3
- package/esm/BarChart/BarChart.js +17 -1
- package/esm/BarChart/barClasses.d.ts +1 -1
- package/esm/BarChart/seriesConfig/seriesProcessor.js +5 -3
- package/esm/BarChart/useBarPlotData.js +32 -5
- package/esm/ChartContainer/ChartContainer.js +22 -0
- package/esm/ChartContainer/useChartContainerProps.js +8 -2
- package/esm/ChartDataProvider/ChartDataProvider.js +6 -0
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +1 -1
- package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -2
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +1 -1
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +36 -26
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +1 -1
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +36 -26
- package/esm/ChartsLabel/ChartsLabelMark.d.ts +2 -1
- package/esm/ChartsLabel/index.d.ts +1 -0
- package/esm/ChartsLabel/index.js +1 -0
- package/esm/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
- package/esm/Gauge/GaugeContainer.d.ts +1 -1
- package/esm/LineChart/LineChart.d.ts +3 -2
- package/esm/LineChart/LineChart.js +23 -1
- package/esm/LineChart/LineHighlightPlot.js +11 -5
- package/esm/LineChart/MarkPlot.js +17 -3
- package/esm/LineChart/useAreaPlotData.js +3 -2
- package/esm/PieChart/PieArcLabelPlot.js +3 -0
- package/esm/PieChart/PieArcPlot.js +3 -0
- package/esm/PieChart/PieChart.d.ts +4 -3
- package/esm/PieChart/PieChart.js +1 -1
- package/esm/PieChart/pieClasses.d.ts +1 -1
- package/esm/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +3 -5
- package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.d.ts +2 -13
- package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +8 -45
- package/esm/RadarChart/RadarChart.d.ts +2 -1
- package/esm/RadarChart/RadarChart.js +23 -2
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +4 -3
- package/esm/RadarChart/RadarMetricLabels/useRadarMetricData.js +4 -2
- package/esm/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +19 -3
- package/esm/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +20 -4
- package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +38 -4
- package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +32 -3
- package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.d.ts +8 -0
- package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +32 -0
- package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
- package/esm/RadarChart/index.d.ts +1 -1
- package/esm/RadarChart/useRadarChartProps.d.ts +3 -0
- package/esm/RadarChart/useRadarChartProps.js +15 -3
- package/esm/ScatterChart/ScatterChart.d.ts +4 -3
- package/esm/ScatterChart/ScatterChart.js +1 -1
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/seriesConfig/seriesProcessor.js +3 -0
- package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +16 -0
- package/esm/hooks/useAxis.d.ts +2 -2
- package/esm/hooks/useTicks.d.ts +6 -1
- package/esm/hooks/useTicks.js +94 -58
- package/esm/index.js +1 -1
- package/esm/internals/constants.d.ts +3 -0
- package/esm/internals/constants.js +4 -0
- package/esm/internals/getLabel.d.ts +1 -1
- package/esm/internals/index.d.ts +1 -0
- package/esm/internals/index.js +1 -0
- package/esm/internals/plugins/corePlugins/corePlugins.d.ts +3 -2
- package/esm/internals/plugins/corePlugins/corePlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/index.d.ts +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/index.js +2 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js +27 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +8 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +21 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js +1 -0
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +7 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.js +14 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +46 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +18 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +76 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +47 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +48 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +18 -12
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +16 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +6 -1
- package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.js +19 -11
- package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.js +19 -11
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -4
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +4 -4
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +44 -1
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +8 -1
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +7 -8
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
- package/esm/internals/plugins/utils/useLazySelectorEffect.d.ts +7 -0
- package/esm/internals/plugins/utils/useLazySelectorEffect.js +70 -0
- package/esm/internals/store/useCharts.d.ts +1 -1
- package/esm/models/axis.d.ts +42 -1
- package/esm/models/axis.js +4 -0
- package/esm/models/index.d.ts +1 -1
- package/esm/models/seriesType/bar.d.ts +11 -1
- package/esm/models/seriesType/common.d.ts +9 -3
- package/esm/models/seriesType/line.d.ts +3 -1
- package/esm/models/seriesType/scatter.d.ts +14 -2
- package/esm/tests/web-components.js +49 -0
- package/esm/themeAugmentation/components.d.ts +3 -0
- package/esm/themeAugmentation/props.d.ts +2 -0
- package/hooks/useAxis.d.ts +2 -2
- package/hooks/useTicks.d.ts +6 -1
- package/hooks/useTicks.js +95 -58
- package/index.js +1 -1
- package/internals/constants.d.ts +3 -0
- package/internals/constants.js +5 -1
- package/internals/getLabel.d.ts +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +8 -0
- package/internals/plugins/corePlugins/corePlugins.d.ts +3 -2
- package/internals/plugins/corePlugins/corePlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
- package/internals/plugins/corePlugins/useChartExperimentalFeature/index.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/index.js +27 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js +34 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +8 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +10 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +21 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js +5 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +7 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.js +21 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +24 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +46 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +18 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +82 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +47 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +55 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +18 -12
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +18 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +6 -1
- package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.js +20 -13
- package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.js +20 -13
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -4
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +4 -4
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +44 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +8 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +7 -8
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
- package/internals/plugins/utils/useLazySelectorEffect.d.ts +7 -0
- package/internals/plugins/utils/useLazySelectorEffect.js +77 -0
- package/internals/store/useCharts.d.ts +1 -1
- package/models/axis.d.ts +42 -1
- package/models/axis.js +4 -0
- package/models/index.d.ts +1 -1
- package/models/seriesType/bar.d.ts +11 -1
- package/models/seriesType/common.d.ts +9 -3
- package/models/seriesType/line.d.ts +3 -1
- package/models/seriesType/scatter.d.ts +14 -2
- package/package.json +5 -5
- package/tests/web-components.js +55 -0
- package/themeAugmentation/components.d.ts +3 -0
- package/themeAugmentation/props.d.ts +2 -0
|
@@ -11,7 +11,12 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var _styles = require("@mui/material/styles");
|
|
12
12
|
var _allPlugins = require("../internals/plugins/allPlugins");
|
|
13
13
|
const _excluded = ["children", "localeText", "plugins", "seriesConfig", "slots", "slotProps"];
|
|
14
|
-
const useChartDataProviderProps =
|
|
14
|
+
const useChartDataProviderProps = inProps => {
|
|
15
|
+
// eslint-disable-next-line material-ui/mui-name-matches-component-name
|
|
16
|
+
const props = (0, _styles.useThemeProps)({
|
|
17
|
+
props: inProps,
|
|
18
|
+
name: 'MuiChartDataProvider'
|
|
19
|
+
});
|
|
15
20
|
const {
|
|
16
21
|
children,
|
|
17
22
|
localeText,
|
|
@@ -26,32 +26,42 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
26
26
|
top,
|
|
27
27
|
height
|
|
28
28
|
} = (0, _hooks.useDrawingArea)();
|
|
29
|
-
const xScale = (0, _useScale.useXScale)();
|
|
30
29
|
const store = (0, _useStore.useStore)();
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const isError = isBandScaleX && xScale(axisXValue) === undefined;
|
|
36
|
-
if (isError) {
|
|
37
|
-
console.error([`MUI X Charts: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
38
|
-
}
|
|
30
|
+
const axisXValues = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsHighlightXAxisValue);
|
|
31
|
+
const xAxes = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartXAxis);
|
|
32
|
+
if (axisXValues.length === 0) {
|
|
33
|
+
return null;
|
|
39
34
|
}
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
ownerState: {
|
|
53
|
-
axisHighlight: 'line'
|
|
35
|
+
return axisXValues.map(({
|
|
36
|
+
axisId,
|
|
37
|
+
value
|
|
38
|
+
}) => {
|
|
39
|
+
const xAxis = xAxes.axis[axisId];
|
|
40
|
+
const xScale = xAxis.scale;
|
|
41
|
+
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
42
|
+
const isBandScaleX = type === 'band' && value !== null && (0, _isBandScale.isBandScale)(xScale);
|
|
43
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
+
const isError = isBandScaleX && xScale(value) === undefined;
|
|
45
|
+
if (isError) {
|
|
46
|
+
console.error([`MUI X Charts: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
54
47
|
}
|
|
55
|
-
}
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
50
|
+
children: [isBandScaleX && xScale(value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath
|
|
51
|
+
// @ts-expect-error, xScale value is checked in the statement above
|
|
52
|
+
, {
|
|
53
|
+
d: `M ${xScale(value) - (xScale.step() - xScale.bandwidth()) / 2} ${top} l ${xScale.step()} 0 l 0 ${height} l ${-xScale.step()} 0 Z`,
|
|
54
|
+
className: classes.root,
|
|
55
|
+
ownerState: {
|
|
56
|
+
axisHighlight: 'band'
|
|
57
|
+
}
|
|
58
|
+
}), type === 'line' && value !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath, {
|
|
59
|
+
d: `M ${getXPosition(value)} ${top} L ${getXPosition(value)} ${top + height}`,
|
|
60
|
+
className: classes.root,
|
|
61
|
+
ownerState: {
|
|
62
|
+
axisHighlight: 'line'
|
|
63
|
+
}
|
|
64
|
+
})]
|
|
65
|
+
}, `${axisId}-${value}`);
|
|
56
66
|
});
|
|
57
67
|
}
|
|
@@ -26,32 +26,42 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
26
26
|
left,
|
|
27
27
|
width
|
|
28
28
|
} = (0, _hooks.useDrawingArea)();
|
|
29
|
-
const yScale = (0, _useScale.useYScale)();
|
|
30
29
|
const store = (0, _useStore.useStore)();
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const isError = isBandScaleY && yScale(axisYValue) === undefined;
|
|
36
|
-
if (isError) {
|
|
37
|
-
console.error([`MUI X Charts: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
38
|
-
}
|
|
30
|
+
const axisYValues = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsHighlightYAxisValue);
|
|
31
|
+
const yAxes = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartYAxis);
|
|
32
|
+
if (axisYValues.length === 0) {
|
|
33
|
+
return null;
|
|
39
34
|
}
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
ownerState: {
|
|
53
|
-
axisHighlight: 'line'
|
|
35
|
+
return axisYValues.map(({
|
|
36
|
+
axisId,
|
|
37
|
+
value
|
|
38
|
+
}) => {
|
|
39
|
+
const yAxis = yAxes.axis[axisId];
|
|
40
|
+
const yScale = yAxis.scale;
|
|
41
|
+
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
42
|
+
const isBandScaleY = type === 'band' && value !== null && (0, _isBandScale.isBandScale)(yScale);
|
|
43
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
44
|
+
const isError = isBandScaleY && yScale(value) === undefined;
|
|
45
|
+
if (isError) {
|
|
46
|
+
console.error([`MUI X Charts: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
54
47
|
}
|
|
55
|
-
}
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
50
|
+
children: [isBandScaleY && yScale(value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath, {
|
|
51
|
+
d: `M ${left} ${
|
|
52
|
+
// @ts-expect-error, yScale value is checked in the statement above
|
|
53
|
+
yScale(value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${width} 0 l 0 ${-yScale.step()} Z`,
|
|
54
|
+
className: classes.root,
|
|
55
|
+
ownerState: {
|
|
56
|
+
axisHighlight: 'band'
|
|
57
|
+
}
|
|
58
|
+
}), type === 'line' && value !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlightPath.ChartsAxisHighlightPath, {
|
|
59
|
+
d: `M ${left} ${getYPosition(value)} L ${left + width} ${getYPosition(value)}`,
|
|
60
|
+
className: classes.root,
|
|
61
|
+
ownerState: {
|
|
62
|
+
axisHighlight: 'line'
|
|
63
|
+
}
|
|
64
|
+
})]
|
|
65
|
+
}, `${axisId}-${value}`);
|
|
56
66
|
});
|
|
57
67
|
}
|
|
@@ -6,12 +6,13 @@ export interface ChartsLabelCustomMarkProps {
|
|
|
6
6
|
/** Color of the series this mark refers to. */
|
|
7
7
|
color?: string;
|
|
8
8
|
}
|
|
9
|
+
export type ChartsLabelMarkType = 'square' | 'circle' | 'line' | React.ComponentType<ChartsLabelCustomMarkProps>;
|
|
9
10
|
export interface ChartsLabelMarkProps {
|
|
10
11
|
/**
|
|
11
12
|
* The type of the mark.
|
|
12
13
|
* @default 'square'
|
|
13
14
|
*/
|
|
14
|
-
type?:
|
|
15
|
+
type?: ChartsLabelMarkType;
|
|
15
16
|
/**
|
|
16
17
|
* The color of the mark.
|
|
17
18
|
*/
|
package/ChartsLabel/index.d.ts
CHANGED
package/ChartsLabel/index.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
ChartsLabelMark: true,
|
|
8
|
+
labelClasses: true,
|
|
9
|
+
labelMarkClasses: true,
|
|
10
|
+
labelGradientClasses: true
|
|
11
|
+
};
|
|
6
12
|
Object.defineProperty(exports, "ChartsLabelMark", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -27,6 +33,18 @@ Object.defineProperty(exports, "labelMarkClasses", {
|
|
|
27
33
|
return _labelMarkClasses.labelMarkClasses;
|
|
28
34
|
}
|
|
29
35
|
});
|
|
36
|
+
var _ChartsLabel = require("./ChartsLabel");
|
|
37
|
+
Object.keys(_ChartsLabel).forEach(function (key) {
|
|
38
|
+
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
+
if (key in exports && exports[key] === _ChartsLabel[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _ChartsLabel[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
30
48
|
var _ChartsLabelMark = require("./ChartsLabelMark");
|
|
31
49
|
var _labelClasses = require("./labelClasses");
|
|
32
50
|
var _labelMarkClasses = require("./labelMarkClasses");
|
|
@@ -16,5 +16,5 @@ export interface ChartsLegendClasses {
|
|
|
16
16
|
/** Styles applied to the legend in row layout. */
|
|
17
17
|
horizontal: string;
|
|
18
18
|
}
|
|
19
|
-
export declare const useUtilityClasses: (props: ChartsLegendProps & ChartsLegendSlotExtension) => Record<"
|
|
19
|
+
export declare const useUtilityClasses: (props: ChartsLegendProps & ChartsLegendSlotExtension) => Record<"item" | "series" | "root" | "label" | "mark", string>;
|
|
20
20
|
export declare const legendClasses: ChartsLegendClasses;
|
|
@@ -24,5 +24,5 @@ export interface PiecewiseColorLegendClasses {
|
|
|
24
24
|
/** Styles applied to the series label. */
|
|
25
25
|
label: string;
|
|
26
26
|
}
|
|
27
|
-
export declare const useUtilityClasses: (props: PiecewiseColorLegendProps & ChartsLegendSlotExtension) => Record<"
|
|
27
|
+
export declare const useUtilityClasses: (props: PiecewiseColorLegendProps & ChartsLegendSlotExtension) => Record<"item" | "root" | "label" | "mark" | "minLabel" | "maxLabel", string>;
|
|
28
28
|
export declare const piecewiseColorLegendClasses: PiecewiseColorLegendClasses;
|
|
@@ -3,7 +3,7 @@ import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
|
3
3
|
import { GaugeProviderProps } from "./GaugeProvider.js";
|
|
4
4
|
import { MergeSignaturesProperty } from "../internals/plugins/models/index.js";
|
|
5
5
|
import { ChartCorePluginSignatures } from "../internals/plugins/corePlugins/index.js";
|
|
6
|
-
export interface GaugeContainerProps extends Omit<ChartsSurfaceProps, 'children'>, Omit<MergeSignaturesProperty<ChartCorePluginSignatures, 'params'>, 'series' | 'dataset' | 'colors' | 'theme'>, Omit<GaugeProviderProps, 'children'>, Omit<React.SVGProps<SVGSVGElement>, 'width' | 'height'> {
|
|
6
|
+
export interface GaugeContainerProps extends Omit<ChartsSurfaceProps, 'children'>, Omit<MergeSignaturesProperty<ChartCorePluginSignatures, 'params'>, 'series' | 'dataset' | 'colors' | 'theme' | 'experimentalFeatures'>, Omit<GaugeProviderProps, 'children'>, Omit<React.SVGProps<SVGSVGElement>, 'width' | 'height'> {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
}
|
|
9
9
|
declare const GaugeContainer: React.ForwardRefExoticComponent<Omit<GaugeContainerProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -18,12 +18,13 @@ import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
|
|
|
18
18
|
import { ChartsToolbarSlots, ChartsToolbarSlotProps } from "../Toolbar/index.js";
|
|
19
19
|
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
20
20
|
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
21
|
+
export type LineSeries = MakeOptional<LineSeriesType, 'type'>;
|
|
21
22
|
export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
22
23
|
/**
|
|
23
24
|
* The series to display in the line chart.
|
|
24
|
-
* An array of [[
|
|
25
|
+
* An array of [[LineSeries]] objects.
|
|
25
26
|
*/
|
|
26
|
-
series: Readonly<
|
|
27
|
+
series: Readonly<LineSeries[]>;
|
|
27
28
|
/**
|
|
28
29
|
* Option to display a cartesian grid in the background.
|
|
29
30
|
*/
|
package/LineChart/LineChart.js
CHANGED
|
@@ -118,6 +118,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
118
118
|
* If `true`, render the line highlight item.
|
|
119
119
|
*/
|
|
120
120
|
disableLineItemHighlight: _propTypes.default.bool,
|
|
121
|
+
/**
|
|
122
|
+
* Options to enable features planned for the next major.
|
|
123
|
+
*/
|
|
124
|
+
experimentalFeatures: _propTypes.default.shape({
|
|
125
|
+
preferStrictDomainInLineCharts: _propTypes.default.bool
|
|
126
|
+
}),
|
|
121
127
|
/**
|
|
122
128
|
* Option to display a cartesian grid in the background.
|
|
123
129
|
*/
|
|
@@ -133,6 +139,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
133
139
|
* If `true`, the legend is not rendered.
|
|
134
140
|
*/
|
|
135
141
|
hideLegend: _propTypes.default.bool,
|
|
142
|
+
/**
|
|
143
|
+
* The controlled axis highlight.
|
|
144
|
+
* Identified by the axis id, and data index.
|
|
145
|
+
*/
|
|
146
|
+
highlightedAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
147
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
148
|
+
dataIndex: _propTypes.default.number.isRequired
|
|
149
|
+
})),
|
|
136
150
|
/**
|
|
137
151
|
* The highlighted item.
|
|
138
152
|
* Used when the highlight is controlled.
|
|
@@ -184,6 +198,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
184
198
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
185
199
|
*/
|
|
186
200
|
onHighlightChange: _propTypes.default.func,
|
|
201
|
+
/**
|
|
202
|
+
* The function called when the pointer position corresponds to a new axis data item.
|
|
203
|
+
* This update can either be caused by a pointer movement, or an axis update.
|
|
204
|
+
* In case of multiple axes, the function is called if at least one axis is updated.
|
|
205
|
+
* The argument contains the identifier for all axes with a `data` property.
|
|
206
|
+
* @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
|
|
207
|
+
*/
|
|
208
|
+
onHighlightedAxisChange: _propTypes.default.func,
|
|
187
209
|
/**
|
|
188
210
|
* Callback fired when a line element is clicked.
|
|
189
211
|
*/
|
|
@@ -194,7 +216,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
194
216
|
onMarkClick: _propTypes.default.func,
|
|
195
217
|
/**
|
|
196
218
|
* The series to display in the line chart.
|
|
197
|
-
* An array of [[
|
|
219
|
+
* An array of [[LineSeries]] objects.
|
|
198
220
|
*/
|
|
199
221
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
200
222
|
/**
|
|
@@ -52,8 +52,8 @@ function LineHighlightPlot(props) {
|
|
|
52
52
|
instance
|
|
53
53
|
} = (0, _ChartProvider.useChartContext)();
|
|
54
54
|
const store = (0, _useStore.useStore)();
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
55
|
+
const highlightedIndexes = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsHighlightXAxisIndex);
|
|
56
|
+
if (highlightedIndexes.length === 0) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
59
|
if (seriesData === undefined) {
|
|
@@ -67,7 +67,10 @@ function LineHighlightPlot(props) {
|
|
|
67
67
|
const defaultYAxisId = yAxisIds[0];
|
|
68
68
|
const Element = slots?.lineHighlight ?? _LineHighlightElement.LineHighlightElement;
|
|
69
69
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
|
|
70
|
-
children:
|
|
70
|
+
children: highlightedIndexes.flatMap(({
|
|
71
|
+
dataIndex: highlightedIndex,
|
|
72
|
+
axisId: highlightedAxisId
|
|
73
|
+
}) => stackingGroups.flatMap(({
|
|
71
74
|
ids: groupIds
|
|
72
75
|
}) => {
|
|
73
76
|
return groupIds.flatMap(seriesId => {
|
|
@@ -82,6 +85,9 @@ function LineHighlightPlot(props) {
|
|
|
82
85
|
if (disableHighlight || data[highlightedIndex] == null) {
|
|
83
86
|
return null;
|
|
84
87
|
}
|
|
88
|
+
if (highlightedAxisId !== xAxisId) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
85
91
|
const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisId].scale);
|
|
86
92
|
const yScale = yAxis[yAxisId].scale;
|
|
87
93
|
const xData = xAxis[xAxisId].data;
|
|
@@ -103,7 +109,7 @@ function LineHighlightPlot(props) {
|
|
|
103
109
|
shape: shape
|
|
104
110
|
}, slotProps?.lineHighlight), `${seriesId}`);
|
|
105
111
|
});
|
|
106
|
-
})
|
|
112
|
+
}))
|
|
107
113
|
}));
|
|
108
114
|
}
|
|
109
115
|
process.env.NODE_ENV !== "production" ? LineHighlightPlot.propTypes = {
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -11,7 +11,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var React = _interopRequireWildcard(require("react"));
|
|
14
|
-
var _useChartCartesianInteraction = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors");
|
|
15
14
|
var _constants = require("../constants");
|
|
16
15
|
var _useSkipAnimation = require("../hooks/useSkipAnimation");
|
|
17
16
|
var _useChartId = require("../hooks/useChartId");
|
|
@@ -24,6 +23,7 @@ var _MarkElement = require("./MarkElement");
|
|
|
24
23
|
var _ChartProvider = require("../context/ChartProvider");
|
|
25
24
|
var _hooks = require("../hooks");
|
|
26
25
|
var _useInternalIsZoomInteracting = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting");
|
|
26
|
+
var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
27
27
|
var _useSelector = require("../internals/store/useSelector");
|
|
28
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
29
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
@@ -65,7 +65,21 @@ function MarkPlot(props) {
|
|
|
65
65
|
isFaded,
|
|
66
66
|
isHighlighted
|
|
67
67
|
} = (0, _hooks.useItemHighlightedGetter)();
|
|
68
|
-
const
|
|
68
|
+
const xAxisHighlightIndexes = (0, _useSelector.useSelector)(store, _useChartCartesianAxis.selectorChartsHighlightXAxisIndex);
|
|
69
|
+
const highlightedItems = React.useMemo(() => {
|
|
70
|
+
const rep = {};
|
|
71
|
+
for (const {
|
|
72
|
+
dataIndex,
|
|
73
|
+
axisId
|
|
74
|
+
} of xAxisHighlightIndexes) {
|
|
75
|
+
if (rep[axisId] === undefined) {
|
|
76
|
+
rep[axisId] = new Set([dataIndex]);
|
|
77
|
+
} else {
|
|
78
|
+
rep[axisId].add(dataIndex);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return rep;
|
|
82
|
+
}, [xAxisHighlightIndexes]);
|
|
69
83
|
if (seriesData === undefined) {
|
|
70
84
|
return null;
|
|
71
85
|
}
|
|
@@ -163,7 +177,7 @@ function MarkPlot(props) {
|
|
|
163
177
|
seriesId,
|
|
164
178
|
dataIndex: index
|
|
165
179
|
})),
|
|
166
|
-
isHighlighted:
|
|
180
|
+
isHighlighted: highlightedItems[xAxisId]?.has(index) || isSeriesHighlighted,
|
|
167
181
|
isFaded: isSeriesFaded
|
|
168
182
|
}, slotProps?.mark), `${seriesId}-${index}`);
|
|
169
183
|
})
|
|
@@ -40,9 +40,10 @@ function useAreaPlotData(xAxes, yAxes) {
|
|
|
40
40
|
connectNulls,
|
|
41
41
|
baseline,
|
|
42
42
|
curve,
|
|
43
|
-
strictStepCurve
|
|
43
|
+
strictStepCurve,
|
|
44
|
+
area
|
|
44
45
|
} = series[seriesId];
|
|
45
|
-
if (!(xAxisId in xAxes) || !(yAxisId in yAxes)) {
|
|
46
|
+
if (!area || !(xAxisId in xAxes) || !(yAxisId in yAxes)) {
|
|
46
47
|
continue;
|
|
47
48
|
}
|
|
48
49
|
const xScale = xAxes[xAxisId].scale;
|
|
@@ -152,6 +152,9 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
152
152
|
outerRadius: _propTypes.default.number,
|
|
153
153
|
paddingAngle: _propTypes.default.number
|
|
154
154
|
}),
|
|
155
|
+
/**
|
|
156
|
+
* The id of this series.
|
|
157
|
+
*/
|
|
155
158
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
156
159
|
/**
|
|
157
160
|
* The radius between circle center and the beginning of the arc.
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -123,6 +123,9 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
123
123
|
outerRadius: _propTypes.default.number,
|
|
124
124
|
paddingAngle: _propTypes.default.number
|
|
125
125
|
}),
|
|
126
|
+
/**
|
|
127
|
+
* The id of this series.
|
|
128
|
+
*/
|
|
126
129
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
127
130
|
/**
|
|
128
131
|
* The radius between circle center and the beginning of the arc.
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -12,12 +12,13 @@ import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "
|
|
|
12
12
|
import { PieChartPluginSignatures } from "./PieChart.plugins.js";
|
|
13
13
|
export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
14
14
|
export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
15
|
-
export
|
|
15
|
+
export type PieSeries = MakeOptional<PieSeriesType<MakeOptional<PieValueType, 'id'>>, 'type'>;
|
|
16
|
+
export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series' | 'slots' | 'slotProps' | 'experimentalFeatures'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
16
17
|
/**
|
|
17
18
|
* The series to display in the pie chart.
|
|
18
|
-
* An array of [[
|
|
19
|
+
* An array of [[PieSeries]] objects.
|
|
19
20
|
*/
|
|
20
|
-
series: Readonly<
|
|
21
|
+
series: Readonly<PieSeries[]>;
|
|
21
22
|
/**
|
|
22
23
|
* If `true`, the legend is not rendered.
|
|
23
24
|
*/
|
package/PieChart/PieChart.js
CHANGED
|
@@ -180,7 +180,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
180
180
|
onItemClick: _propTypes.default.func,
|
|
181
181
|
/**
|
|
182
182
|
* The series to display in the pie chart.
|
|
183
|
-
* An array of [[
|
|
183
|
+
* An array of [[PieSeries]] objects.
|
|
184
184
|
*/
|
|
185
185
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
186
186
|
/**
|
package/PieChart/pieClasses.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export interface PieClasses {
|
|
|
9
9
|
export type PieClassKey = keyof PieClasses;
|
|
10
10
|
export declare function getPieUtilityClass(slot: string): string;
|
|
11
11
|
export declare const pieClasses: PieClasses;
|
|
12
|
-
export declare const useUtilityClasses: (classes?: Partial<PieClasses>) => Record<"
|
|
12
|
+
export declare const useUtilityClasses: (classes?: Partial<PieClasses>) => Record<"series" | "root" | "seriesLabels", string>;
|
|
@@ -62,13 +62,11 @@ function RadarAxisHighlight(props) {
|
|
|
62
62
|
className: classes.line,
|
|
63
63
|
pointerEvents: "none",
|
|
64
64
|
strokeDasharray: "4 4"
|
|
65
|
-
}), points.map(({
|
|
66
|
-
highlighted
|
|
67
|
-
}, seriesIndex) => {
|
|
65
|
+
}), points.map((point, seriesIndex) => {
|
|
68
66
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
|
|
69
67
|
fill: series[seriesIndex].color,
|
|
70
|
-
cx:
|
|
71
|
-
cy:
|
|
68
|
+
cx: point.x,
|
|
69
|
+
cy: point.y,
|
|
72
70
|
className: classes.dot,
|
|
73
71
|
pointerEvents: "none"
|
|
74
72
|
}, series[seriesIndex].hideMark ? highlightMark : highlightMarkShadow), series[seriesIndex].id);
|
|
@@ -2,12 +2,6 @@ import { UseChartPolarAxisSignature } from "../../internals/plugins/featurePlugi
|
|
|
2
2
|
import { AxisId } from "../../models/axis.js";
|
|
3
3
|
import { DefaultizedRadarSeriesType } from "../../models/seriesType/radar.js";
|
|
4
4
|
import { ChartInstance } from "../../internals/plugins/models/index.js";
|
|
5
|
-
interface UseRadarAxisHighlightParams {
|
|
6
|
-
/**
|
|
7
|
-
* If true, coordinates of the previous/next point will be added.
|
|
8
|
-
*/
|
|
9
|
-
includesNeighbors?: boolean;
|
|
10
|
-
}
|
|
11
5
|
interface UseRadarAxisHighlightReturnValue {
|
|
12
6
|
/**
|
|
13
7
|
* The radar center.
|
|
@@ -40,7 +34,7 @@ interface UseRadarAxisHighlightReturnValue {
|
|
|
40
34
|
* The { x, y, value } values for the highlighted points in the same order as the `series` array.
|
|
41
35
|
* If `includesNeighbors` is set to `true` it also contains the information for `previous` and `next` data point.
|
|
42
36
|
*/
|
|
43
|
-
points:
|
|
37
|
+
points: Point[];
|
|
44
38
|
/**
|
|
45
39
|
* Charts instances giving access to `polar2svg` and `svg2polar` helpers.
|
|
46
40
|
*/
|
|
@@ -53,10 +47,5 @@ interface Point {
|
|
|
53
47
|
angle: number;
|
|
54
48
|
value: number;
|
|
55
49
|
}
|
|
56
|
-
|
|
57
|
-
highlighted: Point;
|
|
58
|
-
previous?: Point;
|
|
59
|
-
next?: Point;
|
|
60
|
-
}
|
|
61
|
-
export declare function useRadarAxisHighlight(params?: UseRadarAxisHighlightParams): UseRadarAxisHighlightReturnValue | null;
|
|
50
|
+
export declare function useRadarAxisHighlight(): UseRadarAxisHighlightReturnValue | null;
|
|
62
51
|
export {};
|
|
@@ -12,10 +12,7 @@ var _useStore = require("../../internals/store/useStore");
|
|
|
12
12
|
var _useChartContext = require("../../context/ChartProvider/useChartContext");
|
|
13
13
|
var _useChartPolarAxis = require("../../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
14
14
|
var _useChartPolarInteraction = require("../../internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors");
|
|
15
|
-
function useRadarAxisHighlight(
|
|
16
|
-
const {
|
|
17
|
-
includesNeighbors = false
|
|
18
|
-
} = params ?? {};
|
|
15
|
+
function useRadarAxisHighlight() {
|
|
19
16
|
const radarSeries = (0, _useRadarSeries.useRadarSeries)();
|
|
20
17
|
const rotationScale = (0, _useScale.useRotationScale)();
|
|
21
18
|
const {
|
|
@@ -55,48 +52,14 @@ function useRadarAxisHighlight(params) {
|
|
|
55
52
|
const value = series.data[highlightedIndex];
|
|
56
53
|
const r = radiusScale(value);
|
|
57
54
|
const [x, y] = instance.polar2svg(r, angle);
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
value
|
|
65
|
-
}
|
|
55
|
+
const returnedValue = {
|
|
56
|
+
x,
|
|
57
|
+
y,
|
|
58
|
+
r,
|
|
59
|
+
angle,
|
|
60
|
+
value
|
|
66
61
|
};
|
|
67
|
-
|
|
68
|
-
return retrunedValue;
|
|
69
|
-
}
|
|
70
|
-
const dataLength = series.data.length;
|
|
71
|
-
const prevIndex = (dataLength + highlightedIndex - 1) % dataLength;
|
|
72
|
-
const nextIndex = (highlightedIndex + 1) % dataLength;
|
|
73
|
-
const prevValue = series.data[prevIndex];
|
|
74
|
-
const nextValue = series.data[nextIndex];
|
|
75
|
-
if (prevValue != null) {
|
|
76
|
-
const prevR = radiusAxis[radiusAxisIds[prevIndex]].scale(prevValue);
|
|
77
|
-
const prevAngle = rotationScale(rotationScale.domain()[prevIndex]);
|
|
78
|
-
const [px, py] = instance.polar2svg(prevR, prevAngle);
|
|
79
|
-
retrunedValue.previous = {
|
|
80
|
-
x: px,
|
|
81
|
-
y: py,
|
|
82
|
-
r: prevR,
|
|
83
|
-
angle: prevAngle,
|
|
84
|
-
value: prevValue
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
if (nextValue != null) {
|
|
88
|
-
const nextR = radiusAxis[radiusAxisIds[nextIndex]].scale(nextValue);
|
|
89
|
-
const nextAngle = rotationScale(rotationScale.domain()[nextIndex]);
|
|
90
|
-
const [nx, ny] = instance.polar2svg(nextR, nextAngle);
|
|
91
|
-
retrunedValue.next = {
|
|
92
|
-
x: nx,
|
|
93
|
-
y: ny,
|
|
94
|
-
r: nextR,
|
|
95
|
-
angle: nextAngle,
|
|
96
|
-
value: nextValue
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
return retrunedValue;
|
|
62
|
+
return returnedValue;
|
|
100
63
|
})
|
|
101
64
|
};
|
|
102
65
|
}
|
|
@@ -5,13 +5,14 @@ import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
|
5
5
|
import { ChartsWrapperProps } from "../internals/components/ChartsWrapper/index.js";
|
|
6
6
|
import { RadarGridProps } from "./RadarGrid/index.js";
|
|
7
7
|
import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
|
|
8
|
+
import { RadarSeriesPlotProps } from "./RadarSeriesPlot/index.js";
|
|
8
9
|
import { RadarAxisHighlightProps } from "./RadarAxisHighlight/index.js";
|
|
9
10
|
import { ChartsTooltipSlotProps, ChartsTooltipSlots } from "../ChartsTooltip/index.js";
|
|
10
11
|
import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
|
|
11
12
|
import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
|
|
12
13
|
export interface RadarChartSlots extends ChartsTooltipSlots, ChartsOverlaySlots, ChartsLegendSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
13
14
|
export interface RadarChartSlotProps extends ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsLegendSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
14
|
-
export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridProps, 'classes'>, Omit<Partial<RadarAxisHighlightProps>, 'classes'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ChartsWrapperProps, 'sx'>, Omit<ChartsSurfaceProps, 'sx'> {
|
|
15
|
+
export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridProps, 'classes'>, Omit<Partial<RadarAxisHighlightProps>, 'classes'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<ChartsWrapperProps, 'sx'>, Omit<ChartsSurfaceProps, 'sx'>, Pick<RadarSeriesPlotProps, 'onAreaClick' | 'onMarkClick'> {
|
|
15
16
|
/**
|
|
16
17
|
* If `true`, the legend is not rendered.
|
|
17
18
|
*/
|