@mui/x-charts 8.11.3 → 8.12.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 +2 -2
- package/BarChart/BarChart.js +1 -0
- package/BarChart/BarChart.plugins.d.ts +3 -2
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/BarElement.js +10 -2
- package/BarChart/index.d.ts +1 -0
- package/BarChart/index.js +12 -0
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/CHANGELOG.md +151 -6
- package/ChartContainer/ChartContainer.js +4 -2
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/ChartsLegend/PiecewiseColorLegend.js +1 -0
- package/ChartsSurface/ChartsSurface.js +21 -2
- package/ChartsWrapper/ChartsWrapper.d.ts +2 -1
- package/ChartsWrapper/ChartsWrapper.js +49 -46
- package/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
- package/LineChart/FocusedMark.d.ts +2 -0
- package/LineChart/FocusedMark.js +44 -0
- package/LineChart/LineChart.d.ts +2 -2
- package/LineChart/LineChart.js +3 -1
- package/LineChart/LineChart.plugins.d.ts +3 -2
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/index.d.ts +1 -0
- package/LineChart/index.js +12 -0
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/PieChart/PieArc.d.ts +1 -0
- package/PieChart/PieArc.js +7 -3
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.js +1 -0
- package/PieChart/PieChart.plugins.d.ts +2 -1
- package/PieChart/PieChart.plugins.js +2 -1
- package/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +9 -1
- package/PieChart/index.d.ts +1 -0
- package/PieChart/index.js +12 -0
- package/RadarChart/RadarChart.plugins.d.ts +1 -1
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
- package/RadarChart/index.d.ts +2 -1
- package/RadarChart/index.js +12 -0
- package/RadarChart/useRadarChartProps.d.ts +2 -2
- package/ScatterChart/BatchScatter.d.ts +32 -0
- package/ScatterChart/BatchScatter.js +171 -0
- package/ScatterChart/Scatter.js +13 -5
- package/ScatterChart/ScatterChart.d.ts +4 -4
- package/ScatterChart/ScatterChart.js +13 -2
- package/ScatterChart/ScatterChart.plugins.d.ts +4 -3
- package/ScatterChart/ScatterChart.plugins.js +3 -2
- package/ScatterChart/ScatterPlot.d.ts +10 -0
- package/ScatterChart/ScatterPlot.js +14 -2
- package/ScatterChart/index.d.ts +1 -0
- package/ScatterChart/index.js +12 -0
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +8 -5
- package/SparkLineChart/SparkLineChart.js +10 -5
- package/Toolbar/Toolbar.js +1 -2
- package/colorPalettes/types.d.ts +1 -1
- package/context/ChartApi.d.ts +6 -6
- package/esm/BarChart/BarChart.d.ts +2 -2
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/BarChart/BarChart.plugins.d.ts +3 -2
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/BarElement.js +10 -2
- package/esm/BarChart/index.d.ts +1 -0
- package/esm/BarChart/index.js +1 -0
- package/esm/BarChart/useBarChartProps.d.ts +2 -2
- package/esm/ChartContainer/ChartContainer.js +4 -2
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsLegend/ContinuousColorLegend.js +1 -0
- package/esm/ChartsLegend/PiecewiseColorLegend.js +1 -0
- package/esm/ChartsSurface/ChartsSurface.js +21 -2
- package/esm/ChartsWrapper/ChartsWrapper.d.ts +2 -1
- package/esm/ChartsWrapper/ChartsWrapper.js +49 -46
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
- package/esm/LineChart/FocusedMark.d.ts +2 -0
- package/esm/LineChart/FocusedMark.js +38 -0
- package/esm/LineChart/LineChart.d.ts +2 -2
- package/esm/LineChart/LineChart.js +3 -1
- package/esm/LineChart/LineChart.plugins.d.ts +3 -2
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/index.d.ts +1 -0
- package/esm/LineChart/index.js +1 -0
- package/esm/LineChart/useLineChartProps.d.ts +2 -2
- package/esm/PieChart/PieArc.d.ts +1 -0
- package/esm/PieChart/PieArc.js +7 -3
- package/esm/PieChart/PieArcPlot.js +1 -0
- package/esm/PieChart/PieChart.js +1 -0
- package/esm/PieChart/PieChart.plugins.d.ts +2 -1
- package/esm/PieChart/PieChart.plugins.js +2 -1
- package/esm/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/esm/PieChart/dataTransform/useTransformData.js +9 -1
- package/esm/PieChart/index.d.ts +1 -0
- package/esm/PieChart/index.js +1 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +1 -1
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
- package/esm/RadarChart/index.d.ts +2 -1
- package/esm/RadarChart/index.js +2 -1
- package/esm/RadarChart/useRadarChartProps.d.ts +2 -2
- package/esm/ScatterChart/BatchScatter.d.ts +32 -0
- package/esm/ScatterChart/BatchScatter.js +165 -0
- package/esm/ScatterChart/Scatter.js +13 -5
- package/esm/ScatterChart/ScatterChart.d.ts +4 -4
- package/esm/ScatterChart/ScatterChart.js +13 -2
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +4 -3
- package/esm/ScatterChart/ScatterChart.plugins.js +3 -2
- package/esm/ScatterChart/ScatterPlot.d.ts +10 -0
- package/esm/ScatterChart/ScatterPlot.js +14 -2
- package/esm/ScatterChart/index.d.ts +1 -0
- package/esm/ScatterChart/index.js +1 -0
- package/esm/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +8 -5
- package/esm/SparkLineChart/SparkLineChart.js +10 -5
- package/esm/Toolbar/Toolbar.js +1 -2
- package/esm/colorPalettes/types.d.ts +1 -1
- package/esm/context/ChartApi.d.ts +6 -6
- package/esm/hooks/useAxis.d.ts +5 -5
- package/esm/hooks/useDrawingArea.d.ts +20 -2
- package/esm/hooks/useFocusedItem.d.ts +15 -0
- package/esm/hooks/useFocusedItem.js +20 -0
- package/esm/hooks/useIsItemFocused.d.ts +12 -0
- package/esm/hooks/useIsItemFocused.js +15 -0
- package/esm/hooks/useIsItemFocusedGetter.d.ts +8 -0
- package/esm/hooks/useIsItemFocusedGetter.js +14 -0
- package/esm/hooks/useScale.js +6 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/internals/animation/Transition.js +1 -3
- package/esm/internals/index.d.ts +3 -2
- package/esm/internals/index.js +3 -2
- package/esm/internals/plugins/allPlugins.d.ts +5 -4
- package/esm/internals/plugins/allPlugins.js +3 -2
- package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +66 -72
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +24 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +123 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +46 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +32 -21
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +9 -7
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +3 -0
- package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
- package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +32 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +88 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +210 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +7 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
- package/esm/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
- package/esm/internals/scaleGuards.d.ts +7 -0
- package/esm/internals/scaleGuards.js +6 -0
- package/esm/locales/elGR.d.ts +96 -0
- package/esm/locales/elGR.js +100 -0
- package/esm/locales/enUS.d.ts +96 -0
- package/esm/locales/enUS.js +99 -1
- package/esm/locales/frFR.d.ts +96 -0
- package/esm/locales/frFR.js +100 -2
- package/esm/locales/ptBR.d.ts +96 -0
- package/esm/locales/ptBR.js +100 -0
- package/esm/locales/ptPT.d.ts +96 -0
- package/esm/locales/ptPT.js +100 -0
- package/esm/locales/svSE.d.ts +97 -1
- package/esm/locales/svSE.js +100 -0
- package/esm/locales/utils/chartsLocaleTextApi.d.ts +384 -0
- package/esm/locales/utils/getChartsLocalization.d.ts +96 -0
- package/esm/plugins/index.d.ts +6 -0
- package/esm/plugins/index.js +12 -0
- package/hooks/useAxis.d.ts +5 -5
- package/hooks/useDrawingArea.d.ts +20 -2
- package/hooks/useFocusedItem.d.ts +15 -0
- package/hooks/useFocusedItem.js +26 -0
- package/hooks/useIsItemFocused.d.ts +12 -0
- package/hooks/useIsItemFocused.js +20 -0
- package/hooks/useIsItemFocusedGetter.d.ts +8 -0
- package/hooks/useIsItemFocusedGetter.js +18 -0
- package/hooks/useScale.js +6 -0
- package/index.d.ts +1 -0
- package/index.js +13 -1
- package/internals/animation/Transition.js +0 -2
- package/internals/index.d.ts +3 -2
- package/internals/index.js +20 -8
- package/internals/plugins/allPlugins.d.ts +5 -4
- package/internals/plugins/allPlugins.js +3 -2
- package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +63 -69
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/{getAxisExtremum.d.ts → getAxisExtrema.d.ts} +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +30 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +134 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +47 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +33 -22
- package/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/index.js +27 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
- package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +11 -9
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +9 -0
- package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
- package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
- package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +41 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +6 -1
- package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +9 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +27 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +96 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +218 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
- package/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
- package/internals/scaleGuards.d.ts +7 -0
- package/internals/scaleGuards.js +8 -0
- package/locales/elGR.d.ts +96 -0
- package/locales/elGR.js +100 -0
- package/locales/enUS.d.ts +96 -0
- package/locales/enUS.js +99 -1
- package/locales/frFR.d.ts +96 -0
- package/locales/frFR.js +100 -2
- package/locales/ptBR.d.ts +96 -0
- package/locales/ptBR.js +100 -0
- package/locales/ptPT.d.ts +96 -0
- package/locales/ptPT.js +100 -0
- package/locales/svSE.d.ts +97 -1
- package/locales/svSE.js +100 -0
- package/locales/utils/chartsLocaleTextApi.d.ts +384 -0
- package/locales/utils/getChartsLocalization.d.ts +96 -0
- package/package.json +4 -4
- package/plugins/index.d.ts +6 -0
- package/plugins/index.js +47 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -22
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -2
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -29
- package/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -27
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -9
- /package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
- /package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
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.FocusedMark = FocusedMark;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
11
|
+
var _useFocusedItem = require("../hooks/useFocusedItem");
|
|
12
|
+
var _hooks = require("../hooks");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
const RADIUS = 6;
|
|
15
|
+
function FocusedMark() {
|
|
16
|
+
const theme = (0, _styles.useTheme)();
|
|
17
|
+
const focusedItem = (0, _useFocusedItem.useFocusedItem)();
|
|
18
|
+
const lineSeries = (0, _hooks.useLineSeriesContext)();
|
|
19
|
+
const {
|
|
20
|
+
xAxis,
|
|
21
|
+
xAxisIds
|
|
22
|
+
} = (0, _hooks.useXAxes)();
|
|
23
|
+
const {
|
|
24
|
+
yAxis,
|
|
25
|
+
yAxisIds
|
|
26
|
+
} = (0, _hooks.useYAxes)();
|
|
27
|
+
if (focusedItem === null || focusedItem.seriesType !== 'line' || !lineSeries) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const series = lineSeries?.series[focusedItem.seriesId];
|
|
31
|
+
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
32
|
+
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
33
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("rect", {
|
|
34
|
+
fill: "none",
|
|
35
|
+
stroke: (theme.vars ?? theme).palette.text.primary,
|
|
36
|
+
strokeWidth: 2,
|
|
37
|
+
x: xAxis[xAxisId].scale(xAxis[xAxisId].data[focusedItem.dataIndex]) - RADIUS,
|
|
38
|
+
y: yAxis[yAxisId].scale(series.stackedData[focusedItem.dataIndex][1]) - RADIUS,
|
|
39
|
+
width: 2 * RADIUS,
|
|
40
|
+
height: 2 * RADIUS,
|
|
41
|
+
rx: 3,
|
|
42
|
+
ry: 3
|
|
43
|
+
});
|
|
44
|
+
}
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -14,12 +14,12 @@ import { ChartsAxisSlotProps, ChartsAxisSlots } from "../models/axis.js";
|
|
|
14
14
|
import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from "./LineHighlightPlot.js";
|
|
15
15
|
import { ChartsGridProps } from "../ChartsGrid/index.js";
|
|
16
16
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
|
|
17
|
-
import {
|
|
17
|
+
import { LineChartPluginSignatures } 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
21
|
export type LineSeries = MakeOptional<LineSeriesType, 'type'>;
|
|
22
|
-
export interface LineChartProps extends Omit<ChartContainerProps<'line',
|
|
22
|
+
export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
23
23
|
/**
|
|
24
24
|
* The series to display in the line chart.
|
|
25
25
|
* An array of [[LineSeries]] objects.
|
package/LineChart/LineChart.js
CHANGED
|
@@ -27,6 +27,7 @@ var _useChartContainerProps = require("../ChartContainer/useChartContainerProps"
|
|
|
27
27
|
var _ChartDataProvider = require("../ChartDataProvider");
|
|
28
28
|
var _ChartsSurface = require("../ChartsSurface");
|
|
29
29
|
var _ChartsWrapper = require("../ChartsWrapper");
|
|
30
|
+
var _FocusedMark = require("./FocusedMark");
|
|
30
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
32
|
/**
|
|
32
33
|
* Demos:
|
|
@@ -70,7 +71,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
|
|
|
70
71
|
children: [props.showToolbar && Toolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, (0, _extends2.default)({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
71
72
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
72
73
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaPlot.AreaPlot, (0, _extends2.default)({}, areaPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinePlot.LinePlot, (0, _extends2.default)({}, linePlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
73
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
74
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FocusedMark.FocusedMark, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
74
75
|
"data-drawing-container": true,
|
|
75
76
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MarkPlot.MarkPlot, (0, _extends2.default)({}, markPlotProps))
|
|
76
77
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineHighlightPlot.LineHighlightPlot, (0, _extends2.default)({}, lineHighlightPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
@@ -118,6 +119,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
118
119
|
* If `true`, render the line highlight item.
|
|
119
120
|
*/
|
|
120
121
|
disableLineItemHighlight: _propTypes.default.bool,
|
|
122
|
+
enableKeyboardNavigation: _propTypes.default.bool,
|
|
121
123
|
/**
|
|
122
124
|
* Options to enable features planned for the next major.
|
|
123
125
|
*/
|
|
@@ -2,6 +2,7 @@ import { UseChartZAxisSignature } from "../internals/plugins/featurePlugins/useC
|
|
|
2
2
|
import { UseChartCartesianAxisSignature } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
3
3
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
|
+
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
5
6
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
6
|
-
export type
|
|
7
|
-
export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<
|
|
7
|
+
export type LineChartPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
8
|
+
export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<LineChartPluginSignatures>;
|
|
@@ -8,4 +8,5 @@ var _useChartZAxis = require("../internals/plugins/featurePlugins/useChartZAxis"
|
|
|
8
8
|
var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useChartCartesianAxis");
|
|
9
9
|
var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
|
|
10
10
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
11
|
-
|
|
11
|
+
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
12
|
+
const LINE_CHART_PLUGINS = exports.LINE_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
package/LineChart/index.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ export * from "./LineElement.js";
|
|
|
9
9
|
export * from "./AnimatedLine.js";
|
|
10
10
|
export * from "./MarkElement.js";
|
|
11
11
|
export * from "./LineHighlightElement.js";
|
|
12
|
+
export * from "./LineChart.plugins.js";
|
|
12
13
|
export type { MarkElementClasses, MarkElementClassKey } from "./markElementClasses.js";
|
|
13
14
|
export { getMarkElementUtilityClass, markElementClasses } from "./markElementClasses.js";
|
package/LineChart/index.js
CHANGED
|
@@ -151,4 +151,16 @@ Object.keys(_LineHighlightElement).forEach(function (key) {
|
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
});
|
|
154
|
+
var _LineChart2 = require("./LineChart.plugins");
|
|
155
|
+
Object.keys(_LineChart2).forEach(function (key) {
|
|
156
|
+
if (key === "default" || key === "__esModule") return;
|
|
157
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
158
|
+
if (key in exports && exports[key] === _LineChart2[key]) return;
|
|
159
|
+
Object.defineProperty(exports, key, {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function () {
|
|
162
|
+
return _LineChart2[key];
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
154
166
|
var _markElementClasses = require("./markElementClasses");
|
|
@@ -12,7 +12,7 @@ import { LineHighlightPlotProps } from "./LineHighlightPlot.js";
|
|
|
12
12
|
import { LinePlotProps } from "./LinePlot.js";
|
|
13
13
|
import { MarkPlotProps } from "./MarkPlot.js";
|
|
14
14
|
import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
15
|
-
import {
|
|
15
|
+
import { LineChartPluginSignatures } from "./LineChart.plugins.js";
|
|
16
16
|
/**
|
|
17
17
|
* A helper function that extracts LineChartProps from the input props
|
|
18
18
|
* and returns an object with props for the children components of LineChart.
|
|
@@ -22,7 +22,7 @@ import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const useLineChartProps: (props: LineChartProps) => {
|
|
24
24
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
25
|
-
chartContainerProps: ChartContainerProps<"line",
|
|
25
|
+
chartContainerProps: ChartContainerProps<"line", LineChartPluginSignatures>;
|
|
26
26
|
gridProps: ChartsGridProps;
|
|
27
27
|
clipPathProps: ChartsClipPathProps;
|
|
28
28
|
clipPathGroupProps: {
|
package/PieChart/PieArc.d.ts
CHANGED
package/PieChart/PieArc.js
CHANGED
|
@@ -21,7 +21,7 @@ var _hooks = require("../hooks");
|
|
|
21
21
|
var _animation = require("../internals/animation/animation");
|
|
22
22
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
const _excluded = ["classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation"];
|
|
24
|
+
const _excluded = ["classes", "color", "dataIndex", "id", "isFaded", "isHighlighted", "isFocused", "onClick", "cornerRadius", "startAngle", "endAngle", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation"];
|
|
25
25
|
function getPieArcUtilityClass(slot) {
|
|
26
26
|
return (0, _generateUtilityClass.default)('MuiPieArc', slot);
|
|
27
27
|
}
|
|
@@ -60,6 +60,7 @@ const PieArc = exports.PieArc = /*#__PURE__*/React.forwardRef(function PieArc(pr
|
|
|
60
60
|
id,
|
|
61
61
|
isFaded,
|
|
62
62
|
isHighlighted,
|
|
63
|
+
isFocused,
|
|
63
64
|
onClick,
|
|
64
65
|
cornerRadius,
|
|
65
66
|
startAngle,
|
|
@@ -76,7 +77,8 @@ const PieArc = exports.PieArc = /*#__PURE__*/React.forwardRef(function PieArc(pr
|
|
|
76
77
|
classes: innerClasses,
|
|
77
78
|
color,
|
|
78
79
|
isFaded,
|
|
79
|
-
isHighlighted
|
|
80
|
+
isHighlighted,
|
|
81
|
+
isFocused
|
|
80
82
|
};
|
|
81
83
|
const classes = useUtilityClasses(ownerState);
|
|
82
84
|
const interactionProps = (0, _useInteractionItemProps.useInteractionItemProps)({
|
|
@@ -105,7 +107,8 @@ const PieArc = exports.PieArc = /*#__PURE__*/React.forwardRef(function PieArc(pr
|
|
|
105
107
|
strokeWidth: 1,
|
|
106
108
|
strokeLinejoin: "round",
|
|
107
109
|
"data-highlighted": ownerState.isHighlighted || undefined,
|
|
108
|
-
"data-faded": ownerState.isFaded || undefined
|
|
110
|
+
"data-faded": ownerState.isFaded || undefined,
|
|
111
|
+
"data-focused": isFocused || undefined
|
|
109
112
|
}, other, interactionProps, animatedProps));
|
|
110
113
|
});
|
|
111
114
|
if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
|
|
@@ -121,6 +124,7 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
121
124
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
122
125
|
innerRadius: _propTypes.default.number.isRequired,
|
|
123
126
|
isFaded: _propTypes.default.bool.isRequired,
|
|
127
|
+
isFocused: _propTypes.default.bool.isRequired,
|
|
124
128
|
isHighlighted: _propTypes.default.bool.isRequired,
|
|
125
129
|
outerRadius: _propTypes.default.number.isRequired,
|
|
126
130
|
paddingAngle: _propTypes.default.number.isRequired,
|
package/PieChart/PieArcPlot.js
CHANGED
package/PieChart/PieChart.js
CHANGED
|
@@ -127,6 +127,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
127
127
|
*/
|
|
128
128
|
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
129
129
|
desc: _propTypes.default.string,
|
|
130
|
+
enableKeyboardNavigation: _propTypes.default.bool,
|
|
130
131
|
/**
|
|
131
132
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
132
133
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
2
2
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
3
|
+
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
3
4
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
4
|
-
export type PieChartPluginSignatures = [UseChartInteractionSignature, UseChartHighlightSignature];
|
|
5
|
+
export type PieChartPluginSignatures = [UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
5
6
|
export declare const PIE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<PieChartPluginSignatures>;
|
|
@@ -6,4 +6,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.PIE_CHART_PLUGINS = void 0;
|
|
7
7
|
var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
|
|
8
8
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
9
|
-
|
|
9
|
+
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
10
|
+
const PIE_CHART_PLUGINS = exports.PIE_CHART_PLUGINS = [_useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
|
@@ -12,5 +12,6 @@ export interface ValueWithHighlight extends DefaultizedPieValueType, AnimatedObj
|
|
|
12
12
|
dataIndex: number;
|
|
13
13
|
isFaded: boolean;
|
|
14
14
|
isHighlighted: boolean;
|
|
15
|
+
isFocused: boolean;
|
|
15
16
|
}
|
|
16
17
|
export declare function useTransformData(series: Pick<DefaultizedPieSeriesType, 'cornerRadius' | 'paddingAngle' | 'id' | 'highlighted' | 'faded' | 'data'> & ComputedPieRadius): ValueWithHighlight[];
|
|
@@ -10,6 +10,7 @@ exports.useTransformData = useTransformData;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _useItemHighlightedGetter = require("../../hooks/useItemHighlightedGetter");
|
|
13
|
+
var _useIsItemFocusedGetter = require("../../hooks/useIsItemFocusedGetter");
|
|
13
14
|
var _angleConversion = require("../../internals/angleConversion");
|
|
14
15
|
function useTransformData(series) {
|
|
15
16
|
const {
|
|
@@ -27,6 +28,7 @@ function useTransformData(series) {
|
|
|
27
28
|
isFaded: isItemFaded,
|
|
28
29
|
isHighlighted: isItemHighlighted
|
|
29
30
|
} = (0, _useItemHighlightedGetter.useItemHighlightedGetter)();
|
|
31
|
+
const isItemFocused = (0, _useIsItemFocusedGetter.useIsItemFocusedGetter)();
|
|
30
32
|
const dataWithHighlight = React.useMemo(() => data.map((item, itemIndex) => {
|
|
31
33
|
const currentItem = {
|
|
32
34
|
seriesId,
|
|
@@ -34,6 +36,11 @@ function useTransformData(series) {
|
|
|
34
36
|
};
|
|
35
37
|
const isHighlighted = isItemHighlighted(currentItem);
|
|
36
38
|
const isFaded = !isHighlighted && isItemFaded(currentItem);
|
|
39
|
+
const isFocused = isItemFocused({
|
|
40
|
+
seriesType: 'pie',
|
|
41
|
+
seriesId,
|
|
42
|
+
dataIndex: itemIndex
|
|
43
|
+
});
|
|
37
44
|
const attributesOverride = (0, _extends2.default)({
|
|
38
45
|
additionalRadius: 0
|
|
39
46
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
@@ -46,12 +53,13 @@ function useTransformData(series) {
|
|
|
46
53
|
dataIndex: itemIndex,
|
|
47
54
|
isFaded,
|
|
48
55
|
isHighlighted,
|
|
56
|
+
isFocused,
|
|
49
57
|
paddingAngle,
|
|
50
58
|
innerRadius,
|
|
51
59
|
outerRadius,
|
|
52
60
|
cornerRadius,
|
|
53
61
|
arcLabelRadius
|
|
54
62
|
});
|
|
55
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, seriesId]);
|
|
63
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, isItemFocused, seriesId]);
|
|
56
64
|
return dataWithHighlight;
|
|
57
65
|
}
|
package/PieChart/index.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ export * from "./PieArcLabelPlot.js";
|
|
|
5
5
|
export * from "./PieArc.js";
|
|
6
6
|
export * from "./PieArcLabel.js";
|
|
7
7
|
export * from "./getPieCoordinates.js";
|
|
8
|
+
export * from "./PieChart.plugins.js";
|
|
8
9
|
export { pieClasses } from "./pieClasses.js";
|
|
9
10
|
export type { PieClasses, PieClassKey } from "./pieClasses.js";
|
package/PieChart/index.js
CHANGED
|
@@ -96,4 +96,16 @@ Object.keys(_getPieCoordinates).forEach(function (key) {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
|
+
var _PieChart2 = require("./PieChart.plugins");
|
|
100
|
+
Object.keys(_PieChart2).forEach(function (key) {
|
|
101
|
+
if (key === "default" || key === "__esModule") return;
|
|
102
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
103
|
+
if (key in exports && exports[key] === _PieChart2[key]) return;
|
|
104
|
+
Object.defineProperty(exports, key, {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function () {
|
|
107
|
+
return _PieChart2[key];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
99
111
|
var _pieClasses = require("./pieClasses");
|
|
@@ -2,4 +2,4 @@ import { UseChartPolarAxisSignature } from "../internals/plugins/featurePlugins/
|
|
|
2
2
|
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
3
3
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
4
4
|
export declare const RADAR_PLUGINS: readonly [import("../internals/index.js").ChartPlugin<UseChartPolarAxisSignature<any>>, import("../internals/index.js").ChartPlugin<UseChartInteractionSignature>, import("../internals/index.js").ChartPlugin<UseChartHighlightSignature>];
|
|
5
|
-
export type
|
|
5
|
+
export type RadarChartPluginSignatures = [UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
-
import {
|
|
3
|
+
import { RadarChartPluginSignatures } from "../RadarChart.plugins.js";
|
|
4
4
|
import { RadarSeriesType } from "../../models/seriesType/radar.js";
|
|
5
5
|
import { ChartDataProviderProps } from "../../ChartDataProvider/index.js";
|
|
6
6
|
import { RadarConfig } from "./radar.types.js";
|
|
7
7
|
import { ChartAnyPluginSignature } from "../../internals/plugins/models/plugin.js";
|
|
8
8
|
export type RadarSeries = MakeOptional<RadarSeriesType, 'type'>;
|
|
9
|
-
export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] =
|
|
9
|
+
export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginSignatures> = Omit<ChartDataProviderProps<'radar', TSignatures>, 'series' | 'rotationAxis' | 'radiusAxis' | 'dataset' | 'experimentalFeatures'> & {
|
|
10
10
|
/**
|
|
11
11
|
* The series to display in the bar chart.
|
|
12
12
|
* An array of [[RadarSeries]] objects.
|
|
@@ -22,5 +22,5 @@ export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSi
|
|
|
22
22
|
*/
|
|
23
23
|
highlight?: 'axis' | 'series' | 'none';
|
|
24
24
|
};
|
|
25
|
-
declare function RadarDataProvider<TSignatures extends readonly ChartAnyPluginSignature[] =
|
|
25
|
+
declare function RadarDataProvider<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginSignatures>(props: RadarDataProviderProps<TSignatures>): React.JSX.Element;
|
|
26
26
|
export { RadarDataProvider };
|
package/RadarChart/index.d.ts
CHANGED
|
@@ -15,4 +15,5 @@ export * from "./RadarGrid/index.js";
|
|
|
15
15
|
export * from "./RadarAxis/index.js";
|
|
16
16
|
export * from "./RadarAxisHighlight/index.js";
|
|
17
17
|
export * from "./RadarMetricLabels/index.js";
|
|
18
|
-
export * from "./RadarSeriesPlot/index.js";
|
|
18
|
+
export * from "./RadarSeriesPlot/index.js";
|
|
19
|
+
export * from "./RadarChart.plugins.js";
|
package/RadarChart/index.js
CHANGED
|
@@ -84,6 +84,18 @@ Object.keys(_RadarSeriesPlot).forEach(function (key) {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
|
+
var _RadarChart2 = require("./RadarChart.plugins");
|
|
88
|
+
Object.keys(_RadarChart2).forEach(function (key) {
|
|
89
|
+
if (key === "default" || key === "__esModule") return;
|
|
90
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
91
|
+
if (key in exports && exports[key] === _RadarChart2[key]) return;
|
|
92
|
+
Object.defineProperty(exports, key, {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () {
|
|
95
|
+
return _RadarChart2[key];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
87
99
|
/**
|
|
88
100
|
* @deprecated radar chart is now stable, import `RadarChart` instead
|
|
89
101
|
*/
|
|
@@ -5,7 +5,7 @@ import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
|
5
5
|
import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
|
|
6
6
|
import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
7
7
|
import { RadarGridProps } from "./RadarGrid/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { RadarChartPluginSignatures } from "./RadarChart.plugins.js";
|
|
9
9
|
import { RadarSeriesAreaProps, RadarSeriesMarksProps } from "./RadarSeriesPlot/index.js";
|
|
10
10
|
/**
|
|
11
11
|
* A helper function that extracts RadarChartProps from the input props
|
|
@@ -18,7 +18,7 @@ export declare const useRadarChartProps: (props: RadarChartProps) => {
|
|
|
18
18
|
highlight: "none" | "series" | "axis";
|
|
19
19
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
20
20
|
chartsSurfaceProps: ChartsSurfaceProps;
|
|
21
|
-
radarDataProviderProps: RadarDataProviderProps<
|
|
21
|
+
radarDataProviderProps: RadarDataProviderProps<RadarChartPluginSignatures>;
|
|
22
22
|
radarGrid: RadarGridProps;
|
|
23
23
|
radarSeriesAreaProps: RadarSeriesAreaProps;
|
|
24
24
|
radarSeriesMarksProps: RadarSeriesMarksProps;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DefaultizedScatterSeriesType } from "../models/seriesType/scatter.js";
|
|
3
|
+
import { D3Scale } from "../models/axis.js";
|
|
4
|
+
import { ScatterClasses } from "./scatterClasses.js";
|
|
5
|
+
import { ColorGetter } from "../internals/plugins/models/seriesConfig/index.js";
|
|
6
|
+
export interface BatchScatterProps {
|
|
7
|
+
series: DefaultizedScatterSeriesType;
|
|
8
|
+
xScale: D3Scale;
|
|
9
|
+
yScale: D3Scale;
|
|
10
|
+
color: string;
|
|
11
|
+
colorGetter?: ColorGetter<'scatter'>;
|
|
12
|
+
classes?: Partial<ScatterClasses>;
|
|
13
|
+
}
|
|
14
|
+
export interface BatchScatterPathsProps {
|
|
15
|
+
series: DefaultizedScatterSeriesType;
|
|
16
|
+
xScale: D3Scale;
|
|
17
|
+
yScale: D3Scale;
|
|
18
|
+
color: string;
|
|
19
|
+
colorGetter?: ColorGetter<'scatter'>;
|
|
20
|
+
markerSize: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
* A batch version of the Scatter component that uses SVG paths to render points.
|
|
25
|
+
* This component is optimized for performance and is suitable for rendering large datasets, but has limitations. Some of the limitations include:
|
|
26
|
+
* - Limited CSS styling;
|
|
27
|
+
* - Overriding the `marker` slot is not supported;
|
|
28
|
+
* - Highlight style must not contain opacity.
|
|
29
|
+
*
|
|
30
|
+
* You can read about all the limitations [here](https://mui.com/x/react-charts/scatter/#performance).
|
|
31
|
+
*/
|
|
32
|
+
export declare function BatchScatter(props: BatchScatterProps): React.JSX.Element;
|
|
@@ -0,0 +1,171 @@
|
|
|
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.BatchScatter = BatchScatter;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
11
|
+
var _scatterClasses = require("./scatterClasses");
|
|
12
|
+
var _ChartProvider = require("../context/ChartProvider");
|
|
13
|
+
var _useScale = require("../hooks/useScale");
|
|
14
|
+
var _useSelector = require("../internals/store/useSelector");
|
|
15
|
+
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
const MAX_POINTS_PER_PATH = 1000;
|
|
18
|
+
/* In an SVG arc, if the arc starts and ends at the same point, it is not rendered, so we add a tiny
|
|
19
|
+
* value to one of the coordinates to ensure that the arc is rendered. */
|
|
20
|
+
const ALMOST_ZERO = 0.01;
|
|
21
|
+
function appendAtKey(map, key, value) {
|
|
22
|
+
let bucket = map.get(key);
|
|
23
|
+
if (!bucket) {
|
|
24
|
+
bucket = [value];
|
|
25
|
+
map.set(key, bucket);
|
|
26
|
+
} else {
|
|
27
|
+
bucket.push(value);
|
|
28
|
+
}
|
|
29
|
+
return bucket;
|
|
30
|
+
}
|
|
31
|
+
function createPath(x, y, markerSize) {
|
|
32
|
+
return `M${x - markerSize} ${y} a${markerSize} ${markerSize} 0 1 1 0 ${ALMOST_ZERO}`;
|
|
33
|
+
}
|
|
34
|
+
function useCreatePaths(seriesData, markerSize, xScale, yScale, color, colorGetter) {
|
|
35
|
+
const {
|
|
36
|
+
instance
|
|
37
|
+
} = (0, _ChartProvider.useChartContext)();
|
|
38
|
+
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
39
|
+
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
40
|
+
const paths = new Map();
|
|
41
|
+
const temporaryPaths = new Map();
|
|
42
|
+
for (let i = 0; i < seriesData.length; i += 1) {
|
|
43
|
+
const scatterPoint = seriesData[i];
|
|
44
|
+
const x = getXPosition(scatterPoint.x);
|
|
45
|
+
const y = getYPosition(scatterPoint.y);
|
|
46
|
+
if (!instance.isPointInside(x, y)) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const path = createPath(x, y, markerSize);
|
|
50
|
+
const fill = colorGetter ? colorGetter(i) : color;
|
|
51
|
+
const tempPath = appendAtKey(temporaryPaths, fill, path);
|
|
52
|
+
if (tempPath.length >= MAX_POINTS_PER_PATH) {
|
|
53
|
+
appendAtKey(paths, fill, tempPath.join(''));
|
|
54
|
+
temporaryPaths.delete(fill);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (const [fill, tempPath] of temporaryPaths.entries()) {
|
|
58
|
+
if (tempPath.length > 0) {
|
|
59
|
+
appendAtKey(paths, fill, tempPath.join(''));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return paths;
|
|
63
|
+
}
|
|
64
|
+
function BatchScatterPaths(props) {
|
|
65
|
+
const {
|
|
66
|
+
series,
|
|
67
|
+
xScale,
|
|
68
|
+
yScale,
|
|
69
|
+
color,
|
|
70
|
+
colorGetter,
|
|
71
|
+
markerSize
|
|
72
|
+
} = props;
|
|
73
|
+
const paths = useCreatePaths(series.data, markerSize, xScale, yScale, color, colorGetter);
|
|
74
|
+
const children = [];
|
|
75
|
+
let i = 0;
|
|
76
|
+
for (const [fill, dArray] of paths.entries()) {
|
|
77
|
+
for (const d of dArray) {
|
|
78
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
79
|
+
fill: fill,
|
|
80
|
+
d: d
|
|
81
|
+
}, i));
|
|
82
|
+
i += 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
86
|
+
children: children
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const MemoBatchScatterPaths = /*#__PURE__*/React.memo(BatchScatterPaths);
|
|
90
|
+
if (process.env.NODE_ENV !== "production") MemoBatchScatterPaths.displayName = "MemoBatchScatterPaths";
|
|
91
|
+
const Group = (0, _styles.styled)('g')({
|
|
92
|
+
'&[data-faded="true"]': {
|
|
93
|
+
opacity: 0.3
|
|
94
|
+
},
|
|
95
|
+
'& path': {
|
|
96
|
+
/* The browser must do hit testing to know which element a pointer is interacting with.
|
|
97
|
+
* With many data points, we create many paths causing significant time to be spent in the hit test phase.
|
|
98
|
+
* To fix this issue, we disable pointer events for the descendant paths.
|
|
99
|
+
*
|
|
100
|
+
* Ideally, users should be able to override this in case they need pointer events to be enabled,
|
|
101
|
+
* but it can affect performance negatively, especially with many data points. */
|
|
102
|
+
pointerEvents: 'none'
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @internal
|
|
108
|
+
* A batch version of the Scatter component that uses SVG paths to render points.
|
|
109
|
+
* This component is optimized for performance and is suitable for rendering large datasets, but has limitations. Some of the limitations include:
|
|
110
|
+
* - Limited CSS styling;
|
|
111
|
+
* - Overriding the `marker` slot is not supported;
|
|
112
|
+
* - Highlight style must not contain opacity.
|
|
113
|
+
*
|
|
114
|
+
* You can read about all the limitations [here](https://mui.com/x/react-charts/scatter/#performance).
|
|
115
|
+
*/
|
|
116
|
+
function BatchScatter(props) {
|
|
117
|
+
const {
|
|
118
|
+
series,
|
|
119
|
+
xScale,
|
|
120
|
+
yScale,
|
|
121
|
+
color,
|
|
122
|
+
colorGetter,
|
|
123
|
+
classes: inClasses
|
|
124
|
+
} = props;
|
|
125
|
+
const {
|
|
126
|
+
store
|
|
127
|
+
} = (0, _ChartProvider.useChartContext)();
|
|
128
|
+
const isSeriesHighlighted = (0, _useSelector.useSelector)(store, _useChartHighlight.selectorChartIsSeriesHighlighted, [series.id]);
|
|
129
|
+
const isSeriesFaded = (0, _useSelector.useSelector)(store, _useChartHighlight.selectorChartIsSeriesFaded, [series.id]);
|
|
130
|
+
const seriesHighlightedItem = (0, _useSelector.useSelector)(store, _useChartHighlight.selectorChartSeriesHighlightedItem, [series.id]);
|
|
131
|
+
const seriesUnfadedItem = (0, _useSelector.useSelector)(store, _useChartHighlight.selectorChartSeriesUnfadedItem, [series.id]);
|
|
132
|
+
const highlightedModifier = 1.2;
|
|
133
|
+
const markerSize = series.markerSize * (isSeriesHighlighted ? highlightedModifier : 1);
|
|
134
|
+
const classes = (0, _scatterClasses.useUtilityClasses)(inClasses);
|
|
135
|
+
const siblings = [];
|
|
136
|
+
if (seriesHighlightedItem != null) {
|
|
137
|
+
const datum = series.data[seriesHighlightedItem];
|
|
138
|
+
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
139
|
+
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
140
|
+
siblings.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
141
|
+
fill: colorGetter ? colorGetter(seriesHighlightedItem) : color,
|
|
142
|
+
"data-highlighted": true,
|
|
143
|
+
d: createPath(getXPosition(datum.x), getYPosition(datum.y), markerSize * highlightedModifier)
|
|
144
|
+
}, `highlighted-${series.id}`));
|
|
145
|
+
}
|
|
146
|
+
if (seriesUnfadedItem != null) {
|
|
147
|
+
const datum = series.data[seriesUnfadedItem];
|
|
148
|
+
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
149
|
+
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
150
|
+
siblings.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
151
|
+
fill: colorGetter ? colorGetter(seriesUnfadedItem) : color,
|
|
152
|
+
d: createPath(getXPosition(datum.x), getYPosition(datum.y), markerSize)
|
|
153
|
+
}, `unfaded-${series.id}`));
|
|
154
|
+
}
|
|
155
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
156
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(Group, {
|
|
157
|
+
className: classes.root,
|
|
158
|
+
"data-series": series.id,
|
|
159
|
+
"data-faded": isSeriesFaded || undefined,
|
|
160
|
+
"data-highlighted": isSeriesHighlighted || undefined,
|
|
161
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(MemoBatchScatterPaths, {
|
|
162
|
+
series: series,
|
|
163
|
+
xScale: xScale,
|
|
164
|
+
yScale: yScale,
|
|
165
|
+
color: color,
|
|
166
|
+
colorGetter: colorGetter,
|
|
167
|
+
markerSize: markerSize
|
|
168
|
+
})
|
|
169
|
+
}), siblings]
|
|
170
|
+
});
|
|
171
|
+
}
|