@mui/x-charts 8.3.1 → 8.5.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 +9 -2
- package/BarChart/BarChart.js +11 -3
- package/BarChart/useBarChartProps.js +1 -1
- package/CHANGELOG.md +213 -0
- package/ChartContainer/ChartContainer.d.ts +21 -2
- package/ChartContainer/ChartContainer.js +17 -1
- package/ChartContainer/useChartContainerProps.js +7 -3
- package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
- package/ChartDataProvider/ChartDataProvider.js +19 -2
- package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
- package/ChartDataProvider/useChartDataProviderProps.js +7 -3
- package/ChartsAxis/axisClasses.d.ts +5 -0
- package/ChartsAxis/axisClasses.js +1 -1
- package/ChartsLegend/ChartsLegend.js +1 -0
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/ChartsSurface/ChartsSurface.js +1 -0
- package/ChartsXAxis/ChartsXAxis.js +7 -16
- package/ChartsYAxis/ChartsYAxis.js +4 -8
- package/Gauge/Gauge.js +1 -0
- package/Gauge/GaugeContainer.js +1 -0
- package/Gauge/GaugeProvider.js +1 -3
- package/LineChart/AnimatedLine.js +1 -0
- package/LineChart/LineChart.d.ts +9 -2
- package/LineChart/LineChart.js +11 -3
- package/LineChart/LineHighlightPlot.js +1 -4
- package/LineChart/MarkPlot.js +1 -4
- package/LineChart/useLineChartProps.js +1 -1
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieChart.d.ts +10 -3
- package/PieChart/PieChart.js +18 -9
- package/RadarChart/RadarChart.d.ts +21 -3
- package/RadarChart/RadarChart.js +20 -4
- package/RadarChart/RadarChart.plugins.d.ts +5 -0
- package/RadarChart/RadarChart.plugins.js +10 -0
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
- package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
- package/RadarChart/index.d.ts +2 -0
- package/RadarChart/index.js +15 -1
- package/RadarChart/useRadarChartProps.d.ts +2 -1
- package/RadarChart/useRadarChartProps.js +3 -1
- package/ScatterChart/Scatter.js +3 -11
- package/ScatterChart/ScatterChart.d.ts +9 -2
- package/ScatterChart/ScatterChart.js +13 -5
- package/ScatterChart/useScatterChartProps.js +4 -2
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +31 -26
- package/Toolbar/Toolbar.d.ts +9 -3
- package/Toolbar/Toolbar.js +23 -7
- package/Toolbar/Toolbar.types.d.ts +15 -0
- package/Toolbar/Toolbar.types.js +5 -0
- package/Toolbar/ToolbarButton.d.ts +8 -2
- package/Toolbar/ToolbarButton.js +25 -6
- package/Toolbar/chartToolbarClasses.d.ts +6 -0
- package/Toolbar/chartToolbarClasses.js +9 -0
- package/Toolbar/index.d.ts +3 -1
- package/Toolbar/index.js +22 -0
- package/Toolbar/internals/ChartsToolbar.d.ts +6 -0
- package/Toolbar/internals/ChartsToolbar.js +14 -0
- package/context/ChartProvider/ChartContext.js +1 -3
- package/context/ChartsSlotsContext.d.ts +20 -0
- package/context/ChartsSlotsContext.js +44 -0
- package/context/index.d.ts +2 -1
- package/context/index.js +11 -0
- package/context/useChartApiContext.d.ts +10 -0
- package/context/useChartApiContext.js +27 -0
- package/esm/BarChart/BarChart.d.ts +9 -2
- package/esm/BarChart/BarChart.js +11 -3
- package/esm/BarChart/useBarChartProps.js +1 -1
- package/esm/ChartContainer/ChartContainer.d.ts +21 -2
- package/esm/ChartContainer/ChartContainer.js +17 -1
- package/esm/ChartContainer/useChartContainerProps.js +7 -3
- package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
- package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
- package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
- package/esm/ChartsAxis/axisClasses.d.ts +5 -0
- package/esm/ChartsAxis/axisClasses.js +1 -1
- package/esm/ChartsLegend/ChartsLegend.js +1 -0
- package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/esm/ChartsSurface/ChartsSurface.js +1 -0
- package/esm/ChartsXAxis/ChartsXAxis.js +7 -16
- package/esm/ChartsYAxis/ChartsYAxis.js +4 -8
- package/esm/Gauge/Gauge.js +1 -0
- package/esm/Gauge/GaugeContainer.js +1 -0
- package/esm/Gauge/GaugeProvider.js +1 -3
- package/esm/LineChart/AnimatedLine.js +1 -0
- package/esm/LineChart/LineChart.d.ts +9 -2
- package/esm/LineChart/LineChart.js +11 -3
- package/esm/LineChart/LineHighlightPlot.js +1 -4
- package/esm/LineChart/MarkPlot.js +1 -4
- package/esm/LineChart/useLineChartProps.js +1 -1
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieChart.d.ts +10 -3
- package/esm/PieChart/PieChart.js +16 -7
- package/esm/RadarChart/RadarChart.d.ts +21 -3
- package/esm/RadarChart/RadarChart.js +20 -4
- package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
- package/esm/RadarChart/RadarChart.plugins.js +4 -0
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
- package/esm/RadarChart/index.d.ts +2 -0
- package/esm/RadarChart/index.js +2 -0
- package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
- package/esm/RadarChart/useRadarChartProps.js +3 -1
- package/esm/ScatterChart/Scatter.js +3 -11
- package/esm/ScatterChart/ScatterChart.d.ts +9 -2
- package/esm/ScatterChart/ScatterChart.js +13 -5
- package/esm/ScatterChart/useScatterChartProps.js +4 -2
- package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +31 -26
- package/esm/Toolbar/Toolbar.d.ts +9 -3
- package/esm/Toolbar/Toolbar.js +22 -7
- package/esm/Toolbar/Toolbar.types.d.ts +15 -0
- package/esm/Toolbar/Toolbar.types.js +1 -0
- package/esm/Toolbar/ToolbarButton.d.ts +8 -2
- package/esm/Toolbar/ToolbarButton.js +24 -5
- package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
- package/esm/Toolbar/chartToolbarClasses.js +2 -0
- package/esm/Toolbar/index.d.ts +3 -1
- package/esm/Toolbar/index.js +3 -1
- package/esm/Toolbar/internals/ChartsToolbar.d.ts +6 -0
- package/esm/Toolbar/internals/ChartsToolbar.js +8 -0
- package/esm/context/ChartProvider/ChartContext.js +1 -3
- package/esm/context/ChartsSlotsContext.d.ts +20 -0
- package/esm/context/ChartsSlotsContext.js +35 -0
- package/esm/context/index.d.ts +2 -1
- package/esm/context/index.js +1 -0
- package/esm/context/useChartApiContext.d.ts +10 -0
- package/esm/context/useChartApiContext.js +21 -0
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useTicks.js +2 -6
- package/esm/index.js +1 -1
- package/esm/internals/constants.d.ts +3 -1
- package/esm/internals/constants.js +2 -1
- package/esm/internals/consumeSlots.js +2 -1
- package/esm/internals/consumeThemeProps.js +3 -1
- package/esm/internals/dateHelpers.d.ts +15 -0
- package/esm/internals/dateHelpers.js +20 -0
- package/esm/internals/domUtils.d.ts +1 -2
- package/esm/internals/domUtils.js +8 -19
- package/esm/internals/index.d.ts +4 -1
- package/esm/internals/index.js +4 -1
- package/esm/internals/material/index.d.ts +2 -0
- package/esm/internals/plugins/allPlugins.d.ts +1 -0
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/esm/models/index.d.ts +2 -2
- package/esm/models/index.js +1 -0
- package/esm/models/slots/chartsBaseSlotProps.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useTicks.js +2 -6
- package/index.js +1 -1
- package/internals/constants.d.ts +3 -1
- package/internals/constants.js +3 -2
- package/internals/consumeSlots.js +2 -1
- package/internals/consumeThemeProps.js +3 -1
- package/internals/dateHelpers.d.ts +15 -0
- package/internals/dateHelpers.js +28 -0
- package/internals/domUtils.d.ts +1 -2
- package/internals/domUtils.js +8 -20
- package/internals/index.d.ts +4 -1
- package/internals/index.js +44 -8
- package/internals/material/index.d.ts +2 -0
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +7 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +6 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/models/index.d.ts +2 -2
- package/models/index.js +11 -0
- package/models/slots/chartsBaseSlotProps.d.ts +1 -0
- package/package.json +3 -3
package/esm/PieChart/PieArc.js
CHANGED
|
@@ -97,6 +97,7 @@ const PieArc = /*#__PURE__*/React.forwardRef(function PieArc(props, ref) {
|
|
|
97
97
|
strokeLinejoin: "round"
|
|
98
98
|
}, other, interactionProps, animatedProps));
|
|
99
99
|
});
|
|
100
|
+
if (process.env.NODE_ENV !== "production") PieArc.displayName = "PieArc";
|
|
100
101
|
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
101
102
|
// ----------------------------- Warning --------------------------------
|
|
102
103
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -92,6 +92,7 @@ const PieArcLabel = /*#__PURE__*/React.forwardRef(function PieArcLabel(props, re
|
|
|
92
92
|
children: formattedArcLabel
|
|
93
93
|
}));
|
|
94
94
|
});
|
|
95
|
+
if (process.env.NODE_ENV !== "production") PieArcLabel.displayName = "PieArcLabel";
|
|
95
96
|
process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
96
97
|
// ----------------------------- Warning --------------------------------
|
|
97
98
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
|
|
4
|
+
import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
|
|
3
5
|
import { ChartContainerProps } from "../ChartContainer/index.js";
|
|
4
6
|
import { PieSeriesType } from "../models/seriesType/index.js";
|
|
5
7
|
import { ChartsTooltipSlots, ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.js";
|
|
@@ -8,9 +10,9 @@ import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from "./PiePlot.js";
|
|
|
8
10
|
import { PieValueType } from "../models/seriesType/pie.js";
|
|
9
11
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
|
|
10
12
|
import { PieChartPluginSignatures } from "./PieChart.plugins.js";
|
|
11
|
-
export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
|
|
12
|
-
export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
|
|
13
|
-
export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
13
|
+
export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
14
|
+
export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
15
|
+
export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series' | 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
14
16
|
/**
|
|
15
17
|
* The series to display in the pie chart.
|
|
16
18
|
* An array of [[PieSeriesType]] objects.
|
|
@@ -24,6 +26,11 @@ export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartP
|
|
|
24
26
|
* Callback fired when a pie arc is clicked.
|
|
25
27
|
*/
|
|
26
28
|
onItemClick?: PiePlotProps['onItemClick'];
|
|
29
|
+
/**
|
|
30
|
+
* If true, shows the default chart toolbar.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
showToolbar?: boolean;
|
|
27
34
|
/**
|
|
28
35
|
* Overridable component slots.
|
|
29
36
|
* @default {}
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
5
|
+
const _excluded = ["series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
9
|
+
import { ChartsToolbar } from "../Toolbar/internals/ChartsToolbar.js";
|
|
9
10
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
10
11
|
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
11
12
|
import { PiePlot } from "./PiePlot.js";
|
|
@@ -55,7 +56,8 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
55
56
|
loading,
|
|
56
57
|
highlightedItem,
|
|
57
58
|
onHighlightChange,
|
|
58
|
-
className
|
|
59
|
+
className,
|
|
60
|
+
showToolbar
|
|
59
61
|
} = props,
|
|
60
62
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
61
63
|
const margin = defaultizeMargin(marginProps, defaultMargin);
|
|
@@ -77,12 +79,13 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
77
79
|
plugins: PIE_CHART_PLUGINS
|
|
78
80
|
}), ref);
|
|
79
81
|
const Tooltip = slots?.tooltip ?? ChartsTooltip;
|
|
82
|
+
const Toolbar = props.slots?.toolbar ?? ChartsToolbar;
|
|
80
83
|
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
|
|
81
84
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, {
|
|
82
85
|
legendPosition: props.slotProps?.legend?.position,
|
|
83
86
|
legendDirection: props?.slotProps?.legend?.direction ?? 'vertical',
|
|
84
87
|
sx: sx,
|
|
85
|
-
children: [!hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
|
|
88
|
+
children: [showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !hideLegend && /*#__PURE__*/_jsx(ChartsLegend, {
|
|
86
89
|
direction: props?.slotProps?.legend?.direction ?? 'vertical',
|
|
87
90
|
slots: slots,
|
|
88
91
|
slotProps: slotProps
|
|
@@ -95,13 +98,14 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
95
98
|
loading: loading,
|
|
96
99
|
slots: slots,
|
|
97
100
|
slotProps: slotProps
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}))]
|
|
101
|
+
}), children]
|
|
102
|
+
})), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({
|
|
103
|
+
trigger: "item"
|
|
104
|
+
}, slotProps?.tooltip))]
|
|
102
105
|
})
|
|
103
106
|
}));
|
|
104
107
|
});
|
|
108
|
+
if (process.env.NODE_ENV !== "production") PieChart.displayName = "PieChart";
|
|
105
109
|
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
106
110
|
// ----------------------------- Warning --------------------------------
|
|
107
111
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -179,6 +183,11 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
179
183
|
* An array of [[PieSeriesType]] objects.
|
|
180
184
|
*/
|
|
181
185
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
186
|
+
/**
|
|
187
|
+
* If true, shows the default chart toolbar.
|
|
188
|
+
* @default false
|
|
189
|
+
*/
|
|
190
|
+
showToolbar: PropTypes.bool,
|
|
182
191
|
/**
|
|
183
192
|
* If `true`, animations are skipped.
|
|
184
193
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ChartsLegendSlotProps, ChartsLegendSlots } from "../ChartsLegend/index.js";
|
|
3
3
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/ChartsOverlay.js";
|
|
4
|
+
import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
5
|
+
import { ChartsWrapperProps } from "../internals/components/ChartsWrapper/index.js";
|
|
4
6
|
import { RadarGridProps } from "./RadarGrid/index.js";
|
|
5
7
|
import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
|
|
6
8
|
import { RadarAxisHighlightProps } from "./RadarAxisHighlight/index.js";
|
|
7
9
|
import { ChartsTooltipSlotProps, ChartsTooltipSlots } from "../ChartsTooltip/index.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export interface
|
|
10
|
+
import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
|
|
11
|
+
import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
|
|
12
|
+
export interface RadarChartSlots extends ChartsTooltipSlots, ChartsOverlaySlots, ChartsLegendSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
13
|
+
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'> {
|
|
11
15
|
/**
|
|
12
16
|
* If `true`, the legend is not rendered.
|
|
13
17
|
*/
|
|
14
18
|
hideLegend?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* If true, shows the default chart toolbar.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
showToolbar?: boolean;
|
|
15
24
|
/**
|
|
16
25
|
* Overridable component slots.
|
|
17
26
|
* @default {}
|
|
@@ -23,5 +32,14 @@ export interface RadarChartProps extends RadarDataProviderProps, Omit<RadarGridP
|
|
|
23
32
|
*/
|
|
24
33
|
slotProps?: RadarChartSlotProps;
|
|
25
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Demos:
|
|
37
|
+
*
|
|
38
|
+
* - [Radar Chart](https://mui.com/x/react-charts/radar/)
|
|
39
|
+
*
|
|
40
|
+
* API:
|
|
41
|
+
*
|
|
42
|
+
* - [RadarChart API](https://mui.com/x/api/charts/radar-chart/)
|
|
43
|
+
*/
|
|
26
44
|
declare const RadarChart: React.ForwardRefExoticComponent<RadarChartProps & React.RefAttributes<SVGSVGElement>>;
|
|
27
45
|
export { RadarChart };
|
|
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
|
+
import { ChartsToolbar } from "../Toolbar/internals/ChartsToolbar.js";
|
|
7
8
|
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
8
9
|
import { ChartsOverlay } from "../ChartsOverlay/ChartsOverlay.js";
|
|
9
10
|
import { useRadarChartProps } from "./useRadarChartProps.js";
|
|
@@ -16,6 +17,15 @@ import { RadarAxisHighlight } from "./RadarAxisHighlight/index.js";
|
|
|
16
17
|
import { RadarMetricLabels } from "./RadarMetricLabels/index.js";
|
|
17
18
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
18
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
/**
|
|
21
|
+
* Demos:
|
|
22
|
+
*
|
|
23
|
+
* - [Radar Chart](https://mui.com/x/react-charts/radar/)
|
|
24
|
+
*
|
|
25
|
+
* API:
|
|
26
|
+
*
|
|
27
|
+
* - [RadarChart API](https://mui.com/x/api/charts/radar-chart/)
|
|
28
|
+
*/
|
|
19
29
|
const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, ref) {
|
|
20
30
|
const props = useThemeProps({
|
|
21
31
|
props: inProps,
|
|
@@ -32,15 +42,17 @@ const RadarChart = /*#__PURE__*/React.forwardRef(function RadarChart(inProps, re
|
|
|
32
42
|
children
|
|
33
43
|
} = useRadarChartProps(props);
|
|
34
44
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
45
|
+
const Toolbar = props.slots?.toolbar ?? ChartsToolbar;
|
|
35
46
|
return /*#__PURE__*/_jsx(RadarDataProvider, _extends({}, radarDataProviderProps, {
|
|
36
47
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
37
|
-
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
48
|
+
children: [props.showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
38
49
|
ref: ref,
|
|
39
|
-
children: [/*#__PURE__*/_jsx(RadarGrid, _extends({}, radarGrid)), /*#__PURE__*/_jsx(RadarMetricLabels, {}), /*#__PURE__*/_jsx(RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/_jsx(RadarAxisHighlight, {}), /*#__PURE__*/_jsx(RadarSeriesMarks, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)),
|
|
40
|
-
}))]
|
|
50
|
+
children: [/*#__PURE__*/_jsx(RadarGrid, _extends({}, radarGrid)), /*#__PURE__*/_jsx(RadarMetricLabels, {}), /*#__PURE__*/_jsx(RadarSeriesArea, {}), highlight === 'axis' && /*#__PURE__*/_jsx(RadarAxisHighlight, {}), /*#__PURE__*/_jsx(RadarSeriesMarks, {}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), children]
|
|
51
|
+
})), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip))]
|
|
41
52
|
}))
|
|
42
53
|
}));
|
|
43
54
|
});
|
|
55
|
+
if (process.env.NODE_ENV !== "production") RadarChart.displayName = "RadarChart";
|
|
44
56
|
process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
45
57
|
// ----------------------------- Warning --------------------------------
|
|
46
58
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -49,7 +61,6 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
49
61
|
apiRef: PropTypes.shape({
|
|
50
62
|
current: PropTypes.object
|
|
51
63
|
}),
|
|
52
|
-
children: PropTypes.node,
|
|
53
64
|
className: PropTypes.string,
|
|
54
65
|
/**
|
|
55
66
|
* Color palette used to colorize multiple series.
|
|
@@ -145,6 +156,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
145
156
|
* @default 'sharp'
|
|
146
157
|
*/
|
|
147
158
|
shape: PropTypes.oneOf(['circular', 'sharp']),
|
|
159
|
+
/**
|
|
160
|
+
* If true, shows the default chart toolbar.
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
showToolbar: PropTypes.bool,
|
|
148
164
|
/**
|
|
149
165
|
* If `true`, animations are skipped.
|
|
150
166
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UseChartPolarAxisSignature } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
2
|
+
import { UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
3
|
+
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
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 RadarChartPluginsSignatures = [UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { useChartPolarAxis } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
2
|
+
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
3
|
+
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
4
|
+
export const RADAR_PLUGINS = [useChartPolarAxis, useChartInteraction, useChartHighlight];
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
-
import {
|
|
3
|
+
import { RadarChartPluginsSignatures } from "../RadarChart.plugins.js";
|
|
4
4
|
import { RadarSeriesType } from "../../models/seriesType/radar.js";
|
|
5
|
-
import {
|
|
6
|
-
import { UseChartHighlightSignature } from "../../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
7
|
-
import { UseChartInteractionSignature } from "../../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
5
|
+
import { ChartDataProviderProps } from "../../ChartDataProvider/index.js";
|
|
8
6
|
import { RadarConfig } from "./radar.types.js";
|
|
9
|
-
|
|
10
|
-
export
|
|
7
|
+
import { ChartAnyPluginSignature } from "../../internals/plugins/models/plugin.js";
|
|
8
|
+
export type RadarDataProviderProps<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginsSignatures> = Omit<ChartDataProviderProps<'radar', TSignatures>, 'series' | 'rotationAxis' | 'radiusAxis' | 'dataset'> & {
|
|
11
9
|
/**
|
|
12
10
|
* The series to display in the bar chart.
|
|
13
11
|
* An array of [[RadarSeriesType]] objects.
|
|
@@ -22,9 +20,6 @@ export interface RadarDataProviderProps extends Omit<ChartContainerProps<'radar'
|
|
|
22
20
|
* @default 'axis'
|
|
23
21
|
*/
|
|
24
22
|
highlight?: 'axis' | 'series' | 'none';
|
|
25
|
-
}
|
|
26
|
-
declare function RadarDataProvider(props: RadarDataProviderProps): React.JSX.Element;
|
|
27
|
-
declare namespace RadarDataProvider {
|
|
28
|
-
var propTypes: any;
|
|
29
|
-
}
|
|
23
|
+
};
|
|
24
|
+
declare function RadarDataProvider<TSignatures extends readonly ChartAnyPluginSignature[] = RadarChartPluginsSignatures>(props: RadarDataProviderProps<TSignatures>): React.JSX.Element;
|
|
30
25
|
export { RadarDataProvider };
|
|
@@ -2,20 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["series", "children", "width", "height", "colors", "
|
|
5
|
+
const _excluded = ["series", "children", "width", "height", "colors", "skipAnimation", "margin", "radar", "highlight", "plugins"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import
|
|
7
|
+
import { RADAR_PLUGINS } from "../RadarChart.plugins.js";
|
|
8
8
|
import { ChartDataProvider } from "../../ChartDataProvider/index.js";
|
|
9
9
|
import { defaultizeMargin } from "../../internals/defaultizeMargin.js";
|
|
10
|
-
import { useChartPolarAxis } from "../../internals/plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
11
|
-
import { useChartHighlight } from "../../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
12
|
-
import { useChartInteraction } from "../../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
13
10
|
import { radarSeriesConfig } from "../seriesConfig/index.js";
|
|
14
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
12
|
const RADAR_SERIES_CONFIG = {
|
|
16
13
|
radar: radarSeriesConfig
|
|
17
14
|
};
|
|
18
|
-
const RADAR_PLUGINS = [useChartPolarAxis, useChartInteraction, useChartHighlight];
|
|
19
15
|
const DEFAULT_RADAR_MARGIN = {
|
|
20
16
|
top: 30,
|
|
21
17
|
bottom: 30,
|
|
@@ -29,12 +25,11 @@ function RadarDataProvider(props) {
|
|
|
29
25
|
width,
|
|
30
26
|
height,
|
|
31
27
|
colors,
|
|
32
|
-
highlightedItem,
|
|
33
|
-
onHighlightChange,
|
|
34
28
|
skipAnimation,
|
|
35
29
|
margin,
|
|
36
30
|
radar,
|
|
37
|
-
highlight
|
|
31
|
+
highlight,
|
|
32
|
+
plugins
|
|
38
33
|
} = props,
|
|
39
34
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
40
35
|
const rotationAxes = React.useMemo(() => [{
|
|
@@ -80,117 +75,12 @@ function RadarDataProvider(props) {
|
|
|
80
75
|
height: height,
|
|
81
76
|
margin: defaultizedMargin,
|
|
82
77
|
colors: colors,
|
|
83
|
-
highlightedItem: highlightedItem,
|
|
84
|
-
onHighlightChange: onHighlightChange,
|
|
85
78
|
skipAnimation: skipAnimation,
|
|
86
|
-
plugins: RADAR_PLUGINS,
|
|
79
|
+
plugins: plugins ?? RADAR_PLUGINS,
|
|
87
80
|
rotationAxis: rotationAxes,
|
|
88
81
|
radiusAxis: radiusAxis,
|
|
89
82
|
seriesConfig: RADAR_SERIES_CONFIG,
|
|
90
83
|
children: children
|
|
91
84
|
}));
|
|
92
85
|
}
|
|
93
|
-
process.env.NODE_ENV !== "production" ? RadarDataProvider.propTypes = {
|
|
94
|
-
// ----------------------------- Warning --------------------------------
|
|
95
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
96
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
97
|
-
// ----------------------------------------------------------------------
|
|
98
|
-
apiRef: PropTypes.shape({
|
|
99
|
-
current: PropTypes.object
|
|
100
|
-
}),
|
|
101
|
-
children: PropTypes.node,
|
|
102
|
-
className: PropTypes.string,
|
|
103
|
-
/**
|
|
104
|
-
* Color palette used to colorize multiple series.
|
|
105
|
-
* @default rainbowSurgePalette
|
|
106
|
-
*/
|
|
107
|
-
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
108
|
-
desc: PropTypes.string,
|
|
109
|
-
/**
|
|
110
|
-
* If `true`, the charts will not listen to the mouse move event.
|
|
111
|
-
* It might break interactive features, but will improve performance.
|
|
112
|
-
* @default false
|
|
113
|
-
*/
|
|
114
|
-
disableAxisListener: PropTypes.bool,
|
|
115
|
-
/**
|
|
116
|
-
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
117
|
-
*/
|
|
118
|
-
height: PropTypes.number,
|
|
119
|
-
/**
|
|
120
|
-
* Indicates if the chart should highlight items per axis or per series.
|
|
121
|
-
* @default 'axis'
|
|
122
|
-
*/
|
|
123
|
-
highlight: PropTypes.oneOf(['axis', 'none', 'series']),
|
|
124
|
-
/**
|
|
125
|
-
* The highlighted item.
|
|
126
|
-
* Used when the highlight is controlled.
|
|
127
|
-
*/
|
|
128
|
-
highlightedItem: PropTypes.shape({
|
|
129
|
-
dataIndex: PropTypes.number,
|
|
130
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
131
|
-
}),
|
|
132
|
-
/**
|
|
133
|
-
* This prop is used to help implement the accessibility logic.
|
|
134
|
-
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
135
|
-
*/
|
|
136
|
-
id: PropTypes.string,
|
|
137
|
-
/**
|
|
138
|
-
* Localized text for chart components.
|
|
139
|
-
*/
|
|
140
|
-
localeText: PropTypes.object,
|
|
141
|
-
/**
|
|
142
|
-
* The margin between the SVG and the drawing area.
|
|
143
|
-
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
144
|
-
*
|
|
145
|
-
* Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
146
|
-
*/
|
|
147
|
-
margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
148
|
-
bottom: PropTypes.number,
|
|
149
|
-
left: PropTypes.number,
|
|
150
|
-
right: PropTypes.number,
|
|
151
|
-
top: PropTypes.number
|
|
152
|
-
})]),
|
|
153
|
-
/**
|
|
154
|
-
* The callback fired when the highlighted item changes.
|
|
155
|
-
*
|
|
156
|
-
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
157
|
-
*/
|
|
158
|
-
onHighlightChange: PropTypes.func,
|
|
159
|
-
/**
|
|
160
|
-
* The configuration of the radar scales.
|
|
161
|
-
*/
|
|
162
|
-
radar: PropTypes.shape({
|
|
163
|
-
labelFormatter: PropTypes.func,
|
|
164
|
-
labelGap: PropTypes.number,
|
|
165
|
-
max: PropTypes.number,
|
|
166
|
-
metrics: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.arrayOf(PropTypes.shape({
|
|
167
|
-
max: PropTypes.number,
|
|
168
|
-
min: PropTypes.number,
|
|
169
|
-
name: PropTypes.string.isRequired
|
|
170
|
-
}))]).isRequired,
|
|
171
|
-
startAngle: PropTypes.number
|
|
172
|
-
}).isRequired,
|
|
173
|
-
/**
|
|
174
|
-
* The series to display in the bar chart.
|
|
175
|
-
* An array of [[RadarSeriesType]] objects.
|
|
176
|
-
*/
|
|
177
|
-
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
178
|
-
/**
|
|
179
|
-
* The configuration helpers used to compute attributes according to the series type.
|
|
180
|
-
* @ignore Unstable props for internal usage.
|
|
181
|
-
*/
|
|
182
|
-
seriesConfig: PropTypes.object,
|
|
183
|
-
/**
|
|
184
|
-
* If `true`, animations are skipped.
|
|
185
|
-
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
186
|
-
*/
|
|
187
|
-
skipAnimation: PropTypes.bool,
|
|
188
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
189
|
-
theme: PropTypes.oneOf(['dark', 'light']),
|
|
190
|
-
title: PropTypes.string,
|
|
191
|
-
/**
|
|
192
|
-
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
193
|
-
*/
|
|
194
|
-
width: PropTypes.number
|
|
195
|
-
} : void 0;
|
|
196
86
|
export { RadarDataProvider };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { RadarChart as Unstable_RadarChart } from "./RadarChart.js";
|
|
2
|
+
export { RadarChart } from "./RadarChart.js";
|
|
2
3
|
export { RadarDataProvider as Unstable_RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
4
|
+
export { RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
3
5
|
export type { RadarChartProps } from "./RadarChart.js";
|
|
4
6
|
export type { RadarDataProviderProps } from "./RadarDataProvider/index.js";
|
|
5
7
|
export * from "./RadarGrid/index.js";
|
package/esm/RadarChart/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { RadarChart as Unstable_RadarChart } from "./RadarChart.js";
|
|
2
|
+
export { RadarChart } from "./RadarChart.js";
|
|
2
3
|
export { RadarDataProvider as Unstable_RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
4
|
+
export { RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
3
5
|
export * from "./RadarGrid/index.js";
|
|
4
6
|
export * from "./RadarAxisHighlight/index.js";
|
|
5
7
|
export * from "./RadarMetricLabels/index.js";
|
|
@@ -5,6 +5,7 @@ import type { ChartsWrapperProps } from "../internals/components/ChartsWrapper/i
|
|
|
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 { RadarChartPluginsSignatures } from "./RadarChart.plugins.js";
|
|
8
9
|
/**
|
|
9
10
|
* A helper function that extracts RadarChartProps from the input props
|
|
10
11
|
* and returns an object with props for the children components of RadarChart.
|
|
@@ -16,7 +17,7 @@ export declare const useRadarChartProps: (props: RadarChartProps) => {
|
|
|
16
17
|
highlight: "none" | "series" | "axis";
|
|
17
18
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
18
19
|
chartsSurfaceProps: ChartsSurfaceProps;
|
|
19
|
-
radarDataProviderProps: RadarDataProviderProps
|
|
20
|
+
radarDataProviderProps: RadarDataProviderProps<RadarChartPluginsSignatures>;
|
|
20
21
|
radarGrid: RadarGridProps;
|
|
21
22
|
overlayProps: ChartsOverlayProps;
|
|
22
23
|
legendProps: ChartsLegendSlotExtension;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
-
const _excluded = ["series", "radar", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "hideLegend", "divisions", "shape", "stripeColor", "highlight"];
|
|
4
|
+
const _excluded = ["apiRef", "series", "radar", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "hideLegend", "divisions", "shape", "stripeColor", "highlight", "showToolbar"];
|
|
5
5
|
/**
|
|
6
6
|
* A helper function that extracts RadarChartProps from the input props
|
|
7
7
|
* and returns an object with props for the children components of RadarChart.
|
|
@@ -11,6 +11,7 @@ const _excluded = ["series", "radar", "width", "height", "margin", "colors", "sx
|
|
|
11
11
|
*/
|
|
12
12
|
export const useRadarChartProps = props => {
|
|
13
13
|
const {
|
|
14
|
+
apiRef,
|
|
14
15
|
series,
|
|
15
16
|
radar,
|
|
16
17
|
width,
|
|
@@ -32,6 +33,7 @@ export const useRadarChartProps = props => {
|
|
|
32
33
|
} = props,
|
|
33
34
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
34
35
|
const radarDataProviderProps = {
|
|
36
|
+
apiRef,
|
|
35
37
|
series,
|
|
36
38
|
radar,
|
|
37
39
|
highlight,
|
|
@@ -54,19 +54,11 @@ function Scatter(props) {
|
|
|
54
54
|
const scatterPoint = series.data[i];
|
|
55
55
|
const x = getXPosition(scatterPoint.x);
|
|
56
56
|
const y = getYPosition(scatterPoint.y);
|
|
57
|
-
const isInRange = instance.isPointInside(
|
|
58
|
-
x,
|
|
59
|
-
y
|
|
60
|
-
});
|
|
61
|
-
const pointCtx = {
|
|
62
|
-
type: 'scatter',
|
|
63
|
-
seriesId: series.id,
|
|
64
|
-
dataIndex: i
|
|
65
|
-
};
|
|
57
|
+
const isInRange = instance.isPointInside(x, y);
|
|
66
58
|
if (isInRange) {
|
|
67
59
|
const currentItem = {
|
|
68
|
-
seriesId:
|
|
69
|
-
dataIndex:
|
|
60
|
+
seriesId: series.id,
|
|
61
|
+
dataIndex: i
|
|
70
62
|
};
|
|
71
63
|
const isItemHighlighted = isHighlighted(currentItem);
|
|
72
64
|
temp.push({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
|
|
4
|
+
import { ChartsSlots, ChartsSlotProps } from "../internals/material/index.js";
|
|
3
5
|
import { ScatterPlotProps, ScatterPlotSlotProps, ScatterPlotSlots } from "./ScatterPlot.js";
|
|
4
6
|
import { ChartContainerProps } from "../ChartContainer/index.js";
|
|
5
7
|
import { ChartsAxisProps } from "../ChartsAxis/index.js";
|
|
@@ -12,8 +14,8 @@ import { ChartsAxisSlots, ChartsAxisSlotProps } from "../models/axis.js";
|
|
|
12
14
|
import { ChartsGridProps } from "../ChartsGrid/index.js";
|
|
13
15
|
import { UseChartVoronoiSignature } from "../internals/plugins/featurePlugins/useChartVoronoi/index.js";
|
|
14
16
|
import { ScatterChartPluginsSignatures } from "./ScatterChart.plugins.js";
|
|
15
|
-
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
|
|
16
|
-
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
|
|
17
|
+
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
18
|
+
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
17
19
|
export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', ScatterChartPluginsSignatures>, 'series' | 'plugins' | 'onItemClick'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
18
20
|
/**
|
|
19
21
|
* The series to display in the scatter chart.
|
|
@@ -39,6 +41,11 @@ export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', S
|
|
|
39
41
|
* If `true`, the legend is not rendered.
|
|
40
42
|
*/
|
|
41
43
|
hideLegend?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* If true, shows the default chart toolbar.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
showToolbar?: boolean;
|
|
42
49
|
/**
|
|
43
50
|
* Overridable component slots.
|
|
44
51
|
* @default {}
|
|
@@ -16,6 +16,7 @@ import { useChartContainerProps } from "../ChartContainer/useChartContainerProps
|
|
|
16
16
|
import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
17
17
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
18
18
|
import { ChartsWrapper } from "../internals/components/ChartsWrapper/index.js";
|
|
19
|
+
import { ChartsToolbar } from "../Toolbar/internals/ChartsToolbar.js";
|
|
19
20
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
/**
|
|
21
22
|
* Demos:
|
|
@@ -48,19 +49,21 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(inProps
|
|
|
48
49
|
chartsSurfaceProps
|
|
49
50
|
} = useChartContainerProps(chartContainerProps, ref);
|
|
50
51
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
52
|
+
const Toolbar = props.slots?.toolbar ?? ChartsToolbar;
|
|
51
53
|
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
|
|
52
54
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
53
|
-
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
55
|
+
children: [props.showToolbar ? /*#__PURE__*/_jsx(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
54
56
|
children: [/*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsx("g", {
|
|
55
57
|
"data-drawing-container": true,
|
|
56
58
|
children: /*#__PURE__*/_jsx(ScatterPlot, _extends({}, scatterPlotProps))
|
|
57
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)),
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}))]
|
|
59
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), children]
|
|
60
|
+
})), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({
|
|
61
|
+
trigger: "item"
|
|
62
|
+
}, props.slotProps?.tooltip))]
|
|
61
63
|
}))
|
|
62
64
|
}));
|
|
63
65
|
});
|
|
66
|
+
if (process.env.NODE_ENV !== "production") ScatterChart.displayName = "ScatterChart";
|
|
64
67
|
process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
65
68
|
// ----------------------------- Warning --------------------------------
|
|
66
69
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -174,6 +177,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
174
177
|
* An array of [[ScatterSeriesType]] objects.
|
|
175
178
|
*/
|
|
176
179
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
180
|
+
/**
|
|
181
|
+
* If true, shows the default chart toolbar.
|
|
182
|
+
* @default false
|
|
183
|
+
*/
|
|
184
|
+
showToolbar: PropTypes.bool,
|
|
177
185
|
/**
|
|
178
186
|
* If `true`, animations are skipped.
|
|
179
187
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { SCATTER_CHART_PLUGINS } from "./ScatterChart.plugins.js";
|
|
8
8
|
/**
|
|
@@ -55,7 +55,9 @@ export const useScatterChartProps = props => {
|
|
|
55
55
|
voronoiMaxRadius,
|
|
56
56
|
onItemClick: disableVoronoi ? undefined : onItemClick,
|
|
57
57
|
className,
|
|
58
|
-
plugins: SCATTER_CHART_PLUGINS
|
|
58
|
+
plugins: SCATTER_CHART_PLUGINS,
|
|
59
|
+
slots,
|
|
60
|
+
slotProps
|
|
59
61
|
});
|
|
60
62
|
const chartsAxisProps = {
|
|
61
63
|
slots,
|
|
@@ -13,7 +13,7 @@ import { BarPlotSlots, BarPlotSlotProps } from "../BarChart/BarPlot.js";
|
|
|
13
13
|
import { ChartMargin } from "../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js";
|
|
14
14
|
export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, Omit<BarPlotSlots, 'barLabel'>, ChartsTooltipSlots {}
|
|
15
15
|
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {}
|
|
16
|
-
export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'rotationAxis' | 'margin' | 'plugins' | 'colors'> {
|
|
16
|
+
export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'rotationAxis' | 'margin' | 'plugins' | 'colors' | 'slots' | 'slotProps'> {
|
|
17
17
|
/**
|
|
18
18
|
* The xAxis configuration.
|
|
19
19
|
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|